diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container new file mode 100644 index 0000000000000000000000000000000000000000..dd9dba2e6675656f73c6f8ef0d99141ad2332819 --- /dev/null +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -0,0 +1,283 @@ +#!/bin/groovy +/* + * 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 + */ + +// Location of the executor node +def nodeExecutor = params.nodeExecutor + +// Tags to shorten pipeline duration +def doMandatoryTests = false +def doFullTestsuite = false + +// +def gitCommitAuthorEmailAddr + +pipeline { + agent { + label nodeExecutor + } + options { + disableConcurrentBuilds() + timestamps() + gitLabConnection('OAI GitLab') + ansiColor('xterm') + } + + stages { + stage ("Verify Parameters") { + steps { + script { + JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"' + JOB_TIMESTAMP = JOB_TIMESTAMP.trim() + + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + def allParametersPresent = true + + echo '\u2705 \u001B[32mVerify Labels\u001B[0m' + if ("MERGE".equals(env.gitlabActionType)) { + LABEL_CHECK = sh returnStdout: true, script: 'ci-scripts/checkGitLabMergeRequestLabels.sh --mr-id ' + env.gitlabMergeRequestIid + LABEL_CHECK = LABEL_CHECK.trim() + if (LABEL_CHECK == 'NONE') { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Your merge request has none of the mandatory labels:\n\n" + message += " - BUILD-ONLY\n" + message += " - 4G-LTE\n" + message += " - 5G-NR\n" + message += " - CI\n\n" + message += "Not performing CI due to lack of labels" + addGitLabMRComment comment: message + error('Not performing CI due to lack of labels') + } else if (LABEL_CHECK == 'FULL') { + doMandatoryTests = true + doFullTestsuite = true + } else if (LABEL_CHECK == 'SHORTEN-5G') { + doMandatoryTests = true + } else { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): We will perform only build stages on your Merge Request" + addGitLabMRComment comment: message + } + } else { + doMandatoryTests = true + doFullTestsuite = true + } + } + } + } + stage ("Verify Guidelines") { + steps { + echo "Git URL is ${GIT_URL}" + echo "GitLab Act is ${env.gitlabActionType}" + script { + if ("MERGE".equals(env.gitlabActionType)) { + // since a bit, in push events, gitlabUserEmail is not populated + gitCommitAuthorEmailAddr = env.gitlabUserEmail + echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}" + // GitLab-Jenkins plugin integration is lacking to perform the merge by itself + // Doing it manually --> it may have merge conflicts + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" + } else { + echo "Git Branch is ${GIT_BRANCH}" + echo "Git Commit is ${GIT_COMMIT}" + // since a bit, in push events, gitlabUserEmail is not populated + gitCommitAuthorEmailAddr = sh returnStdout: true, script: 'git log -n1 --pretty=format:%ae ${GIT_COMMIT}' + gitCommitAuthorEmailAddr = gitCommitAuthorEmailAddr.trim() + echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}" + sh "git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG" + } + } + } + post { + failure { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI" + addGitLabMRComment comment: message + currentBuild.result = 'FAILURE' + } + } + } + } + // Build Stages are Mandatory + // Later we will add a Ubuntu20 build + stage ("Image Building Processes") { + parallel { + stage ("Ubuntu18 Build") { + steps { + script { + triggerSlaveJob ('RAN-Ubuntu18-Image-Builder', 'Ubuntu18-Images-Build') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-Ubuntu18-Image-Builder') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } + stage ("RHEL8 Build") { + steps { + script { + triggerSlaveJob ('RAN-RHEL8-Image-Builder', 'RHEL8-Images-Build') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-RHEL8-Image-Builder') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } + stage ("CppCheck Analysis") { + steps { + script { + triggerSlaveJob ('RAN-cppcheck', 'CppCheck Analysis') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-cppcheck') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } + } + } + } + post { + always { + script { + def eSubject = JOB_NAME + ' - Build # ' + BUILD_ID + ' - ' + currentBuild.result + '!' + def eBody = "Hi,\n\n" + eBody += "Here are attached HTML report files for " + JOB_NAME + " - Build # " + BUILD_ID + " - " + currentBuild.result + "!\n\n" + eBody += "Regards,\n" + eBody += "OAI CI Team" + emailext attachmentsPattern: '*results*.html', + body: eBody, + replyTo: 'no-reply@openairinterface.org', + subject: eSubject, + to: gitCommitAuthorEmailAddr + + if (fileExists('.git/CI_COMMIT_MSG')) { + sh "rm -f .git/CI_COMMIT_MSG" + } + } + } + success { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")" + if ("MERGE".equals(env.gitlabActionType)) { + echo "This is a MERGE event" + addGitLabMRComment comment: message + } + } + } + failure { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")" + if ("MERGE".equals(env.gitlabActionType)) { + echo "This is a MERGE event" + addGitLabMRComment comment: message + } + } + } + } +} + +// ---- Slave Job functions + +def triggerSlaveJob (jobName, gitlabStatusName) { + // Workaround for the "cancelled" GitLab pipeline notification + // The slave job is triggered with the propagate false so the following commands are executed + // Its status is now PASS/SUCCESS from a stage pipeline point of view + // localStatus variable MUST be analyzed to properly assess the status + localStatus = build job: jobName, + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: "MERGE".equals(env.gitlabActionType)), + string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch)) + ], propagate: false + localResult = localStatus.getResult() + echo "${jobName} Slave Job status is ${localResult}" + gitlabCommitStatus(name: gitlabStatusName) { + if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) { + echo "${jobName} Slave Job is OK" + } else { + echo "${jobName} Slave Job is KO" + sh "ci-scripts/fail.sh" + } + } +} + +def triggerSlaveJobNoGitLab (jobName) { + // Workaround for the "cancelled" GitLab pipeline notification + // The slave job is triggered with the propagate false so the following commands are executed + // Its status is now PASS/SUCCESS from a stage pipeline point of view + // localStatus variable MUST be analyzed to properly assess the status + localStatus = build job: jobName, + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: "MERGE".equals(env.gitlabActionType)), + string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch)) + ], propagate: false + localResult = localStatus.getResult() + echo "${jobName} Slave Job status is ${localResult}" + if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) { + echo "${jobName} Slave Job is OK" + } else { + echo "${jobName} Slave Job is KO" + sh "ci-scripts/fail.sh" + } +} + +def finalizeSlaveJob(jobName) { + // In case of any non-success, we are retrieving the HTML report of the last completed + // slave job. The only drop-back is that we may retrieve the HTML report of a previous build + fileName = "test_results-${jobName}.html" + if (!fileExists(fileName)) { + copyArtifacts(projectName: jobName, + filter: 'test_results*.html', + selector: lastCompleted()) + if (fileExists(fileName)) { + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}" + archiveArtifacts artifacts: fileName + } + } +} diff --git a/ci-scripts/Jenkinsfile-git-dashboard b/ci-scripts/Jenkinsfile-git-dashboard new file mode 100644 index 0000000000000000000000000000000000000000..6ebd46bc762410647c059ad02af2272ac679c0e9 --- /dev/null +++ b/ci-scripts/Jenkinsfile-git-dashboard @@ -0,0 +1,45 @@ +#!/bin/groovy +/* + * 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 + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + + +pipeline { + agent { + label pythonExecutor + } + stages { + stage ("gDashboard") { + steps { + script { + //retrieve MR data from gitlab and export to gSheet + sh returnStdout: true, script: 'python3 ci-scripts/ran_dashboard.py' + } + } + } + } +} + + diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index de49275b7ead1652a3b11e716e981359faa0df78..bb78a21ca0d8f0f79326868105c78825d7803160 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -224,33 +224,14 @@ pipeline { } } } - } + } - stage ("Start VM -- cppcheck") { - steps { - lock (vmResource) { - timeout (time: 7, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" - } - } - } - } - stage ("Variant Builds") { parallel { - stage ("Analysis with cppcheck") { - steps { - gitlabCommitStatus(name: "Analysis with cppcheck") { - timeout (time: 30, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } - } - } stage ("Build basic simulator") { steps { gitlabCommitStatus(name: "Build basic-sim") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -259,7 +240,7 @@ pipeline { stage ("Build 5G gNB-USRP") { steps { gitlabCommitStatus(name: "Build gNB-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -268,7 +249,7 @@ pipeline { stage ("Build 5G NR-UE-USRP") { steps { gitlabCommitStatus(name: "Build nr-UE-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant nr-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -277,7 +258,7 @@ pipeline { stage ("Build physical simulators") { steps { gitlabCommitStatus(name: "Build phy-sim") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -286,7 +267,7 @@ pipeline { stage ("Build eNB-ethernet") { steps { gitlabCommitStatus(name: "Build eNB-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -297,7 +278,7 @@ pipeline { // This is typically the last one to finish. lock (vmResource) { gitlabCommitStatus(name: "Build UE-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -315,9 +296,9 @@ pipeline { script { dir ('archives') { if (fileExists('red_hat')) { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" + sh "zip -r -qq vm_build_logs.zip basic_sim phy_sim enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" } else { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp" + sh "zip -r -qq vm_build_logs.zip basic_sim phy_sim enb_eth ue_eth gnb_usrp nr_ue_usrp" } } if(fileExists('archives/vm_build_logs.zip')) { @@ -325,16 +306,6 @@ pipeline { } if ("MERGE".equals(env.gitlabActionType)) { sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" - // If the merge request has introduced more CPPCHECK errors or warnings, notifications in GitLab - if (fileExists('oai_cppcheck_added_errors.txt')) { - def ret=readFile('./oai_cppcheck_added_errors.txt').trim(); - if ("0".equals(ret)) { - echo "No added cppcheck warnings/errors in this merge request" - } else { - def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some modified files in Merge Request MAY have INTRODUCED up to " + ret + " CPPCHECK errors/warnings" - addGitLabMRComment comment: message - } - } // If the merge request has introduced compilation warnings, notifications in GitLab sh "./ci-scripts/checkAddedWarnings.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}" def res=readFile('./oai_warning_files.txt').trim(); diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel new file mode 100644 index 0000000000000000000000000000000000000000..8ac2e6adffa3a5d5d3f434e8f936b6de33da667f --- /dev/null +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel @@ -0,0 +1,293 @@ +#!/bin/groovy +/* + * 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 + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the phone resource +def ciSmartPhonesResource1 = params.SmartPhonesResource1 +def ciSmartPhonesResource2 = params.SmartPhonesResource2 + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess +def eNB_TargetBranch + +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + ansiColor('xterm') + lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) + } + stages { + stage("Build Init") { + steps { + // update the build name and description + buildName "${params.eNB_MR}" + buildDescription "Branch : ${params.eNB_Branch}" + } + } + stage ("Verify Parameters") { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.SmartPhonesResource1 == null) { + allParametersPresent = false + } + if (params.SmartPhonesResource2 == null) { + allParametersPresent = false + } + // 1st eNB parameters + if (params.eNB_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB_Credentials == null) { + allParametersPresent = false + } + // 2nd eNB parameters + if (params.eNB1_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB1_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB1_Credentials == null) { + allParametersPresent = false + } + // 3rd eNB parameters + if (params.eNB2_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB2_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB2_Credentials == null) { + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + if (params.eNB_CommitID == null) { + eNB_CommitID = env.GIT_COMMIT + } else { + eNB_CommitID = params.eNB_CommitID + } + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_AllowMergeRequestProcess!= null) { + eNB_AllowMergeRequestProcess = params.eNB_AllowMergeRequestProcess + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } + + if (params.EPC_IPAddress == null) { + allParametersPresent = false + } + if (params.EPC_Type == null) { + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + allParametersPresent = false + } + + if (params.ADB_IPAddress == null) { + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + allParametersPresent = false + } + + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + stage ("Build and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + // If not present picking a default XML file + if (params.pythonTestXmlFile == null) { + // picking default + testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " + } else { + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + } + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB1_Credentials}", usernameVariable: 'eNB1_Username', passwordVariable: 'eNB1_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB2_Credentials}", usernameVariable: 'eNB2_Username', passwordVariable: 'eNB2_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" + } + } + } + } + } + stage('Log Collection') { + parallel { + stage('Log Collection (eNB - Build)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "build.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (eNB - Run)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Run)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("enb.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "enb.log.${env.BUILD_ID}.zip" + } + if(fileExists("ci-scripts/test_results.html")) { + sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts "test_results-${JOB_NAME}.html" + } + } + } + } + } + } + } + + post { + always { + script { + if (params.pipelineZipsConsoleLog != null) { + if (params.pipelineZipsConsoleLog) { + echo "Archiving Jenkins console log" + sh "wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true" + sh "zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true" + if(fileExists("consoleText.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "consoleText.log.${env.BUILD_ID}.zip" + } + } + } + } + } + } +} diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index 7f61639261a93f37e87930f50968004347e37507..66d12eed33a7c5172649aff6cde5a95bd449fda6 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -34,15 +34,16 @@ def buildStageStatus = true def testStageName = params.pipelineTestStageName // Name of the phone resource -def ciSmartPhoneResource1 = params.smartphonesResource1 -def ciSmartPhoneResource2 = params.smartphonesResource2 +def ciSmartPhonesResource1 = params.SmartPhonesResource1 +def ciSmartPhonesResource2 = params.SmartPhonesResource2 +def ciSmartPhonesResource3 = params.SmartPhonesResource3 // Global Parameters. Normally they should be populated when the master job // triggers the slave job with parameters def eNB_Repository def eNB_Branch def eNB_CommitID -def eNB_AllowMergeRequestProcess = false +def eNB_AllowMergeRequestProcess def eNB_TargetBranch pipeline { @@ -52,7 +53,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: ciSmartPhoneResource2]], resource: ciSmartPhoneResource1) + lock(extra: [[resource: ciSmartPhonesResource2],[resource: ciSmartPhonesResource3]], resource: ciSmartPhonesResource1) } stages { stage("Build Init") { @@ -78,10 +79,13 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.smartphonesResource1 == null) { + if (params.SmartPhonesResource1 == null) { allParametersPresent = false } - if (params.smartphonesResource2 == null) { + if (params.SmartPhonesResource2 == null) { + allParametersPresent = false + } + if (params.SmartPhonesResource3== null) { allParametersPresent = false } // 1st eNB parameters @@ -134,8 +138,8 @@ pipeline { eNB_CommitID = params.eNB_CommitID } echo "eNB_CommitID : ${eNB_CommitID}" - if (params.eNB_mergeRequest != null) { - eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (params.eNB_AllowMergeRequestProcess!= null) { + eNB_AllowMergeRequestProcess = params.eNB_AllowMergeRequestProcess if (eNB_AllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index ab1573de7fc374d040e22e353e1641cca4b70edf..7d5307620f0ad4b8034cc174a86b5fff2544db89 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -241,6 +241,10 @@ pipeline { stage ("Terminate") { parallel { stage('Terminate UE') { + // Bypassing this stage if there are no abd server defined + when { + expression { params.ADB_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate UE\u001B[0m' withCredentials([ @@ -275,6 +279,10 @@ pipeline { } } stage('Terminate SPGW') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate SPGW\u001B[0m' withCredentials([ @@ -292,6 +300,10 @@ pipeline { } } stage('Terminate MME') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate MME\u001B[0m' withCredentials([ @@ -309,6 +321,10 @@ pipeline { } } stage('Terminate HSS') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate HSS\u001B[0m' withCredentials([ @@ -371,6 +387,10 @@ pipeline { } } stage('Log Collection (SPGW)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -389,6 +409,10 @@ pipeline { } } stage('Log Collection (MME)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -407,6 +431,10 @@ pipeline { } } stage('Log Collection (HSS)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -425,6 +453,10 @@ pipeline { } } stage('Log Collection (Ping)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -443,6 +475,10 @@ pipeline { } } stage('Log Collection (Iperf)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -482,7 +518,7 @@ pipeline { // Making sure that we really shutdown every thing before leaving failure { script { - if (!termStatusArray[termUE]) { + if ((!termStatusArray[termUE]) && (params.ADB_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { @@ -496,21 +532,21 @@ pipeline { sh "python3 ci-scripts/main.py --mode=TerminateeNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" } } - if (!termStatusArray[termSPGW]) { + if ((!termStatusArray[termSPGW]) && (params.EPC_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] ]) { sh "python3 ci-scripts/main.py --mode=TerminateSPGW --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCType=${params.EPC_Type} --EPCSourceCodePath=${params.EPC_SourceCodePath}" } } - if (!termStatusArray[termMME]) { + if ((!termStatusArray[termMME]) && (params.EPC_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] ]) { sh "python3 ci-scripts/main.py --mode=TerminateMME --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCType=${params.EPC_Type} --EPCSourceCodePath=${params.EPC_SourceCodePath}" } } - if (!termStatusArray[termHSS]) { + if ((!termStatusArray[termHSS]) && (params.EPC_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] ]) { diff --git a/ci-scripts/Jenkinsfile-trig-nsa b/ci-scripts/Jenkinsfile-trig-nsa index 2ecf6ebd1efc5cd73c66b91d6d9fbd960340104d..3dd5ce3b50ccd74719a9e8ab4c968b53263360e3 100644 --- a/ci-scripts/Jenkinsfile-trig-nsa +++ b/ci-scripts/Jenkinsfile-trig-nsa @@ -25,28 +25,43 @@ // Location of the python executor node shall be in the same subnet as the others servers def pythonExecutor = params.pythonExecutor +def TARGET_BRANCH = "develop" +def ALLOW_MERGE = true + pipeline { agent { label pythonExecutor } stages { - stage ("NSA Test Loop") { + stage ("Launcher") { steps { - script { + script { + //retrieve MR that are opened nd with tag READY_TO_BE_MERGED MR_LIST= sh returnStdout: true, script: 'curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100&labels=READY_TO_BE_MERGED" | jq ".[].iid" || true ' echo "List of selected MR:\n${MR_LIST}" - def MR_ARRAY = MR_LIST.split('\n') + def MR_ARRAY = MR_LIST.split('\n') + //for every selected MR, retrieve the branch name and the latest commit for (MR in MR_ARRAY) { SRC_BRANCH=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".source_branch" || true """ SRC_BRANCH=SRC_BRANCH.trim() COMMIT_ID=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".sha" || true """ COMMIT_ID=COMMIT_ID.trim() echo "Testing NSA on : ${MR} ${SRC_BRANCH} ${COMMIT_ID}" - //calling sub job + //calling NSA sub job build job: "RAN-CI-NSA-B210", wait : false, propagate : false, parameters: [ string(name: 'eNB_MR', value: String.valueOf(MR)), string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)), - string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)) + string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)), + string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)), + booleanParam(name: 'eNB_AllowMergeRequestProcess', value: Boolean.valueOf(ALLOW_MERGE)) + ] + //calling Benetel sub job + build job: "RAN-CI-BENETEL", wait : false, propagate : false, parameters: [ + string(name: 'eNB_MR', value: String.valueOf(MR)), + string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)), + string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)), + booleanParam(name: 'eNB_AllowMergeRequestProcess', value: Boolean.valueOf(ALLOW_MERGE)) ] } } diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 248e873cdd66845490ee2fbd5a74a6edd3a26e66..288e0b4885aeccab95de87ba0f3eec896e2fa767 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -41,7 +41,7 @@ import constants as CONST #----------------------------------------------------------- -def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): +def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA): py_param_file_present = False @@ -80,6 +80,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranRepository=matchReg.group(1) ldpc.ranRepository=matchReg.group(1) CONTAINERS.ranRepository=matchReg.group(1) + SCA.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) @@ -92,6 +93,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.ranAllowMerge=True HTML.ranAllowMerge=True CONTAINERS.ranAllowMerge=True + SCA.ranAllowMerge=True elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE) @@ -102,6 +104,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranBranch=matchReg.group(1) ldpc.ranBranch=matchReg.group(1) CONTAINERS.ranBranch=matchReg.group(1) + SCA.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) @@ -112,6 +115,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranCommitID=matchReg.group(1) ldpc.ranCommitID=matchReg.group(1) CONTAINERS.ranCommitID=matchReg.group(1) + SCA.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) @@ -122,12 +126,14 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranTargetBranch=matchReg.group(1) ldpc.ranTargetBranch=matchReg.group(1) CONTAINERS.ranTargetBranch=matchReg.group(1) + SCA.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.eNBIPAddress=matchReg.group(1) ldpc.eNBIpAddr=matchReg.group(1) CONTAINERS.eNBIPAddress=matchReg.group(1) + SCA.eNBIPAddress=matchReg.group(1) elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1IPAddress=matchReg.group(1) @@ -142,6 +148,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBUserName=matchReg.group(1) ldpc.eNBUserName=matchReg.group(1) CONTAINERS.eNBUserName=matchReg.group(1) + SCA.eNBUserName=matchReg.group(1) elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1UserName=matchReg.group(1) @@ -156,6 +163,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBPassword=matchReg.group(1) ldpc.eNBPassWord=matchReg.group(1) CONTAINERS.eNBPassword=matchReg.group(1) + SCA.eNBPassword=matchReg.group(1) elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1Password=matchReg.group(1) @@ -170,6 +178,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBSourceCodePath=matchReg.group(1) ldpc.eNBSourceCodePath=matchReg.group(1) CONTAINERS.eNBSourceCodePath=matchReg.group(1) + SCA.eNBSourceCodePath=matchReg.group(1) elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1SourceCodePath=matchReg.group(1) diff --git a/ci-scripts/buildOnRH.sh b/ci-scripts/buildOnRH.sh deleted file mode 100755 index eaff097c885ad1d219ba502bd58cbde245020955..0000000000000000000000000000000000000000 --- a/ci-scripts/buildOnRH.sh +++ /dev/null @@ -1,216 +0,0 @@ -#!/bin/bash -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ - -function usage { - echo "OAI RedHat Build Check script" - echo " Original Author: Raphael Defosseux" - - echo "" - echo "Usage:" - echo "------" - echo " buildOnRH.sh [OPTIONS]" - echo "" - echo "Options:" - echo "--------" - echo " --job-name #### OR -jn ####" - echo " Specify the name of the Jenkins job." - echo "" - echo " --build-id #### OR -id ####" - echo " Specify the build ID of the Jenkins job." - echo "" - echo " --workspace #### OR -ws ####" - echo " Specify the workspace." - echo "" - echo " --remote-host #### OR -rh ####" - echo " Specify the RedHat remote server." - echo "" - echo " --remote-user-name #### OR -ru ####" - echo " Specify the RedHat remote server username." - echo "" - echo " --remote-password #### OR -rp ####" - echo " Specify the RedHat remote server password." - echo "" - echo " --remote-path #### OR -ra ####" - echo " Specify the RedHat remote server path to work on." - echo "" -} - -if [ $# -lt 1 ] || [ $# -gt 14 ] -then - echo "Syntax Error: not the correct number of arguments" - echo "" - usage - exit 1 -fi - -RH_HOST=XX -RH_USER=XX -RH_PASSWD=XX -RH_PATH=XX -JOB_NAME=XX -BUILD_ID=XX - -while [[ $# -gt 0 ]] -do -key="$1" - -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -jn|--job-name) - JOB_NAME="$2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - shift - shift - ;; - -ws|--workspace) - JENKINS_WKSP="$2" - shift - shift - ;; - -rh|--remote-host) - RH_HOST="$2" - shift - shift - ;; - -ru|--remote-user-name) - RH_USER="$2" - shift - shift - ;; - -rp|--remote-password) - RH_PASSWD="$2" - shift - shift - ;; - -ra|--remote-path) - RH_PATH="$2" - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 -esac -done - -if [ ! -f $JENKINS_WKSP/localZip.zip ] -then - echo "Missing localZip.zip file!" - exit 1 -fi - -if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] || [ "$RH_HOST" == "XX" ] || [ "$RH_USER" == "XX" ] || [ "$RH_PASSWD" == "XX" ] || [ "$RH_PATH" == "XX" ] -then - echo "Missing options" - usage - exit 1 -fi - -echo "############################################################" -echo "Copying GIT repo into RedHat Server" -echo "############################################################" -echo "rm -Rf ${RH_PATH}" >> rh-cmd.txt -echo "mkdir -p ${RH_PATH}" >> rh-cmd.txt - -sshpass -p ${RH_PASSWD} ssh -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST} < rh-cmd.txt -rm -f rh-cmd.txt - -echo "############################################################" -echo "Running install and build script on RedHat Server" -echo "############################################################" -sshpass -p ${RH_PASSWD} scp -o 'StrictHostKeyChecking no' $JENKINS_WKSP/localZip.zip ${RH_USER}@${RH_HOST}:${RH_PATH} - -echo "cd ${RH_PATH}" > rh-cmd.txt -echo "unzip -qq localZip.zip" >> rh-cmd.txt -echo "source oaienv" >> rh-cmd.txt -echo "cd cmake_targets" >> rh-cmd.txt -echo "mkdir -p log" >> rh-cmd.txt -echo "./build_oai -I -w USRP --eNB > log/install-build.txt 2>&1" >> rh-cmd.txt -sshpass -p ${RH_PASSWD} ssh -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST} < rh-cmd.txt - -rm -f rh-cmd.txt - -echo "############################################################" -echo "Creating a tmp folder to store results and artifacts" -echo "############################################################" -if [ ! -d $JENKINS_WKSP/archives ] -then - mkdir -p $JENKINS_WKSP/archives -fi - -ARCHIVES_LOC=$JENKINS_WKSP/archives/red_hat -if [ ! -d $ARCHIVES_LOC ] -then - mkdir -p $ARCHIVES_LOC -fi - -sshpass -p ${RH_PASSWD} scp -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST}:${RH_PATH}/cmake_targets/log/*.txt $ARCHIVES_LOC - -echo "############################################################" -echo "Checking build status" -echo "############################################################" - -LOG_PATTERN=.Rel15.txt -NB_PATTERN_FILES=7 - -LOG_FILES=`ls $ARCHIVES_LOC/*.txt` -STATUS=0 -NB_FOUND_FILES=0 - -for FULLFILE in $LOG_FILES -do - if [[ $FULLFILE == *"$LOG_PATTERN"* ]] - then - filename=$(basename -- "$FULLFILE") - PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"` - LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE` - if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi - NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) - fi -done - -if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ] -then - echo "Expecting $NB_PATTERN_FILES log files and found $NB_FOUND_FILES" - STATUS=-1 -fi - -echo "COMMAND: build_oai -I -w USRP --eNB" > $ARCHIVES_LOC/build_final_status.log -if [ $STATUS -eq 0 ] -then - echo "BUILD_OK" >> $ARCHIVES_LOC/build_final_status.log - echo "STATUS seems OK" -else - echo "BUILD_KO" >> $ARCHIVES_LOC/build_final_status.log - echo "STATUS failed?" -fi -exit $STATUS diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index 2b1a5e0c71526534c7173111a2909a31c150e5cd..31e9653769cdc019745ce3864eed45aea34e9f4b 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -62,7 +62,7 @@ function build_on_vm { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 0c07dfe91fe24f044f5b52915ea12ad57944aa90..e5011dcd46413ae051b4c4ed2899459baa3acd62 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -35,6 +35,7 @@ import sys # arg import re # reg import logging import os +import shutil import time from multiprocessing import Process, Lock, SimpleQueue from zipfile import ZipFile @@ -82,6 +83,7 @@ class Containerize(): self.flexranCtrlDeployed = False self.flexranCtrlIpAddress = '' self.cli = '' + self.cliBuildOptions = '' self.dockerfileprefix = '' self.host = '' self.allImagesSize = {} @@ -123,9 +125,11 @@ class Containerize(): if self.host == 'Ubuntu': self.cli = 'docker' self.dockerfileprefix = '.ubuntu18' + self.cliBuildOptions = '--no-cache' elif self.host == 'Red Hat': - self.cli = 'podman' + self.cli = 'sudo podman' self.dockerfileprefix = '.rhel8.2' + self.cliBuildOptions = '--no-cache --disable-compression' imageNames = [] result = re.search('eNB', self.imageKind) @@ -143,6 +147,8 @@ class Containerize(): imageNames.append(('oai-gnb', 'gNB')) imageNames.append(('oai-lte-ue', 'lteUE')) imageNames.append(('oai-nr-ue', 'nrUE')) + if self.host == 'Red Hat': + imageNames.append(('oai-physim', 'phySim')) if len(imageNames) == 0: imageNames.append(('oai-enb', 'eNB')) @@ -173,6 +179,7 @@ class Containerize(): # 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 already been checked earlier imageTag = 'develop' + sharedTag = 'develop' if (self.ranAllowMerge): imageTag = 'ci-temp' if self.ranTargetBranch == '': @@ -188,38 +195,23 @@ class Containerize(): mySSH.command('mkdir -p tmp/entitlement/', '\$', 5) mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca/', '\$', 5) mySSH.command('sudo cp /etc/pki/entitlement/*.pem tmp/entitlement/', '\$', 5) - - #mySSH.close() - #return 0 + sharedimage = 'ran-build' # Let's remove any previous run artifacts if still there - mySSH.command(self.cli + ' image prune --force', '\$', 5) - mySSH.command(self.cli + ' image rm ' + sharedimage + ':' + imageTag, '\$', 5) - for image,pattern in imageNames: - mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 5) - # Build the shared image - mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + imageTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) - # Build the target image(s) - previousImage = sharedimage + ':' + imageTag - danglingShaOnes=[] + mySSH.command(self.cli + ' image prune --force', '\$', 30) + if (not self.ranAllowMerge): + mySSH.command(self.cli + ' image rm ' + sharedimage + ':' + sharedTag, '\$', 30) for image,pattern in imageNames: - # the archived Dockerfiles have "ran-build:latest" as base image - # we need to update them with proper tag - mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) - mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) - # Retrieving the dangling image(s) for the log collection - mySSH.command(self.cli + ' images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5) - result = re.search('sha=(?P<imageShaOne>[a-zA-Z0-9\-\_]+)', mySSH.getBefore()) - if result is not None: - danglingShaOnes.append((image, result.group('imageShaOne'))) - previousImage = image + ':' + imageTag + mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 30) - imageTag = 'ci-temp' - # First verify if images were properly created. + # Build the shared image only on Push Events (not on Merge Requests) + if (not self.ranAllowMerge): + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + sharedimage + ' --tag ' + sharedimage + ':' + sharedTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) + # First verify if the shared image was properly created. status = True - mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + imageTag, '\$', 5) - if mySSH.getBefore().count('No such object') != 0: - logging.error('Could not build properly ran-build') + mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + sharedTag, '\$', 5) + if mySSH.getBefore().count('o such image') != 0: + logging.error('\u001B[1m Could not build properly ran-build\u001B[0m') status = False else: result = re.search('Size *= *(?P<size>[0-9\-]+) *bytes', mySSH.getBefore()) @@ -240,11 +232,40 @@ class Containerize(): self.allImagesSize['ran-build'] = str(round(imageSize,1)) + ' Gbytes' else: logging.debug('ran-build size is unknown') + # If the shared image failed, no need to continue + if not status: + # Recover the name of the failed container? + mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) + mySSH.command(self.cli + ' image prune --force', '\$', 30) + mySSH.close() + logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') + HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTabFooter(False) + sys.exit(1) + else: + # Recover build logs, for the moment only possible when build is successful + mySSH.command(self.cli + ' create --name test ' + sharedimage + ':' + sharedTag, '\$', 5) + mySSH.command('mkdir -p cmake_targets/log/ran-build', '\$', 5) + mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5) + mySSH.command(self.cli + ' rm -f test', '\$', 5) + + # Build the target image(s) for image,pattern in imageNames: + # the archived Dockerfiles have "ran-build:latest" as base image + # we need to update them with proper tag + mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + sharedTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) + # split the log + mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) + mySSH.command('python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/' + image + '.log', '\$', 5) + # checking the status of the build mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) - if mySSH.getBefore().count('No such object') != 0: - logging.error('Could not build properly ' + image) + if mySSH.getBefore().count('o such image') != 0: + logging.error('\u001B[1m Could not build properly ' + image + '\u001B[0m') status = False + # Here we should check if the last container corresponds to a failed command and destroy it + mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) + self.allImagesSize[image] = 'N/A -- Build Failed' else: result = re.search('Size *= *(?P<size>[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: @@ -264,39 +285,27 @@ class Containerize(): self.allImagesSize[image] = str(round(imageSize,1)) + ' Gbytes' else: logging.debug('ran-build size is unknown') - if not status: - mySSH.close() - logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') - HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - #HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) - HTML.CreateHtmlTabFooter(False) - sys.exit(1) + self.allImagesSize[image] = 'unknown' + # Now pruning dangling images in between target builds + mySSH.command(self.cli + ' image prune --force', '\$', 30) - # Recover build logs, for the moment only possible when build is successful - mySSH.command(self.cli + ' create --name test ' + sharedimage + ':' + imageTag, '\$', 5) - mySSH.command('mkdir -p cmake_targets/log/ran-build', '\$', 5) - mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5) - mySSH.command(self.cli + ' rm -f test', '\$', 5) - for image,shaone in danglingShaOnes: - mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) - mySSH.command(self.cli + ' create --name test ' + shaone, '\$', 5) - mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/' + image, '\$', 5) - mySSH.command(self.cli + ' rm -f test', '\$', 5) - mySSH.command(self.cli + ' image prune --force', '\$', 5) - mySSH.command('cd cmake_targets', '\$', 5) + # Analyzing the logs + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) - #mySSH.close() - - mySSH.command('cd /tmp/CI-eNB/cmake_targets', '\$', 5) + + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) + mySSH.command('rm -f build_log_' + self.testCase_id + '.zip || true', '\$', 5) if (os.path.isfile('./build_log_' + self.testCase_id + '.zip')): os.remove('./build_log_' + self.testCase_id + '.zip') + if (os.path.isdir('./build_log_' + self.testCase_id)): + shutil.rmtree('./build_log_' + self.testCase_id) mySSH.command('zip -r -qq build_log_' + self.testCase_id + '.zip build_log_' + self.testCase_id, '\$', 5) mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '.zip', '.') - #mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) + mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) mySSH.close() ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.') - + #Trying to identify the errors and warnings for each built images imageNames1 = imageNames shared = ('ran-build','ran') @@ -328,9 +337,16 @@ class Containerize(): files[fil] = errorandwarnings self.collectInfo[image] = files - logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') - HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + if status: + logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') + HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + else: + logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') + HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlTabFooter(False) + sys.exit(1) def DeployObject(self, HTML, EPC): if self.eNB_serverId[self.eNB_instance] == '0': diff --git a/ci-scripts/cls_static_code_analysis.py b/ci-scripts/cls_static_code_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..980efb4f8adb72c7c4af31e3cdeecb41d96be74a --- /dev/null +++ b/ci-scripts/cls_static_code_analysis.py @@ -0,0 +1,192 @@ +#/* +# * 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 +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- +import sys # arg +import re # reg +import logging +import os +import time + +#----------------------------------------------------------- +# OAI Testing modules +#----------------------------------------------------------- +import sshconnection as SSH +import helpreadme as HELP +import constants as CONST + +#----------------------------------------------------------- +# Class Declaration +#----------------------------------------------------------- +class CppCheckResults(): + + def __init__(self): + + self.variants = ['xenial', 'bionic'] + self.versions = ['',''] + self.nbErrors = [0,0] + self.nbWarnings = [0,0] + self.nbNullPtrs = [0,0] + self.nbMemLeaks = [0,0] + self.nbUninitVars = [0,0] + self.nbInvalidPrintf = [0,0] + self.nbModuloAlways = [0,0] + self.nbTooManyBitsShift = [0,0] + self.nbIntegerOverflow = [0,0] + self.nbWrongScanfArg = [0,0] + self.nbPtrAddNotNull = [0,0] + self.nbOppoInnerCondition = [0,0] + +class StaticCodeAnalysis(): + + def __init__(self): + + self.ranRepository = '' + self.ranBranch = '' + self.ranAllowMerge = False + self.ranCommitID = '' + self.ranTargetBranch = '' + self.eNBIPAddress = '' + self.eNBUserName = '' + self.eNBPassword = '' + self.eNBSourceCodePath = '' + + def CppCheckAnalysis(self, HTML): + if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + lIpAddr = self.eNBIPAddress + lUserName = self.eNBUserName + lPassWord = self.eNBPassword + lSourcePath = self.eNBSourceCodePath + + if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + logging.debug('Building on server: ' + lIpAddr) + mySSH = SSH.SSHConnection() + mySSH.open(lIpAddr, lUserName, lPassWord) + + self.testCase_id = HTML.testCase_id + + # on RedHat/CentOS .git extension is mandatory + result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) + if result is not None: + full_ran_repo_name = self.ranRepository + else: + full_ran_repo_name = self.ranRepository + '.git' + mySSH.command('mkdir -p ' + lSourcePath, '\$', 5) + mySSH.command('cd ' + lSourcePath, '\$', 5) + mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + # Raphael: here add a check if git clone or git fetch went smoothly + mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) + + mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) + mySSH.command('mkdir -p cmake_targets/log', '\$', 5) + # if the commit ID is provided use it to point to it + if self.ranCommitID != '': + mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5) + + mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60) + mySSH.command('docker build --tag oai-cppcheck:xenial --file ci-scripts/docker/Dockerfile.cppcheck.xenial . > cmake_targets/log/cppcheck-xenial.txt 2>&1', '\$', 600) + mySSH.command('sed -e "s@xenial@bionic@" ci-scripts/docker/Dockerfile.cppcheck.xenial > ci-scripts/docker/Dockerfile.cppcheck.bionic', '\$', 6) + mySSH.command('docker build --tag oai-cppcheck:bionic --file ci-scripts/docker/Dockerfile.cppcheck.bionic . > cmake_targets/log/cppcheck-bionic.txt 2>&1', '\$', 600) + mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60) + + # Analyzing the logs + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) + mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) + mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) + mySSH.close() + + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '/*', '.') + CCR = CppCheckResults() + vId = 0 + for variant in CCR.variants: + if (os.path.isfile('./cppcheck-'+ variant + '.txt')): + xmlStart = False + with open('./cppcheck-'+ variant + '.txt', 'r') as logfile: + for line in logfile: + ret = re.search('Unpacking cppcheck \((?P<version>[0-9\.]+)', str(line)) + if ret is not None: + CCR.versions[vId] = ret.group('version') + if re.search('RUN cat cmake_targets/log/cppcheck.xml', str(line)) is not None: + xmlStart = True + if xmlStart: + if re.search('severity="error"', str(line)) is not None: + CCR.nbErrors[vId] += 1 + if re.search('severity="warning"', str(line)) is not None: + CCR.nbWarnings[vId] += 1 + if re.search('id="memleak"', str(line)) is not None: + CCR.nbMemLeaks[vId] += 1 + if re.search('id="nullPointer"', str(line)) is not None: + CCR.nbNullPtrs[vId] += 1 + if re.search('id="uninitvar"', str(line)) is not None: + CCR.nbUninitVars[vId] += 1 + if re.search('id="invalidPrintfArgType_sint"|id="invalidPrintfArgType_uint"', str(line)) is not None: + CCR.nbInvalidPrintf[vId] += 1 + if re.search('id="moduloAlwaysTrueFalse"', str(line)) is not None: + CCR.nbModuloAlways[vId] += 1 + if re.search('id="shiftTooManyBitsSigned"', str(line)) is not None: + CCR.nbTooManyBitsShift[vId] += 1 + if re.search('id="integerOverflow"', str(line)) is not None: + CCR.nbIntegerOverflow[vId] += 1 + if re.search('id="wrongPrintfScanfArgNum"|id="invalidScanfArgType_int"', str(line)) is not None: + CCR.nbWrongScanfArg[vId] += 1 + if re.search('id="pointerAdditionResultNotNull"', str(line)) is not None: + CCR.nbPtrAddNotNull[vId] += 1 + if re.search('id="oppositeInnerCondition"', str(line)) is not None: + CCR.nbOppoInnerCondition[vId] += 1 + logging.debug('======== Variant ' + variant + ' - ' + CCR.versions[vId] + ' ========') + logging.debug(' ' + str(CCR.nbErrors[vId]) + ' errors') + logging.debug(' ' + str(CCR.nbWarnings[vId]) + ' warnings') + logging.debug(' -- Details --') + logging.debug(' Memory leak: ' + str(CCR.nbMemLeaks[vId])) + logging.debug(' Possible null pointer deference: ' + str(CCR.nbNullPtrs[vId])) + logging.debug(' Uninitialized variable: ' + str(CCR.nbUninitVars[vId])) + logging.debug(' Undefined behaviour shifting: ' + str(CCR.nbTooManyBitsShift[vId])) + logging.debug(' Signed integer overflow: ' + str(CCR.nbIntegerOverflow[vId])) + logging.debug('') + logging.debug(' Printf formatting issue: ' + str(CCR.nbInvalidPrintf[vId])) + logging.debug(' Modulo result is predetermined: ' + str(CCR.nbModuloAlways[vId])) + logging.debug(' Opposite Condition -> dead code: ' + str(CCR.nbOppoInnerCondition[vId])) + logging.debug(' Wrong Scanf Nb Args: ' + str(CCR.nbWrongScanfArg[vId])) + logging.debug('') + vId += 1 + + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTestRowCppCheckResults(CCR) + logging.info('\u001B[1m Static Code Analysis Pass\u001B[0m') + + return 0 + diff --git a/ci-scripts/conf_files/benetel-4g.conf b/ci-scripts/conf_files/benetel-4g.conf new file mode 100644 index 0000000000000000000000000000000000000000..9423ebe56ecb84c5b2559abf057ce8f1fde8bad3 --- /dev/null +++ b/ci-scripts/conf_files/benetel-4g.conf @@ -0,0 +1,285 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + # real_time choice in {hard, rt-preempt, no} + real_time = "no"; + + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ( { mcc = 222; mnc = 01; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "NGFI_RCC_IF4p5"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2655000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 100; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 90; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -10; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + //SSB central frequency of NR secondary cell group (for ENDC NSA) + nr_scg_ssb_freq = 640000; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + enable_measurement_reports = "yes"; + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.1"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 160; + puCch10xSnr = 160; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 150; + } +); + +RUs = ( + { + //local_if_name = "enp129s0f0"; + local_if_name = "dpdk"; + sdr_addrs = "softmodem -m 2048 -l 35 -n 2 -b 0000:81:00.3 --proc-type auto --file-prefix ggg -- -p 0x1"; + #sdr_addrs = "softmodem -l 8 -n 2 -- -p 0x2"; + #remote_address = "127.0.0.2"; + #local_address = "127.0.0.1"; + #local_portc = 50000; + #remote_portc = 50000; + #local_portd = 50001; + #remote_portd = 50001; + local_rf = "no" + tr_preference = "raw_if4p5" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + eNB_instances = [0]; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + #parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf new file mode 100644 index 0000000000000000000000000000000000000000..c9f0a579e164dc93073ae64bf04ff1df0febe8e0 --- /dev/null +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -0,0 +1,303 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + #pusch_TargetSNRx10 = 200; + #pucch_TargetSNRx10 = 200; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is is the central frequency of SSB + absoluteFrequencySSB = 640000; //641272 + dl_frequencyBand = 78; + # the carrier frequency is assumed to be in the middle of the carrier, i.e. dl_absoluteFrequencyPointA_kHz + dl_carrierBandwidth*12*SCS_kHz/2 + dl_absoluteFrequencyPointA = 638728; //640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=84,L=13 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 + + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 4; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 74; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; + #preambleReceivedTargetPower = -104; + #preambleReceivedTargetPower = -108; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 2; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 5; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 1; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + #msg1_SubcarrierSpacing = 1, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; # used for UL slot + initialULBWPmappingType_0 = 1 + initialULBWPstartSymbolAndLength_0 = 55; # this is SS=0 L=12 + + initialULBWPk2_1 = 6; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 24; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + + + msg3_DeltaPreamble = 1; + #p0_NominalWithGrant =-90; + p0_NominalWithGrant =-118; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + #p0_nominal = -90; + p0_nominal = -118; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; #0x80; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + #ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -35; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "127.0.0.1"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "no" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + //clock_src = "internal"; + clock_src = "external"; + + local_if_name = "dpdk"; + sdr_addrs = "softmodem -m 2048 -l 34 -n 3 -b 0000:81:00.2 --proc-type auto --file-prefix hhh -- -p 0x1"; + remote_address = "127.0.0.2"; + local_address = "127.0.0.1"; + local_portc = 50000; + remote_portc = 50000; + local_portd = 50001; + remote_portd = 50001; + tr_preference = "raw_if4p5" + + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + //parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_DISABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/conf_files/channelmod_rfsimu.conf b/ci-scripts/conf_files/channelmod_rfsimu.conf new file mode 100644 index 0000000000000000000000000000000000000000..9a6ded24f11dbc8b5131872284c43b5e96a3846b --- /dev/null +++ b/ci-scripts/conf_files/channelmod_rfsimu.conf @@ -0,0 +1,57 @@ +#/* configuration for channel modelisation */ +#/* To be included in main config file when */ +#/* channel modelisation is used (rfsimulator with chanmod options enabled) */ +channelmod = { + max_chan=10; + modellist="modellist_rfsimu_1"; + modellist_rfsimu_1 = ( + { + model_name = "rfsimu_channel_enB0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = -10; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue1" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + } + ); + modellist_rfsimu_2 = ( + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue1" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue2" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + } + ); +}; + diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf index 4d89ad96daa3708d0e67b8bb12ca163870f472f1..087ee37f01b961d7f09ce997ae14d1bddf626288 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf @@ -260,7 +260,6 @@ NETWORK_CONTROLLER : FLEXRAN_CACHE = "/mnt/oai_agent_cache"; FLEXRAN_AWAIT_RECONF = "no"; }; - log_config : { global_log_level ="info"; @@ -279,3 +278,4 @@ NETWORK_CONTROLLER : rrc_log_verbosity ="medium"; }; +@include "channelmod_rfsimu.conf" diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf new file mode 100644 index 0000000000000000000000000000000000000000..0da833b3f7d070cc3ba6a5621f03d69caab65543 --- /dev/null +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -0,0 +1,301 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 311; mnc = 480; mnc_length = 3;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP) + absoluteFrequencySSB = 2071241; + dl_frequencyBand = 261; + # this is 27.900 GHz + dl_absoluteFrequencyPointA = 2070833; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 3; + dl_carrierBandwidth = 32; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=32 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 3; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=2,L=3 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) + initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 261; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 3; + ul_carrierBandwidth = 32; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 3; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 52; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 7; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 3, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 14; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 3; + ssb_PositionsInBurst_Bitmap = 0x0001000100010001L; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 3; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 3; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 3; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "no"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.199"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2"; + if_freq = 5124520000L; + clock_src = "external"; + time_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf index 32de0aa4f57d6ea6d05d8625fc93b547056db0dc..b8a601ce412aea7b837b3e23b3324eb1cbec284d 100644 --- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -185,7 +186,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index decaa392d752cacfd789a23b9054e3c226431781..b1d72c226935bd9b6c3a3290b59b6ea23692f031 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -89,7 +90,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -186,7 +187,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -240,7 +241,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 0 @@ -249,12 +250,12 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index 258618e7f0644e9e8a983350b9d9b93099b8b8aa..7be25a24fac9c0460c23f864e122987b492c05c3 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -22,6 +22,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; @@ -48,7 +49,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -90,7 +91,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -250,7 +251,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + pusch_proc_threads = 6; } ); diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf new file mode 100644 index 0000000000000000000000000000000000000000..809203f672bb8d8de427e47206779a0b1468a701 --- /dev/null +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -0,0 +1,305 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641272; //641032; #641968; 641968=start of ssb at 3600MHz + 82 RBs 641032=center of SSB at center of cell + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=84,L=13 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) + initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -100; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 5; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 2; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; #0x80; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + port = 36412 ; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "CI_FR1_CTL_ENB_IP_ADDR"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 6; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; #114 + eNB_instances = [0]; + sdr_addrs = "addr=192.168.80.50" + clock_src = "internal" + + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + //parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + +uicc: { +opc = "testopc"; +}; diff --git a/ci-scripts/createVM.sh b/ci-scripts/createVM.sh index b67668f0bcc4036736b381d9caf84ab6e8567c19..ab859c10d761fb27d2fc7e1f4d5503361453eaed 100755 --- a/ci-scripts/createVM.sh +++ b/ci-scripts/createVM.sh @@ -87,7 +87,7 @@ function create_vm { echo "VM_CPU = $VM_CPU" echo "VM_DISK = $VM_DISK GBytes" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/docker/Dockerfile.cppcheck.xenial b/ci-scripts/docker/Dockerfile.cppcheck.xenial new file mode 100644 index 0000000000000000000000000000000000000000..0aecc62037e6a2bdfb849f02e2618dd04bd4eb7e --- /dev/null +++ b/ci-scripts/docker/Dockerfile.cppcheck.xenial @@ -0,0 +1,31 @@ +FROM ubuntu:xenial AS oai-cppcheck + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ + DEBIAN_FRONTEND=noninteractive apt-get install --yes \ + build-essential \ + vim \ + cppcheck + +WORKDIR /oai-ran +COPY . . + +WORKDIR /oai-ran/common/utils/T +RUN make + +WORKDIR /oai-ran +RUN mkdir -p cmake_targets/log && \ + cppcheck --enable=warning --force --xml --xml-version=2 \ + -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c \ + --suppressions-list=ci-scripts/cppcheck_suppressions.list \ + -I common/utils \ + -I openair3/NAS/COMMON/UTIL \ + -j`nproc` . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt + +RUN egrep -c 'severity="error' cmake_targets/log/cppcheck.xml + +RUN egrep -c 'severity="warning' cmake_targets/log/cppcheck.xml + +RUN cat cmake_targets/log/cppcheck.xml diff --git a/ci-scripts/docker_log_split.py b/ci-scripts/docker_log_split.py new file mode 100644 index 0000000000000000000000000000000000000000..8c3c9e41dcac79f2b527fc980da803b7b33465fc --- /dev/null +++ b/ci-scripts/docker_log_split.py @@ -0,0 +1,92 @@ +#/* +# * 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 +#--------------------------------------------------------------------- + + +#----------------------------------------------------------- +# Import Libs +#----------------------------------------------------------- +import sys # arg +import re # reg +import os +import subprocess + + +class SplitReport(): + def __init__(self): + self.logfilename = '' + self.destinationFolder = '' + + def split(self): + self.destinationFolder = self.logfilename.replace(".log","") + if os.path.isfile(self.logfilename): + newImageLog = open(self.logfilename + '.new', 'w') + copyFlag = True + with open(self.logfilename, 'r') as imageLog: + for line in imageLog: + header = False + ret = re.search('====== Start of log for ([0-9\.A-Za-z\-\_]+) ======', line) + if ret is not None: + copyFlag = False + header = True + detailedLogFile = open(self.destinationFolder + '/' + ret.group(1), 'w') + if copyFlag: + newImageLog.write(line) + ret = re.search('====== End of log for ([0-9\.A-Za-z\-\_]+) ======', line) + if ret is not None: + copyFlag = True + detailedLogFile.close() + elif not copyFlag and not header: + detailedLogFile.write(line) + imageLog.close() + newImageLog.close() + os.rename(self.logfilename + '.new', self.logfilename) + else: + print('Cannot split unfound file') + +#-------------------------------------------------------------------------------------------------------- +# +# Start of main +# +#-------------------------------------------------------------------------------------------------------- + +argvs = sys.argv +argc = len(argvs) + +SP = SplitReport() + +while len(argvs) > 1: + myArgv = argvs.pop(1) + if re.match('^\-\-logfilename=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-logfilename=(.+)$', myArgv, re.IGNORECASE) + SP.logfilename = matchReg.group(1) + +SP.split() + +sys.exit(0) diff --git a/ci-scripts/html.py b/ci-scripts/html.py index b3ee00e7dc5253133431803ff7f9a2f3b8d647dd..a0ac6385730104e5b965fc772f81b18a7da56733 100644 --- a/ci-scripts/html.py +++ b/ci-scripts/html.py @@ -479,3 +479,88 @@ class HTMLManagement(): self.htmlFile.write(' </tr>\n') self.htmlFile.close() + def CreateHtmlTestRowCppCheckResults(self, CCR): + if (self.htmlFooterCreated or (not self.htmlHeaderCreated)): + return + self.htmlFile = open('test_results.html', 'a') + vId = 0 + for version in CCR.versions: + self.htmlFile.write(' <tr bgcolor = "#F0F0F0" >\n') + self.htmlFile.write(' <td colspan=' + str(5+self.htmlUEConnected) + '><b> Results for cppcheck v ' + version + ' </b></td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> NB ERRORS</b></td>\n') + if CCR.nbErrors[vId] == 0: + myColor = 'lightgreen' + elif CCR.nbErrors[vId] < 20: + myColor = 'orange' + else: + myColor = 'lightcoral' + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + ' bgcolor = "' + myColor + '"><b>' + str(CCR.nbErrors[vId]) + '</b></td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> NB WARNINGS</b></td>\n') + if CCR.nbWarnings[vId] == 0: + myColor = 'lightgreen' + elif CCR.nbWarnings[vId] < 20: + myColor = 'orange' + else: + myColor = 'lightcoral' + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + ' bgcolor = "' + myColor + '"><b>' + str(CCR.nbWarnings[vId]) + '</b></td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr bgcolor = "#F0F0F0" >\n') + self.htmlFile.write(' <td colspan=' + str(5+self.htmlUEConnected) + '> ----------------- </td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Memory leak</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbMemLeaks[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Possible null pointer deference</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbNullPtrs[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Uninitialized variable</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbUninitVars[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Undefined behaviour shifting</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbTooManyBitsShift[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Signed integer overflow</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbIntegerOverflow[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr bgcolor = "#F0F0F0" >\n') + self.htmlFile.write(' <td colspan=' + str(5+self.htmlUEConnected) + '> </td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Printf formatting issues</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbInvalidPrintf[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Modulo result is predetermined</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbModuloAlways[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Opposite Condition -> dead code</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbOppoInnerCondition[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + self.htmlFile.write(' <tr>\n') + self.htmlFile.write(' <td></td>\n') + self.htmlFile.write(' <td colspan=2 bgcolor = "lightcyan" ><b> Wrong Scanf Nb Args</b></td>\n') + self.htmlFile.write(' <td colspan=' + str(2+self.htmlUEConnected) + '>' + str(CCR.nbWrongScanfArg[vId]) + '</td>\n') + self.htmlFile.write(' </tr>\n') + vId += 1 + + self.htmlFile.close() diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 3094197c542f8bbf6a7ca90a91dff1dfe656d287..f13df9beb5bb4ea2942563c8a05ddd5fb7bf4c71 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -38,10 +38,11 @@ import helpreadme as HELP import constants as CONST -import cls_oaicitest #main class for OAI CI test framework -import cls_physim #class PhySim for physical simulators build and test -import cls_cots_ue #class CotsUe for Airplane mode control -import cls_containerize #class Containerize for all container-based operations on RAN/UE objects +import cls_oaicitest #main class for OAI CI test framework +import cls_physim #class PhySim for physical simulators build and test +import cls_cots_ue #class CotsUe for Airplane mode control +import cls_containerize #class Containerize for all container-based operations on RAN/UE objects +import cls_static_code_analysis #class for static code analysis import sshconnection @@ -378,6 +379,7 @@ EPC = epc.EPCManagement() RAN = ran.RANManagement() HTML = html.HTMLManagement() CONTAINERS = cls_containerize.Containerize() +SCA = cls_static_code_analysis.StaticCodeAnalysis() ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build @@ -388,7 +390,7 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b #----------------------------------------------------------- import args_parse -py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP) +py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA) @@ -741,6 +743,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re CONTAINERS.DeployObject(HTML, EPC) elif action == 'Undeploy_Object': CONTAINERS.UndeployObject(HTML, RAN) + elif action == 'Cppcheck_Analysis': + SCA.CppCheckAnalysis(HTML) else: sys.exit('Invalid class (action) from xml') if not RAN.prematureExit: diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 774d7f19c6a4f240ca36409aa2418a8b0005c57f..f1f79a24358f7bc4cc4bfda987ec90047e9d2fd3 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -239,6 +239,7 @@ class RANManagement(): while (count > 0) and buildOAIprocess: mySSH.command('ps aux | grep --color=never build_ | grep -v grep', '\$', 6) result = re.search('build_oai', mySSH.getBefore()) + print(result) if result is None: buildOAIprocess = False else: @@ -464,7 +465,7 @@ class RANManagement(): self.prematureExit = True return else: - mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Starting"', '\$', 4) + mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Starting|Started"', '\$', 4) if rruCheck: result = re.search('wait RUs', mySSH.getBefore()) else: @@ -693,8 +694,8 @@ class RANManagement(): NSA_RAPROC_PUSCH_check = 0 #dlsch and ulsch statistics (dictionary) dlsch_ulsch_stats = {} - #count "L1 thread not ready" msg - L1_thread_not_ready_cnt = 0 + #real time statistics (dictionary) + real_time_stats = {} #count "problem receiving samples" msg pb_receiving_samples_cnt = 0 @@ -856,16 +857,21 @@ class RANManagement(): #keys below are the markers we are loooking for, loop over this keys list #everytime these markers are found in the log file, the previous ones are overwritten in the dict #eventually we record and print only the last occurence - keys = {'dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'} + keys = {'UE ID','dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled', 'scheduling timing stats'} for k in keys: result = re.search(k, line) if result is not None: #remove 1- all useless char before relevant info (ulsch or dlsch) 2- trailing char dlsch_ulsch_stats[k]=re.sub(r'^.*\]\s+', r'' , line.rstrip()) - #count "L1 thread not ready" msg - result = re.search('\[PHY\]\s+L1_thread isn\'t ready', str(line)) - if result is not None: - L1_thread_not_ready_cnt += 1 + #real time statistics + #same method as above + keys = {'feprx','feptx_prec','feptx_ofdm','feptx_total','L1 Tx processing','DLSCH encoding','L1 Rx processing','PUSCH inner-receiver','PUSCH decoding'} + for k in keys: + result = re.search(k, line) + if result is not None: + #remove 1- all useless char before relevant info 2- trailing char + tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex + real_time_stats[k]=tmp.group(1) #count "problem receiving samples" msg result = re.search('\[PHY\]\s+problem receiving samples', str(line)) if result is not None: @@ -896,15 +902,10 @@ class RANManagement(): statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : PASS ' htmlMsg = statMsg+'\n' else: - statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL ' + statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL or not relevant' htmlMsg = statMsg+'\n' logging.debug(statMsg) htmleNBFailureMsg += htmlMsg - #L1 thread not ready log - statMsg = '[PHY] L1 thread is not ready msg count = '+str(L1_thread_not_ready_cnt) - htmlMsg = statMsg+'\n' - logging.debug(statMsg) - htmleNBFailureMsg += htmlMsg #problem receiving samples log statMsg = '[PHY] problem receiving samples msg count = '+str(pb_receiving_samples_cnt) htmlMsg = statMsg+'\n' @@ -919,6 +920,18 @@ class RANManagement(): logging.debug(dlsch_ulsch_stats[key]) htmleNBFailureMsg += statMsg + #real time statistics statistics + if len(real_time_stats)!=0: #check if dictionary is not empty + statMsg='' + for key in real_time_stats: #for each dictionary key + statMsg += real_time_stats[key] + '\n' + logging.debug(real_time_stats[key]) + htmleNBFailureMsg += statMsg + else: + statMsg = 'No real time stats found in the log file\n' + logging.debug('No real time stats found in the log file') + htmleNBFailureMsg += statMsg + if uciStatMsgCount > 0: statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') diff --git a/ci-scripts/ran_dashboard.py b/ci-scripts/ran_dashboard.py new file mode 100644 index 0000000000000000000000000000000000000000..601cda1722ff167b1058642743ce846a5f2daaa3 --- /dev/null +++ b/ci-scripts/ran_dashboard.py @@ -0,0 +1,275 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# Merge Requests Dashboard for RAN on googleSheet +# +# Required Python Version +# Python 3.x +# +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- + +#import google spreadsheet API +import gspread +from oauth2client.service_account import ServiceAccountCredentials + + +import subprocess +import shlex #lexical analysis +import json #json structures +import datetime #now() and date formating +from datetime import datetime + +#----------------------------------------------------------- +# Class Declaration +#----------------------------------------------------------- + +class gDashboard: + def __init__(self, creds_file, spreadsheet, worksheet): #"creds.json", 'OAI RAN Dashboard', 'MR Status' + self.scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"] + self.creds = ServiceAccountCredentials.from_json_keyfile_name(creds_file, self.scope) + self.client = gspread.authorize(self.creds) + #spreadsheet + self.ss = self.client.open(spreadsheet) + #worksheet + self.sheet = self.ss.worksheet(worksheet) + self.ss.del_worksheet(self.sheet) #start by deleting the old sheet + self.sheet = self.ss.add_worksheet(title=worksheet, rows="100", cols="20") #create a new one + + self.d = {} #data dictionary + + + def fetchData(self,cmd): + #cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ + process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) + output = process.stdout.readline() + tmp=output.decode("utf-8") + self.d = json.loads(tmp) + + + def gBuild(self, destinationSheetName): + + #line 1 : update date/time, format dd/mm/YY H:M:S + now = datetime.now() + dt_string = "Update : " + now.strftime("%d/%m/%Y %H:%M") + row =[dt_string] + self.sheet.insert_row(row, index=1, value_input_option='RAW') + + #line 2 empty + #line 3 is for the column names + i=3 + row =["MR","Created_at","Author","Title","Assignee", "Reviewer", "CAN START","IN PROGRESS","COMPLETED","OK MERGE","Merge conflicts"] + self.sheet.insert_row(row, index=i, value_input_option='RAW') + + #line 4 onward, MR data lines + for x in range(len(self.d)): + i=i+1 + date_time_str = self.d[x]['created_at'] + date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ') + + milestone1=milestone2=milestone3=milestone4="" + if self.d[x]['milestone']!=None: + if self.d[x]['milestone']['title']=="REVIEW_CAN_START": + milestone1="X" + elif self.d[x]['milestone']['title']=="REVIEW_IN_PROGRESS": + milestone2="X" + elif self.d[x]['milestone']['title']=="REVIEW_COMPLETED_AND_APPROVED": + milestone3="X" + elif self.d[x]['milestone']['title']=="OK_TO_BE_MERGED": + milestone4="X" + else: + pass + else: + pass + + #check if empty or not + if self.d[x]['assignee']!=None: + assignee = str(self.d[x]['assignee']['name']) + else: + assignee = "" + + #check if empty or not + if len(self.d[x]['reviewers'])!=0: + reviewer = str(self.d[x]['reviewers'][0]['name']) + else: + reviewer = "" + + if self.d[x]['has_conflicts']==True: + conflicts = "YES" + else: + conflicts = "" + + #build final row to be inserted, the first column is left empty for now, will be filled afterward with hyperlinks to gitlab MR + row =["", str(date_time_obj.date()),str(self.d[x]['author']['name']),str(self.d[x]['title']),\ + assignee, reviewer,\ + milestone1,milestone2,milestone3,milestone4,conflicts] + + #insert the row to worksheet + self.sheet.insert_row(row, index=i, value_input_option='RAW') + + + #add MR hyperlinks in a list of requests to be sent as one update batch; this to save API calls (quotas) + i=3 + requests=[] + for x in range(len(self.d)): + rowIndex=i + colIndex=0 + hyperlink= '\"'+"https://gitlab.eurecom.fr/oai/openairinterface5g/-/merge_requests/"+ str(self.d[x]['iid']) +'\"' + text= '\"'+str(self.d[x]['iid'])+'"' + requests.append(self.addHyperlink(hyperlink, text, destinationSheetName, rowIndex, colIndex)) + i=i+1 + body = {"requests": requests} + self.ss.batch_update(body) + + + + def addHyperlink(self, hyperlink, text, destinationSheetName, rowIndex, colIndex): + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + request =\ + { + "updateCells": { + "rows": [ + { + "values": [ + { + "userEnteredValue": { + "formulaValue":"=HYPERLINK({},{})".format(hyperlink, text) + } + } + ] + } + ], + "fields": "userEnteredValue", + "start": { + "sheetId": sheetId, + "rowIndex": rowIndex, + "columnIndex": colIndex + } + } + } + return request + + + + def gFormat(self,sourceSheetName,destinationSheetName): # "Formating" , "MR Status" + #the requests are appended in a list of requests to be sent as one update batch; this to save API calls (quotas) + #copy formating template + sourceSheetId = self.ss.worksheet(sourceSheetName)._properties['sheetId'] + destinationSheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + requests=[] + requests.append( + { + "copyPaste": { + "source": { + "sheetId": sourceSheetId, + "startRowIndex": 0, + "endRowIndex": 40, + "startColumnIndex": 0, + "endColumnIndex": 12 + }, + "destination": { + "sheetId": destinationSheetId, + "startRowIndex": 0, + "endRowIndex": 40, + "startColumnIndex": 0, + "endColumnIndex": 12 + }, + "pasteType": "PASTE_FORMAT" + } + } + ) + + + #resize columns fit to data, except col 0 + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + requests.append( + { + 'autoResizeDimensions': { + 'dimensions': { + 'sheetId': sheetId, + 'dimension': 'COLUMNS', + 'startIndex': 1, + 'endIndex': 12 + } + } + } + ) + + + #resize col 0 + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + requests.append( + { + "updateDimensionProperties": { + "range": { + "sheetId": sheetId, + "dimension": "COLUMNS", + "startIndex": 0, + "endIndex": 1 + }, + "properties": { + "pixelSize": 100 + }, + "fields": "pixelSize" + } + } + ) + + + #resize milestones to be cleaner + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + requests.append( + { + "updateDimensionProperties": { + "range": { + "sheetId": sheetId, + "dimension": "COLUMNS", + "startIndex": 6, + "endIndex": 10 + }, + "properties": { + "pixelSize": 135 + }, + "fields": "pixelSize" + } + } + ) + + body = {"requests": requests} + self.ss.batch_update(body) + + + +def main(): + my_gDashboard=gDashboard("/home/oaicicd/remi/creds.json", 'OAI RAN Dashboard', 'MR Status') + cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ + my_gDashboard.fetchData(cmd) + my_gDashboard.gBuild("MR Status") + my_gDashboard.gFormat("Formating" , "MR Status") + + + +if __name__ == "__main__": + # execute only if run as a script + main() diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 19a486303f10e5355d49c8b1e425b9c42314e6dc..b46ade903f2d36ce49e5d39e5b813863f710af70 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -568,17 +568,20 @@ function report_build { echo " <h2>Ubuntu 16.04 LTS -- Summary</h2>" >> ./build_results.html - sca_summary_table_header ./archives/cppcheck/cppcheck.xml "OAI Static Code Analysis with CPPCHECK" - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder - sca_summary_table_footer ./archives/cppcheck/cppcheck.xml + if [ -f ./archives/cppcheck/cppcheck.xml ] + then + sca_summary_table_header ./archives/cppcheck/cppcheck.xml "OAI Static Code Analysis with CPPCHECK" + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder + sca_summary_table_footer ./archives/cppcheck/cppcheck.xml + fi # summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_usrp # summary_table_row "LTE SoftModem - Release 15" ./archives/enb_usrp/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_usrp_row1.html diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index 415ded57a415c667c4f84c0d77bf8b67568380e9..c4fa817b06173c81eab7284b1f534f548701aec3 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -749,6 +749,77 @@ function report_test { echo " </tr>" >> ./test_simulator_results.html EPC_CONFIGS=("noS1") + TRANS_MODES=("tdd") + FR_MODE=("FR2") + BW_CASES=(32) + for CN_CONFIG in ${EPC_CONFIGS[@]} + do + for TMODE in ${TRANS_MODES[@]} + do + for BW in ${BW_CASES[@]} + do + echo " <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html + if [[ $CN_CONFIG =~ .*wS1.* ]] + then + echo " <td align = \"center\" colspan = 4 >Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}</td>" >> ./test_simulator_results.html + else + echo " <td align = \"center\" colspan = 4 >Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}</td>" >> ./test_simulator_results.html + fi + echo " </tr>" >> ./test_simulator_results.html + + + #FR2 RA test (--do-ra option) + + #build log files names tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log + + RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_fr2_test.log + RA_UE_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ue_ra_fr2_test.log + if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ] + then + #get rid of full path + NAME_ENB=`echo $RA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` + NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` + echo " <tr>" >> ./test_simulator_results.html + echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html + echo " <td>Check if FR2 RA proc succeeded</td>" >> ./test_simulator_results.html + + #gNB RA check + GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG` + #UE RA check + UE_RA_PROC_OK=`egrep -c "\[RAPROC\] RA procedure succeeded" $RA_UE_LOG` + + + if [ $GNB_RECEIVED -gt 0 ] && [ $UE_RA_PROC_OK -gt 0 ] + then + echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html + else + echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html + fi + + echo " <td><pre>" >> ./test_simulator_results.html + if [ $GNB_RECEIVED -gt 0 ] + then + echo "<font color = \"blue\">- gNB --> RA received</font>" >> ./test_simulator_results.html + else + echo "<font color = \"red\"><b>- gNB RA NOT RECEIVED</b></font>" >> ./test_simulator_results.html + fi + if [ $UE_RA_PROC_OK -gt 0 ] + then + echo "<font color = \"blue\">- NR UE --> RA procedure succeded</font>" >> ./test_simulator_results.html + else + echo "<font color = \"red\"><b>- NR UE RA procedure failed</b></font>" >> ./test_simulator_results.html + fi + echo " </pre></td>" >> ./test_simulator_results.html + echo " </tr>" >> ./test_simulator_results.html + fi + + done + done + done + + + EPC_CONFIGS=("noS1") + FR_MODE=("FR1") TRANS_MODES=("fdd" "tdd") BW_CASES=(106) for CN_CONFIG in ${EPC_CONFIGS[@]} @@ -760,13 +831,14 @@ function report_test { echo " <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html if [[ $CN_CONFIG =~ .*wS1.* ]] then - echo " <td align = \"center\" colspan = 4 >Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB </td>" >> ./test_simulator_results.html + echo " <td align = \"center\" colspan = 4 >Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}</td>" >> ./test_simulator_results.html else - echo " <td align = \"center\" colspan = 4 >Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB </td>" >> ./test_simulator_results.html + echo " <td align = \"center\" colspan = 4 >Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}</td>" >> ./test_simulator_results.html fi echo " </tr>" >> ./test_simulator_results.html - #RA test (--do-ra option) + + #FR1 RA test (--do-ra option) #build log files names RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_test.log @@ -778,7 +850,7 @@ function report_test { NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` echo " <tr>" >> ./test_simulator_results.html echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html - echo " <td>Check if RA proc succeeded</td>" >> ./test_simulator_results.html + echo " <td>Check if FR1 RA proc succeeded</td>" >> ./test_simulator_results.html #gNB RA check GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG` diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index f81868504945af2c1b5d4eeb8fb69c90da1aa800..6725d2f62bb94a60cb99cc6e9b3a4da7833b89da 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -2189,6 +2189,98 @@ function run_test_on_vm { if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] then + echo "############################################################" + echo "RA TEST FR2" + echo "############################################################" + #RA FR2 test, attention : has a different config file from the rest of the test + CN_CONFIG="noS1" + CONF_FILE=gnb.band261.tm1.32PRB.usrpn300.conf + S1_NOS1_CFG=0 + PRB=32 + FREQUENCY=28000 #28GHz + + if [ ! -d $ARCHIVES_LOC ] + then + mkdir --parents $ARCHIVES_LOC + fi + + local try_cnt=0 + NR_STATUS=0 + + ######### start of RA TEST loop + while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI + do + + SYNC_STATUS=0 + RA_FR2_STATUS=0 + rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_fr2_test.log + + echo "############################################################" + echo "${CN_CONFIG} : Starting the gNB" + echo "############################################################" + CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log + #last argument = 1 is to enable --do-ra for RA test + start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1 + + echo "############################################################" + echo "${CN_CONFIG} : Starting the NR-UE" + echo "############################################################" + CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_fr2_test.log + #last argument = 1 is to enable --do-ra for RA test + start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1 + if [ $NR_UE_SYNC -eq 0 ] + then + 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 + fi + + echo "############################################################" + echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators" + echo "############################################################" + sleep 20 + 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 + + #check RA markers in gNB and NR UE log files + echo "############################################################" + echo "${CN_CONFIG} : Checking FR2 RA on gNB / NR-UE" + echo "############################################################" + + # Proper check to be done when RA test is working! + check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE + if [ $RA_FR2_STATUS -ne 0 ] + then + echo "RA FR2 test NOT OK" + echo "try_cnt = " $try_cnt + try_cnt=$((try_cnt+1)) + else + try_cnt=$((try_cnt+10)) + fi + done + ########### end RA FR2 test + + sleep 30 + + + echo "############################################################" + echo "RA TEST FR1" + echo "############################################################" + ######### redefine config for the rest of the test + + CN_CONFIG="noS1" + CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf + S1_NOS1_CFG=0 + PRB=106 + FREQUENCY=3510 + if [ ! -d $ARCHIVES_LOC ] then mkdir --parents $ARCHIVES_LOC @@ -2258,14 +2350,14 @@ function run_test_on_vm { #check RA markers in gNB and NR UE log files echo "############################################################" - echo "${CN_CONFIG} : Checking RA on gNB / NR-UE" + echo "${CN_CONFIG} : Checking FR1 RA on gNB / NR-UE" echo "############################################################" # Proper check to be done when RA test is working! check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE if [ $RA_STATUS -ne 0 ] then - echo "RA test NOT OK" + echo "RA FR1 test NOT OK" echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) else @@ -2401,6 +2493,7 @@ function run_test_on_vm { echo "Checking run status" echo "############################################################" + if [ $RA_FR2_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $RA_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $SYNC_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $PING_STATUS -ne 0 ]; then NR_STATUS=-1; fi diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh index ff2129a187d4a0216d75c73a05889418650e9f44..f7e300edf452bbc93203168073e30d8b01ab1799 100755 --- a/ci-scripts/waitBuildOnVM.sh +++ b/ci-scripts/waitBuildOnVM.sh @@ -47,7 +47,7 @@ function wait_on_vm_build { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return @@ -73,6 +73,9 @@ function wait_on_vm_build { echo "############################################################" echo "Waiting build process to end on VM ($VM_NAME)" echo "############################################################" + # Since the last VM was cppcheck and is removed + # we are going too fast in wait and the build_oai is not yet started + sleep 120 if [[ "$VM_NAME" == *"-cppcheck"* ]] then @@ -90,7 +93,7 @@ function wait_on_vm_build { } function check_on_vm_build { - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 0e00a2e7d413da5784e7c88210335bfa335406ec..de16116124c8f3999e58a8b47f1e7a7bd0419ccd 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -37,3 +37,4 @@ - Build_Image - Deploy_Object - Undeploy_Object + - Cppcheck_Analysis diff --git a/ci-scripts/xml_files/benetel_multi_node_build.xml b/ci-scripts/xml_files/benetel_multi_node_build.xml new file mode 100644 index 0000000000000000000000000000000000000000..5ac28951b4ad308f078402f0cebd117ba01e4112 --- /dev/null +++ b/ci-scripts/xml_files/benetel_multi_node_build.xml @@ -0,0 +1,54 @@ +<!-- + + 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 + +--> +<testCaseList> + <htmlTabRef>build-tab</htmlTabRef> + <htmlTabName>Build</htmlTabName> + <htmlTabIcon>wrench</htmlTabIcon> + <TestCaseRequestedList> + 000001 000002 + </TestCaseRequestedList> + <TestCaseExclusionList></TestCaseExclusionList> + + <testCase id="000001"> + <class>Build_eNB</class> + <desc>Build eNB</desc> + <Build_eNB_args>--eNB -t benetel4g -w None</Build_eNB_args> + <forced_workspace_cleanup>True</forced_workspace_cleanup> + <eNB_instance>0</eNB_instance> + <eNB_serverId>0</eNB_serverId> + </testCase> + + + <testCase id="000002"> + <class>Build_eNB</class> + <desc>Build gNB</desc> + <Build_eNB_args>--gNB -t benetel5g -w None</Build_eNB_args> + <forced_workspace_cleanup>True</forced_workspace_cleanup> + <eNB_instance>1</eNB_instance> + <eNB_serverId>1</eNB_serverId> + </testCase> + + + + +</testCaseList> diff --git a/ci-scripts/xml_files/benetel_nsa_base.xml b/ci-scripts/xml_files/benetel_nsa_base.xml new file mode 100644 index 0000000000000000000000000000000000000000..0aed28dffa8e92de6377fdf51bdeac58215f9529 --- /dev/null +++ b/ci-scripts/xml_files/benetel_nsa_base.xml @@ -0,0 +1,162 @@ +<!-- + + 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 + +--> +<testCaseList> + <htmlTabRef>TEST-FR1-TM1</htmlTabRef> + <htmlTabName>FR1</htmlTabName> + <htmlTabIcon>tasks</htmlTabIcon> + <TestCaseRequestedList> + 010000 + 030000 + 040000 + 010001 + 000001 + 050000 + 050001 + 000001 + 060000 + 060001 + 000001 + 070000 + 070001 + 010002 + 000001 + 080001 + 080000 + 010003 + </TestCaseRequestedList> + <TestCaseExclusionList></TestCaseExclusionList> + + <testCase id="010000"> + <class>Initialize_UE</class> + <desc>Initialize UE</desc> + </testCase> + + <testCase id="010003"> + <class>Terminate_UE</class> + <desc>Terminate UE</desc> + </testCase> + + <testCase id="010001"> + <class>Attach_UE</class> + <desc>Attach UE</desc> + </testCase> + + <testCase id="010002"> + <class>Detach_UE</class> + <desc>Detach UE</desc> + </testCase> + + + <testCase id="030000"> + <class>Initialize_eNB</class> + <desc>Initialize eNB</desc> + <Initialize_eNB_args>-O ci-scripts/conf_files/benetel-4g.conf</Initialize_eNB_args> + <eNB_instance>0</eNB_instance> + <eNB_serverId>0</eNB_serverId> + <air_interface>lte</air_interface> + </testCase> + + + <testCase id="040000"> + <class>Initialize_eNB</class> + <desc>Initialize gNB</desc> + <Initialize_eNB_args>-O ci-scripts/conf_files/benetel-5g.conf</Initialize_eNB_args> + <eNB_instance>1</eNB_instance> + <eNB_serverId>1</eNB_serverId> + <air_interface>nr</air_interface> + </testCase> + + <testCase id="000001"> + <class>IdleSleep</class> + <desc>Sleep</desc> + <idle_sleep_time_in_sec>20</idle_sleep_time_in_sec> + </testCase> + + <testCase id="050000"> + <class>Ping</class> + <desc>Ping: 20pings in 20sec</desc> + <ping_args>-c 20</ping_args> + <ping_packetloss_threshold>50</ping_packetloss_threshold> + </testCase> + + <testCase id="050001"> + <class>Ping</class> + <desc>Ping: 100pings in 20sec</desc> + <ping_args>-c 100 -i 0.2</ping_args> + <ping_packetloss_threshold>50</ping_packetloss_threshold> + </testCase> + + + <testCase id="060000"> + <class>Iperf</class> + <desc>iperf (DL/2.5Mbps/UDP)(60 sec)(single-ue profile)</desc> + <iperf_args>-u -b 2.5M -t 60 -i 1</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + <testCase id="060001"> + <class>Iperf</class> + <desc>iperf (UL/1.5Mbps/UDP)(60 sec)(single-ue profile)</desc> + <iperf_args>-u -b 1.5M -t 60 -i 1 -R</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + + <testCase id="070000"> + <class>Iperf</class> + <desc>iperf (DL/20Mbps/UDP)(20 sec)(single-ue profile)</desc> + <iperf_args>-u -b 20M -t 20 -i 1</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + <testCase id="070001"> + <class>Iperf</class> + <desc>iperf (UL/3Mbps/UDP)(20 sec)(single-ue profile)</desc> + <iperf_args>-u -b 3M -t 20 -i 1 -R</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + + + <testCase id="080000"> + <class>Terminate_eNB</class> + <desc>Terminate eNB</desc> + <eNB_instance>0</eNB_instance> + <eNB_serverId>0</eNB_serverId> + <air_interface>lte</air_interface> + </testCase> + + <testCase id="080001"> + <class>Terminate_eNB</class> + <desc>Terminate gNB</desc> + <eNB_instance>1</eNB_instance> + <eNB_serverId>1</eNB_serverId> + <air_interface>nr</air_interface> + </testCase> + +</testCaseList> + diff --git a/ci-scripts/xml_files/fr1_image_build.xml b/ci-scripts/xml_files/container_image_build.xml similarity index 93% rename from ci-scripts/xml_files/fr1_image_build.xml rename to ci-scripts/xml_files/container_image_build.xml index 9dd386b646cd6e1975882e62f49852700efd5cf8..430729c49c79b8b09cca0cf109c1495ac44c12aa 100644 --- a/ci-scripts/xml_files/fr1_image_build.xml +++ b/ci-scripts/xml_files/container_image_build.xml @@ -22,7 +22,7 @@ --> <testCaseList> <htmlTabRef>build-tab</htmlTabRef> - <htmlTabName>Build</htmlTabName> + <htmlTabName>Build Container Images</htmlTabName> <htmlTabIcon>wrench</htmlTabIcon> <TestCaseRequestedList> 000001 @@ -31,7 +31,7 @@ <testCase id="000001"> <class>Build_Image</class> - <desc>Build eNB Image</desc> + <desc>Build all Images</desc> <kind>all</kind> <eNB_instance>0</eNB_instance> <eNB_serverId>0</eNB_serverId> diff --git a/ci-scripts/xml_files/cppcheck.xml b/ci-scripts/xml_files/cppcheck.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd90d88f7e289cba5e35ac56df3c6f409bd08960 --- /dev/null +++ b/ci-scripts/xml_files/cppcheck.xml @@ -0,0 +1,37 @@ +<!-- + + 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 + +--> +<testCaseList> + <htmlTabRef>build-tab</htmlTabRef> + <htmlTabName>CPPCHECK Analysis</htmlTabName> + <htmlTabIcon>wrench</htmlTabIcon> + <TestCaseRequestedList> + 000001 + </TestCaseRequestedList> + <TestCaseExclusionList></TestCaseExclusionList> + + <testCase id="000001"> + <class>Cppcheck_Analysis</class> + <desc>Static Code Analysis with cppcheck</desc> + </testCase> + +</testCaseList> diff --git a/ci-scripts/xml_files/fr1_multi_node_build.xml b/ci-scripts/xml_files/fr1_multi_node_build.xml index 7b4eacef3a3d091e7397bfc89a7f8422c459998c..57c4685341c9cda60734c02cdbcbd2435f5e5c84 100644 --- a/ci-scripts/xml_files/fr1_multi_node_build.xml +++ b/ci-scripts/xml_files/fr1_multi_node_build.xml @@ -37,6 +37,7 @@ <eNB_instance>0</eNB_instance> <eNB_serverId>0</eNB_serverId> <backgroundBuild>True</backgroundBuild> + <forced_workspace_cleanup>True</forced_workspace_cleanup> </testCase> <testCase id="000004"> @@ -53,6 +54,7 @@ <eNB_instance>1</eNB_instance> <eNB_serverId>1</eNB_serverId> <backgroundBuild>True</backgroundBuild> + <forced_workspace_cleanup>True</forced_workspace_cleanup> </testCase> <testCase id="000003"> diff --git a/ci-scripts/xml_files/fr1_nsa_base_ref.xml b/ci-scripts/xml_files/fr1_nsa_base_ref.xml new file mode 100644 index 0000000000000000000000000000000000000000..fd47db10b2b1ecdc8fb084c4656451c35e54ca91 --- /dev/null +++ b/ci-scripts/xml_files/fr1_nsa_base_ref.xml @@ -0,0 +1,161 @@ +<!-- + + 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 + +--> +<testCaseList> + <htmlTabRef>TEST-NSA-FR1-TM1</htmlTabRef> + <htmlTabName>NSA FULL</htmlTabName> + <htmlTabIcon>tasks</htmlTabIcon> + <TestCaseRequestedList> + 010000 + 030000 + 040000 + 010001 + 000001 + 050000 + 050001 + 000001 + 060000 + 060001 + 000001 + 070000 + 010002 + 000001 + 080001 + 080000 + 010003 + </TestCaseRequestedList> + <TestCaseExclusionList></TestCaseExclusionList> + + <testCase id="010000"> + <class>Initialize_UE</class> + <desc>Initialize UE</desc> + </testCase> + + <testCase id="010003"> + <class>Terminate_UE</class> + <desc>Terminate UE</desc> + </testCase> + + <testCase id="010001"> + <class>Attach_UE</class> + <desc>Attach UE</desc> + </testCase> + + <testCase id="010002"> + <class>Detach_UE</class> + <desc>Detach UE</desc> + </testCase> + + + <testCase id="030000"> + <class>Initialize_eNB</class> + <desc>Initialize eNB</desc> + <Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf</Initialize_eNB_args> + <eNB_instance>0</eNB_instance> + <eNB_serverId>0</eNB_serverId> + <air_interface>lte</air_interface> + </testCase> + + + <testCase id="040000"> + <class>Initialize_eNB</class> + <desc>Initialize gNB</desc> + <Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E</Initialize_eNB_args> + <eNB_instance>1</eNB_instance> + <eNB_serverId>1</eNB_serverId> + <air_interface>nr</air_interface> + </testCase> + + <testCase id="000001"> + <class>IdleSleep</class> + <desc>Sleep</desc> + <idle_sleep_time_in_sec>20</idle_sleep_time_in_sec> + </testCase> + + <testCase id="050000"> + <class>Ping</class> + <desc>Ping: 20pings in 20sec</desc> + <ping_args>-c 20</ping_args> + <ping_packetloss_threshold>50</ping_packetloss_threshold> + </testCase> + + <testCase id="050001"> + <class>Ping</class> + <desc>Ping: 100pings in 20sec</desc> + <ping_args>-c 100 -i 0.2</ping_args> + <ping_packetloss_threshold>50</ping_packetloss_threshold> + </testCase> + + + <testCase id="060000"> + <class>Iperf</class> + <desc>iperf (DL/3Mbps/UDP)(20 sec)(single-ue profile)</desc> + <iperf_args>-u -b 3M -t 20 -i 1</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + <testCase id="060001"> + <class>Iperf</class> + <desc>iperf (UL/1Mbps/UDP)(20 sec)(single-ue profile)</desc> + <iperf_args>-u -b 1M -t 20 -i 1 -R</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + + <testCase id="070000"> + <class>Iperf</class> + <desc>iperf (DL/20Mbps/UDP)(20 sec)(single-ue profile)</desc> + <iperf_args>-u -b 20M -t 20 -i 1</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + <testCase id="070001"> + <class>Iperf</class> + <desc>iperf (UL/3Mbps/UDP)(20 sec)(single-ue profile)</desc> + <iperf_args>-u -b 3M -t 20 -i 1 -R</iperf_args> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> + <iperf_profile>single-ue</iperf_profile> + </testCase> + + + + <testCase id="080000"> + <class>Terminate_eNB</class> + <desc>Terminate eNB</desc> + <eNB_instance>0</eNB_instance> + <eNB_serverId>0</eNB_serverId> + <air_interface>lte</air_interface> + </testCase> + + <testCase id="080001"> + <class>Terminate_eNB</class> + <desc>Terminate gNB</desc> + <eNB_instance>1</eNB_instance> + <eNB_serverId>1</eNB_serverId> + <air_interface>nr</air_interface> + </testCase> + +</testCaseList> + diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml new file mode 100644 index 0000000000000000000000000000000000000000..00610d430eb223e17516d0e4f643537bd8a5570d --- /dev/null +++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml @@ -0,0 +1,53 @@ +<!-- + + 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 + +--> +<testCaseList> + <htmlTabRef>gNB-PHY-Test</htmlTabRef> + <htmlTabName>Run-gNB-PHY-Test</htmlTabName> + <htmlTabIcon>tasks</htmlTabIcon> + <repeatCount>2</repeatCount> + <TestCaseRequestedList> +090101 000001 090109 + </TestCaseRequestedList> + <TestCaseExclusionList></TestCaseExclusionList> + + <testCase id="090101"> + <class>Initialize_eNB</class> + <desc>Initialize gNB USRP</desc> + <Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106</Initialize_eNB_args> + <air_interface>NR</air_interface> + </testCase> + + <testCase id="000001"> + <class>IdleSleep</class> + <desc>Sleep</desc> + <idle_sleep_time_in_sec>180</idle_sleep_time_in_sec> + </testCase> + + + <testCase id="090109"> + <class>Terminate_eNB</class> + <desc>Terminate gNB</desc> + <air_interface>NR</air_interface> + </testCase> + +</testCaseList> diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c16170f9326b395fed03db5a30840eb1e42fd554..b640df73b37a57ce286c0f9a576bf1255e254cad 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -45,6 +45,8 @@ include_directories(${CONFIG_INCLUDE_DIRS}) pkg_search_module(CRYPTO libcrypto REQUIRED) include_directories(${CRYPTO_INCLUDE_DIRS}) +#uhd 4.0 and iris installs by default in /usr/local +include_directories("/usr/local/include/") #use native cmake method as this package is not in pkg-config if (${RF_BOARD} STREQUAL "OAI_USRP") find_package(Boost REQUIRED) @@ -52,7 +54,7 @@ if (${RF_BOARD} STREQUAL "OAI_USRP") elseif (${RF_BOARD} STREQUAL "OAI_IRIS") include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") - include_directories("/usr/local/include/") + set(HW_SOURCE ${HW_SOURCE} ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) LINK_DIRECTORIES("/usr/local/lib") @@ -333,6 +335,11 @@ else (CUDA_FOUND) ) endif () +if (SANITIZE_ADDRESS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-common") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-common") +endif () + add_definitions("-DASN_DISABLE_OER_SUPPORT") ######################### @@ -405,6 +412,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") +add_boolean_option(NEW_GTPU False "NEW_GTP") set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) add_library(ITTI @@ -413,7 +421,6 @@ add_library(ITTI ) add_dependencies(ITTI rrc_flag) set(ITTI_LIB ITTI) - set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c) ################################################## @@ -787,12 +794,12 @@ add_dependencies(X2AP_ENB X2AP_LIB rrc_flag x2_flag) # F1AP ############## -add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15) +add_list1_option(F1AP_RELEASE R16 "F1AP ASN.1 grammar version" R16) set(F1AP_DIR ${OPENAIR2_DIR}/F1AP) -if (${F1AP_RELEASE} STREQUAL "R15") - make_version(F1AP_VERSION 15 2 1) - set (ASN1RELDIR R15.2.1) -endif(${F1AP_RELEASE} STREQUAL "R15") +if (${F1AP_RELEASE} STREQUAL "R16") + make_version(F1AP_VERSION 16 3 1) + set (ASN1RELDIR R16.3.1) +endif(${F1AP_RELEASE} STREQUAL "R16") add_definitions(-DF1AP_VERSION=${F1AP_VERSION}) set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) set(F1AP_ASN_FILES @@ -832,7 +839,7 @@ add_library(F1AP # Hardware dependant options ################################### -add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") +add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4") add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU") @@ -926,6 +933,9 @@ set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidd # Benetel 4G library ###################################################################### + +include_directories ("/usr/include/dpdk") + set(HWLIB_BENETEL_4G_SOURCE ${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/benetel.c ${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/shared_buffers.c @@ -987,7 +997,7 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE") add_boolean_option(ITTI_SIM False "enable itti simulator") - +add_boolean_option(RFSIM_NAS False "enable rfsim nas") ######################## # Include order ########################## @@ -1970,6 +1980,7 @@ set(NR_PDCP_SRC ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_sdu.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c + ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c ) @@ -1988,6 +1999,7 @@ set(L2_SRC ${RRC_DIR}/rrc_eNB_S1AP.c ${RRC_DIR}/rrc_eNB_M2AP.c ${RRC_DIR}/rrc_eNB_UE_context.c + ${NR_RRC_DIR}/rrc_gNB_UE_context.c ${RRC_DIR}/rrc_common.c ${RRC_DIR}/L2_interface.c ${RRC_DIR}/L2_interface_common.c @@ -2224,26 +2236,21 @@ add_library(CN_UTILS ) set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U) -set (GTPV1U_SRC + +add_library (GTPV1U_OCP + ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c ${RRC_DIR}/rrc_eNB_GTPV1U.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c - ${GTPV1U_DIR}/gtpv1u_teid_pool.c +${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp ) -add_library(GTPV1U ${GTPV1U_SRC}) -add_dependencies(GTPV1U rrc_flag) - -#add_library (GTPV1U_OCP -#${OPENAIR3_DIR}/ocp-gtp/gtp_itf.cpp -#) -#include_directories(${OPENAIR3_DIR}/ocp-gtp) +add_dependencies(GTPV1U_OCP rrc_flag) +include_directories(${OPENAIR3_DIR}/ocp-gtp) #NR case set (NR_GTPV1U_SRC ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c ${RRC_DIR}/rrc_eNB_GTPV1U.c + ${GTPV1U_DIR}/gtpv1u_eNB.c + ${GTPV1U_DIR}/gtpv1u_gNB.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c @@ -2253,6 +2260,12 @@ set (NR_GTPV1U_SRC add_library(NR_GTPV1U ${NR_GTPV1U_SRC}) add_dependencies(NR_GTPV1U rrc_flag) +if (${NEW_GTPU}) +set(GTPV1U GTPV1U_OCP) +else() +set(GTPV1U NR_GTPV1U) +endif() + set (MME_APP_SRC ${OPENAIR3_DIR}/MME_APP/mme_app.c ${OPENAIR3_DIR}/MME_APP/mme_config.c @@ -2531,7 +2544,7 @@ if(NAS_UE) endif() -if(ITTI_SIM) +#if(ITTI_SIM OR RFSIM_NAS) set(libnas_ue_api_OBJS ${NAS_SRC}UE/API/USER/at_command.c ${NAS_SRC}UE/API/USER/at_error.c @@ -2657,7 +2670,7 @@ if(ITTI_SIM) include_directories(${NAS_SRC}UE/EMM/SAP) include_directories(${NAS_SRC}UE/ESM) include_directories(${NAS_SRC}UE/ESM/SAP) -endif() +#endif() # nbiot add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16") @@ -2791,6 +2804,7 @@ add_library(rfsimulator MODULE ${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c ${OPENAIR_TARGETS}/ARCH/rfsimulator/apply_channelmod.c ${OPENAIR_TARGETS}/ARCH/rfsimulator/new_channel_sim.c + ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c ) target_link_libraries(rfsimulator SIMU_COMMON ${ATLAS_LIBRARIES}) @@ -2805,6 +2819,7 @@ include_directories("${OPENAIR_DIR}/common/utils/T") if (${T_TRACER}) set(T_SOURCE + ${OPENAIR_DIR}/common/utils/T/T_IDs.h ${OPENAIR_DIR}/common/utils/T/T.c ${OPENAIR_DIR}/common/utils/T/local_tracer.c) set(T_LIB "rt") @@ -2814,8 +2829,6 @@ 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 -j2 COMMAND make check_vcd WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt @@ -2823,6 +2836,10 @@ add_custom_command ( ${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.h ) +execute_process ( + COMMAND make check_vcd + WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T +) #This rule is specifically needed to generate T files #before anything else in a project that uses the T. #See below, there are some 'add_dependencies' showing that. @@ -2892,7 +2909,6 @@ add_executable(lte-softmodem ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2902,7 +2918,8 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (lte-softmodem -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 + + 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 MISC_NFAPI_LTE_LIB LFDS7 ${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) @@ -2933,7 +2950,6 @@ add_executable(ocp-enb ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2943,7 +2959,8 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l 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 + + 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 MISC_NFAPI_LTE_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) @@ -3013,7 +3030,8 @@ endif() target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB NR_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 + + ${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_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) @@ -3041,21 +3059,20 @@ add_executable(nr-softmodem ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c ) target_link_libraries (nr-softmodem -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} @@ -3085,7 +3102,6 @@ add_executable(ocp-gnb ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} ${XFORMS_SOURCE_NR} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3095,7 +3111,7 @@ add_executable(ocp-gnb target_link_libraries (ocp-gnb -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON @@ -3142,9 +3158,7 @@ target_link_libraries (nr-uesoftmodem RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} - NFAPI_USER_LIB S1AP_LIB S1AP_ENB - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB + ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE -Wl,--end-group z dl) target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES}) @@ -3174,6 +3188,17 @@ target_link_libraries (dlsim_tm4 pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ) +add_executable(rftest + ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_test.c + ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_scope.c + ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR_DIR}/executables/softmodem-common.c + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} +) +target_link_libraries(rftest minimal_lib PHY_NR_COMMON pthread dl m forms ${T_LIB} ) + add_executable(polartest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c ${OPENAIR_DIR}/common/utils/backtrace.c @@ -3320,7 +3345,7 @@ add_executable(nr_dlsim ) target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl ) target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3339,7 +3364,7 @@ add_executable(nr_prachsim ${SHLIB_LOADER_SOURCES}) target_link_libraries(nr_prachsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl) + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl) add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c @@ -3372,7 +3397,7 @@ add_executable(nr_ulsim ) target_link_libraries(nr_ulsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl ) target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3406,7 +3431,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) add_executable(test_epc_play_scenario @@ -3425,7 +3450,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) @@ -3471,7 +3496,7 @@ 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_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB - CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + CN_UTILS ${GTPV1U} 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) @@ -3562,14 +3587,12 @@ add_executable(nr-ittisim ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3578,7 +3601,7 @@ add_executable(nr-ittisim target_link_libraries (nr-ittisim -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 089d0503fdf02a7b0726223adec38c78e343a7c5..b0511f63ccd2bacdecd9dfffa19dcb19bb42f85a 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1294,7 +1294,8 @@ (Test10: SC-FDMA, 75 PRBs), (Test11: SC-FDMA, 216 PRBs), (Test12: SC-FDMA, 273 PRBs), - (Test13: SC-FDMA, 3 DMRS)</desc> + (Test13: SC-FDMA, 3 DMRS), + (Test14: MCS 16 50 PRBs 2 RX_Antenna)</desc> <pre_compile_prog></pre_compile_prog> <compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog> <compile_prog_args> --phy_simulators -c </compile_prog_args> @@ -1313,9 +1314,10 @@ -n100 -s2 -Z -r75 -n100 -s2 -Z -r216 -R217 -n100 -s2 -Z -r270 -R273 - -n100 -s2 -Z -U 2 0 2</main_exec_args> + -n100 -s2 -Z -U 2 0 2 + -n100 -m16 -s10 -z2</main_exec_args> - <tags>nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13</tags> + <tags>nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14</tags> <search_expr_true>PUSCH test OK</search_expr_true> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <nruns>3</nruns> @@ -1328,7 +1330,8 @@ (Test3: 30kHz SCS, 273 PRBs, Prach format A2), (Test4: 30kHz SCS, 106 PRBs, Prach format 0), (Test5: 120kHz SCS, 32 PRBs, Prach format A2), - (Test6: 120kHz SCS, 66 PRBs, Prach format A2)</desc> + (Test6: 120kHz SCS, 66 PRBs, Prach format A2), + (Test7: 120kHz SCS, 66 PRBs, High Speed Enabled)</desc> <pre_compile_prog></pre_compile_prog> <compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog> <compile_prog_args> --phy_simulators -c </compile_prog_args> @@ -1340,8 +1343,9 @@ -a -s -30 -n 100 -p 63 -R 273 -a -s -30 -n 100 -p 63 -R 106 -c 4 -a -s -30 -n 100 -p 32 -R 32 -m 3 -c52 - -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52</main_exec_args> - <tags>nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6</tags> + -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52 + -a -s -30 -n 100 -R 66 -m 3 -c52 -H</main_exec_args> + <tags>nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6 nr_prachsim.test7</tags> <search_expr_true>PRACH test OK</search_expr_true> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <nruns>3</nruns> diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 960b24104773b4ce6816c6c90920389eb4b98b5c..358053a06084869b1e427f53c1dce3152d618fbe 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -48,8 +48,9 @@ DEADLINE_SCHEDULER_FLAG_USER="" CPU_AFFINITY_FLAG_USER="False" #Only valid when low-latency flag is set to False REL="Rel15" HW="None" -TP="None" +TP="Ethernet" EPC=0 +VERBOSE_CI=0 VERBOSE_COMPILE=0 CFLAGS_PROCESSOR_USER="" RUN_GROUP=0 @@ -67,6 +68,8 @@ USRP_REC_PLAY="False" BUILD_ECLIPSE=0 NR="False" ITTI_SIM="False" +RFSIM_NAS="False" +SANITIZE_ADDRESS="False" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc" trap handle_ctrl_c INT @@ -260,6 +263,8 @@ function main() { --nrUE) nrUE=1 NR="True" + rfsimNas=1 + RFSIM_NAS="True" echo_info "Will compile NR UE" shift;; --mu) @@ -289,6 +294,9 @@ function main() { esac echo_info "Setting hardware to: $HW" shift 2;; + -t | --transport) + TP=$2 + shift 2;; -P | --phy_simulators) SIMUS_PHY=1 echo_info "Will compile dlsim, ulsim, ..." @@ -324,6 +332,10 @@ function main() { HWLAT_TEST=1 echo_info "Will compile hw latency test program" shift;; + --verbose-ci) + VERBOSE_CI=1 + echo_info "Will compile with verbose instructions in CI Docker env" + shift;; --verbose-compile) VERBOSE_COMPILE=1 echo_info "Will compile with verbose instructions" @@ -416,6 +428,9 @@ function main() { CMAKE_CMD="$CMAKE_CMD -GNinja" MAKE_CMD=ninja shift;; + --sanitize-address | -fsanitize=address) + SANITIZE_ADDRESS=True + shift;; --ittiSIM) ittiSIM=1 ITTI_SIM="True" @@ -579,7 +594,7 @@ function main() { config_libconfig_shlib=params_libconfig # first generate the CMakefile in the right directory - if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then + if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" -o "$rfsimNas" = "1" ] ; then # softmodem compilation @@ -604,6 +619,8 @@ function main() { echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file + echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file + echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file cd $DIR/$build_dir/build eval $CMAKE_CMD @@ -936,12 +953,30 @@ function main() { echo_info "Building transport protocol libraries" rm -f liboai_transpro.so rm -f $dbin/liboai_transpro.so - compilations \ - $build_dir oai_eth_transpro \ - liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL - ln -sf liboai_eth_transpro.so liboai_transpro.so - ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so - echo_info "liboai_transpro.so is linked to ETHERNET transport" + if [ "$TP" == "Ethernet" ]; then + compilations \ + $build_dir oai_eth_transpro \ + liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL + ln -sf liboai_eth_transpro.so liboai_transpro.so + ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so + echo_info "liboai_transpro.so is linked to ETHERNET transport" + fi + if [ "$TP" == "benetel4g" ]; then + compilations \ + $build_dir benetel_4g \ + libbenetel_4g.so $dbin/libbenetel_4g.$REL + ln -sf libbenetel_4g.so liboai_transpro.so + ln -sf $dbin/libbenetel_4g.so.$REL $dbin/liboai_transpro.so + echo_info "liboai_transpro.so is linked to BENETEL4G transport" + fi + if [ "$TP" == "benetel5g" ]; then + compilations \ + $build_dir benetel_5g \ + libbenetel_5g.so $dbin/libbenetel_5g.$REL + ln -sf libbenetel_5g.so liboai_transpro.so + ln -sf $dbin/libbenetel_5g.so.$REL $dbin/liboai_transpro.so + echo_info "liboai_transpro.so is linked to BENETEL4G transport" + fi fi fi diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 9ef79be9c2d74cdb65c5e4dd115caeeab1925f8d..4b1cda42f8c32e017afb276ed45cbba283b303b7 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -83,6 +83,8 @@ get_distribution_release() { check_supported_distribution() { case $(get_distribution_release) in "ubuntu20.04") return 0 ;; + "ubuntu20.10") return 0 ;; + "ubuntu21.04") return 0 ;; esac return 1 } @@ -157,8 +159,16 @@ install_protobuf_from_source(){ #cd protobuf-2.6.1/ rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner - cd protobuf-3.3.0/ || exit + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner + cd protobuf-3.3.0/ + else + export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs + rm -rf /tmp/protobuf + git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf + cd /tmp/protobuf + git submodule update --init --recursive + ./autogen.sh + fi ./configure echo "Compiling protobuf" make -j"$(nproc)" @@ -198,15 +208,15 @@ install_usrp_uhd_driver_from_source(){ rm -rf /tmp/uhd git clone https://github.com/EttusResearch/uhd.git cd uhd || exit - git checkout tags/v3.13.0.2 + git checkout UHD-3.15.LTS mkdir -p host/build cd host/build || exit - $CMAKE ../ + $CMAKE ../ -GNinja echo "Compiling UHD" - make -j"$(nproc)" - make test - $SUDO make install + ninja + $SUDO ninja install $SUDO ldconfig + $SUDO /usr/lib/uhd/utils/uhd_images_downloader.py ) >& "$uhd_install_log" } @@ -329,6 +339,7 @@ check_install_ubuntu_packages() { $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in "ubuntu20.04") + "ubuntu21.04") specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" @@ -345,7 +356,6 @@ check_install_ubuntu_packages() { openvpn \ pkg-config \ python3-dev \ - python-pexpect \ sshfs \ swig \ tshark \ @@ -358,7 +368,6 @@ check_install_ubuntu_packages() { iperf3 \ android-tools-adb \ wvdial \ - python-numpy \ sshpass \ nscd \ bc \ @@ -379,7 +388,6 @@ check_install_ubuntu_packages() { git \ graphviz \ gtkwave \ - guile-2.0-dev \ iperf \ iptables \ libxtables-dev \ @@ -419,7 +427,8 @@ check_install_ubuntu_packages() { libxpm-dev \ libboost-all-dev \ nettle-dev \ - nettle-bin + nettle-bin \ + libreadline-dev fi $SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET" diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 39eb64d6e0b8db85d4a5cecd57a96bbf534e3500..9880b66685f6097b720ad2fca8a63ba4aaade752 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -41,7 +41,7 @@ KERNEL_VERSION=$(uname -r | cut -d '.' -f1) KERNEL_MAJOR=$(uname -r | cut -d '.' -f2) #check if we run inside a container -IS_CONTAINER=`egrep -c "docker|podman|kubepods" /proc/self/cgroup || true` +IS_CONTAINER=`egrep -c "docker|podman|kubepods|libpod|buildah" /proc/self/cgroup || true` #sudo is not needed when we are root if [ "$UID" = 0 ] then @@ -222,6 +222,11 @@ compilations() { ret=$? } > $dlog/$2.$REL.txt 2>&1 set -e + if [ "$VERBOSE_CI" == "1" ]; then + echo_info "====== Start of log for $2.$REL.txt ======" + cat $dlog/$2.$REL.txt + echo_info "====== End of log for $2.$REL.txt ======" + fi if [[ $ret -ne 0 ]]; then check_warnings "$dlog/$2.$REL.txt" check_errors "$dlog/$2.$REL.txt" @@ -360,10 +365,10 @@ check_install_usrp_uhd_driver(){ elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then if [ $IS_CONTAINER -eq 0 ] then - $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake + $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils $CMAKE $SUDO -H pip install requests else - $SUDO $INSTALLER -y install boost boost-devel cmake3 + $SUDO $INSTALLER -y install boost boost-devel $CMAKE $SUDO pip3 install mako requests fi if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then @@ -489,7 +494,7 @@ install_soapy_from_source(){ #git checkout tags/release_003_010_001_001 mkdir -p build cd build - cmake ../ + $CMAKE ../ echo "Compiling SoapyRemote" make -j`nproc` $SUDO make install @@ -508,7 +513,7 @@ install_soapy_iris_from_source(){ cd sklk-soapyiris mkdir -p build cd build - cmake ../ + $CMAKE ../ echo "Compiling SoapyIris" make -j`nproc` $SUDO make install @@ -685,7 +690,7 @@ check_install_oai_software() { automake \ bison \ build-essential \ - cmake \ + $CMAKE \ cmake-curses-gui \ ninja-build \ doxygen \ diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp index e11912668303a3c441e44350f4f50939e265d3cd..1a4c6b10b8381a367762e8032ae5235aa68e8a6a 100755 --- a/cmake_targets/tools/run_enb_s1_usrp +++ b/cmake_targets/tools/run_enb_s1_usrp @@ -101,7 +101,6 @@ function main() local -i run_gdb=0 local -i show_stdout=0 local exe_arguments="" - local itti_dump_file="" until [ -z "$1" ] do @@ -154,18 +153,6 @@ function main() exe_arguments="$exe_arguments --rf-config-file=$rf_config_file" fi ;; - -K | --itti-dump-file) - itti_dump_file=$2 - # can omit file name if last arg on the line - if [ "x$itti_dump_file" = "x" ]; then - itti_dump_file="/tmp/enb_s1_usrp_itti.log" - shift 1; - else - shift 2; - fi - echo "setting ITTI dump file to: $itti_dump_file" - exe_arguments="$exe_arguments -K $itti_dump_file" - ;; -m | --mscgen) g_msc_dir=$2 # can omit file name if last arg on the line diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 6d01d98c65b328496e80f5d34014472db4fcaee7..1df1bc16f7df9795e4bbac22de08e0c8bac0fc62 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -255,7 +255,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */ ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */ ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) || - ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { + ((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { char *valptr=NULL; int ret; config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h index 8baaa99bb8074f90e9fa42aac5d18506c65a2f40..0688f6531f5d34dbdcf9e46f9a3b8219c7673fc1 100644 --- a/common/config/config_load_configmodule.h +++ b/common/config/config_load_configmodule.h @@ -82,10 +82,12 @@ typedef struct configmodule_interface { #ifdef CONFIG_LOADCONFIG_MAIN configmodule_interface_t *cfgptr=NULL; -static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \ - debugflags can also be defined in the config_libconfig section of the config file\n \ +static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \ + debugflags can also be defined in the config section of the config file\n \ debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \ - 4->print command line processing debug messages\n "; + 4->print command line processing debug messages\n \ + incp parameter can be used to define the include path used for config files (@include directive)\n \ + defaults is set to the path of the main config file.\n"; #define CONFIG_SECTIONNAME "config" #define CONFIGPARAM_DEBUGFLAGS_IDX 0 diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index eb08a70183f5f699253450d460be22e607938c59..17266246f0c24e9b9178ebb62171ed5ff3dd0fc6 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -33,8 +33,9 @@ #include <string.h> #include <stdlib.h> +#include <unistd.h> + #include <libgen.h> -#include <arpa/inet.h> #include "config_libconfig.h" #include "config_libconfig_private.h" @@ -347,17 +348,35 @@ int config_libconfig_init(char *cfgP[], int numP) { config_get_if()->numptrs=0; memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS); memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated)); - + /* search for include path parameter and set config file include path accordingly */ + for (int i=0; i<numP; i++) { + if (strncmp(cfgP[i],"incp",4) == 0) { + config_set_include_dir (&(libconfig_privdata.cfg),cfgP[i]+4); + break; + } + } + /* dirname may modify the input path and returned ptr may points to part of input path */ + char *tmppath = strdup(libconfig_privdata.configfile); + if ( config_get_include_dir (&(libconfig_privdata.cfg)) == NULL) { + config_set_include_dir (&(libconfig_privdata.cfg),dirname( tmppath )); + } + + const char *incp = config_get_include_dir (&(libconfig_privdata.cfg)) ; + + printf("[LIBCONFIG] Path for include directive set to: %s\n", (incp!=NULL)?incp:"libconfig defaults"); + /* set convertion option to allow integer to float conversion*/ + config_set_auto_convert (&(libconfig_privdata.cfg), CONFIG_TRUE); /* Read the file. If there is an error, report it and exit. */ - if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) { - fprintf(stderr,"[LIBCONFIG] %s %d file %s - %d - %s\n",__FILE__, __LINE__, + if( config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile) == CONFIG_FALSE) { + fprintf(stderr,"[LIBCONFIG] %s %d file %s - line %d: %s\n",__FILE__, __LINE__, libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)), config_error_text(&(libconfig_privdata.cfg))); config_destroy(&(libconfig_privdata.cfg)); printf( "\n"); + free(tmppath); return -1; } - + free(tmppath); return 0; } diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 4e6ec9d3db11ad76cd1ebe2f514b59f69454f545..8029ba826bc81799e355f998438c8faa12721924 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -243,7 +243,7 @@ int write_file_matlab(const char *fname, fprintf(fp,"%d \n",((unsigned char *)&data)[0]); break; default: - AssertFatal(false, "unknown dump format: %d\n", format); + AssertFatal(false, "unknown dump format: %u\n", format); } if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) { diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c index bd598b48dab7ba97d7cdb2b7e0aa21c15bf14e64..5bf97599338f0e1d673bfcc973e065b498c2d950 100644 --- a/common/utils/LOG/vcd_signal_dumper.c +++ b/common/utils/LOG/vcd_signal_dumper.c @@ -302,6 +302,9 @@ const char* eurecomFunctionsNames[] = { /* PHY signals */ "ue_synch", "ue_slot_fep", + "ue_slot_fep_pdcch", + "ue_slot_fep_pbch", + "ue_slot_fep_pdsch", "ue_slot_fep_mbsfn", "ue_slot_fep_mbsfn_khz_1dot25", "ue_rrc_measurements", @@ -390,6 +393,8 @@ const char* eurecomFunctionsNames[] = { "rx_pmch", "rx_pmch_khz_1dot25", "pdsch_procedures", + "pdsch_procedures_crnti", + //"dlsch_procedures_crnti", "pdsch_procedures_si", "pdsch_procedures_p", "pdsch_procedures_ra", diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h index f9f5868260fce048470531405b303bff5dd945a5..fb27c19973ad84105ca878ae0c6a0a60abf1c318 100644 --- a/common/utils/LOG/vcd_signal_dumper.h +++ b/common/utils/LOG/vcd_signal_dumper.h @@ -283,6 +283,9 @@ typedef enum { /* PHY signals */ VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_MBSFN, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_MBSFN_KHZ_1DOT25, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, @@ -371,9 +374,11 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PMCH, VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PMCH_KHZ_1DOT25, VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, + VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, + //VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PROC_C, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB1_ENB, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB2_ENB, diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile index 0588c88a456c4d54965c73f4caee0e060d8b4852..d76ab93cb8d0a735f79031571ae3140d7fe85c28 100644 --- a/common/utils/T/Makefile +++ b/common/utils/T/Makefile @@ -18,7 +18,7 @@ T_messages.txt.h: T_messages.txt T_IDs.h: $(GENIDS) T_messages.txt ./$(GENIDS) T_messages.txt T_IDs.h -check_vcd: +check_vcd: T_IDs.h T_messages.txt.h gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread ./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false) rm -f ./_check_vcd diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 11c816f002a409c8befb42ff7381126a5e3b00a9..b74c0567ce7333544d8a29f95419b1f08eb57f85 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -42,9 +42,9 @@ /* maximum size of a message - increase if needed */ #if BASIC_SIMULATOR /* let's have 100 RBs functional for the basic simulator */ -# define T_BUFFER_MAX (1024*64*2) +# define T_BUFFER_MAX (1024*64*4) #else -# define T_BUFFER_MAX (1024*64*2) +# define T_BUFFER_MAX (1024*64*4) #endif /* size of the local cache for messages (must be pow(2,something)) */ @@ -73,7 +73,7 @@ typedef struct { } T_cache_t; /* number of VCD functions (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_FUNCTIONS (269) +#define VCD_NUM_FUNCTIONS (273) /* number of VCD variables (to be kept up to date! see in T_messages.txt) */ #define VCD_NUM_VARIABLES (187) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index fedc50cf5da319b31392cc801cea4d39cd9967fa..ca5690497dc05140dc918e8b47254ec94f0ab26f 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -93,6 +93,10 @@ ID = GNB_PHY_PUCCH_PUSCH_IQ DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB FORMAT = int,frame : int,slot : buffer,rxdataF +ID = GNB_PHY_PRACH_INPUT_SIGNAL + DESC = gNodeB input data in the time domain for slots with PRACH detection + GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB + FORMAT = int,frame : int,slot : int,antenna : buffer,rxdata #MAC logs ID = ENB_MAC_UE_DL_SDU @@ -2407,6 +2411,21 @@ ID = VCD_FUNCTION_UE_SLOT_FEP GROUP = ALL:VCD:UE:VCD_FUNCTION FORMAT = int,value VCD_NAME = ue_slot_fep +ID = VCD_FUNCTION_UE_SLOT_FEP_PDCCH + DESC = VCD function UE_SLOT_FEP_PDCCH + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = ue_slot_fep_pdcch +ID = VCD_FUNCTION_UE_SLOT_FEP_PBCH + DESC = VCD function UE_SLOT_FEP_PBCH + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = ue_slot_fep_pbch +ID = VCD_FUNCTION_UE_SLOT_FEP_PDSCH + DESC = VCD function UE_SLOT_FEP_PDSCH + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = ue_slot_fep_pdsch ID = VCD_FUNCTION_UE_SLOT_FEP_MBSFN DESC = VCD function UE_SLOT_FEP_MBSFN GROUP = ALL:VCD:UE:VCD_FUNCTION @@ -2847,6 +2866,11 @@ ID = VCD_FUNCTION_PDSCH_PROC GROUP = ALL:VCD:UE:VCD_FUNCTION FORMAT = int,value VCD_NAME = pdsch_procedures +ID = VCD_FUNCTION_PDSCH_PROC_C + DESC = VCD function PDSCH_PROC_C + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = pdsch_procedures_crnti ID = VCD_FUNCTION_PDSCH_PROC_SI DESC = VCD function PDSCH_PROC_SI GROUP = ALL:VCD:UE:VCD_FUNCTION diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 48d8df401cec155027bec18dacc056ef3f70d7fe..06d43bdbfa05c26dc08ac292aae9af8dd15a6364 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -39,7 +39,7 @@ void output_log_mem(void); display_backtrace(); \ fflush(stdout); \ fflush(stderr); \ - exit(EXIT_FAILURE); \ + abort(); #define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ do { \ diff --git a/common/utils/backtrace.c b/common/utils/backtrace.c index f6de74f156ce1bc04ddb58aeb65c3097c8c1ba47..f61cf0349ac5d9a64fcad36a6b235e9c8071768d 100644 --- a/common/utils/backtrace.c +++ b/common/utils/backtrace.c @@ -38,7 +38,7 @@ void display_backtrace(void) { size_t i; char *test=getenv("NO_BACKTRACE"); - if (test!=0) *((int *)0)=0; + if (test!=0) abort(); size = backtrace(array, 10); strings = backtrace_symbols(array, size); diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c index 7cc5f79f90ef18e07dde08b626c2d3f8d50d4515..84b723b02286694f0837f7ac817c592e5e98f72c 100644 --- a/common/utils/msc/msc.c +++ b/common/utils/msc/msc.c @@ -52,6 +52,7 @@ FILE *g_msc_fd; char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH]; +msc_interface_t msc_interface; typedef unsigned long msc_message_number_t; typedef struct msc_queue_item_s { diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h index aab872cfe150607a06f6f19b2a23c435d57f82e3..adb0d9e657e5ef7a54ad433938d9c372ef225ec3 100644 --- a/common/utils/msc/msc.h +++ b/common/utils/msc/msc.h @@ -117,7 +117,7 @@ void msc_log_message( #define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded -msc_interface_t msc_interface; +extern msc_interface_t msc_interface; #define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2) #define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use #define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 0671aed813d6b4f6c81265fdba82e08dcae53e8a..cc2860191af34fd80ebc78e8bb93e9a204a64ad2 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -111,8 +111,6 @@ const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t); int NRRIV2BW(int locationAndBandwidth,int N_RB) { int tmp = locationAndBandwidth/N_RB; int tmp2 = locationAndBandwidth%N_RB; - - if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp+1); else return(N_RB+1-tmp); @@ -121,8 +119,6 @@ int NRRIV2BW(int locationAndBandwidth,int N_RB) { int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) { int tmp = locationAndBandwidth/N_RB; int tmp2 = locationAndBandwidth%N_RB; - - if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp2); else return(N_RB-1-tmp2); } diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 2189be9fe8bfe34cdef4d6495fd0076ebc548d94..c774da57e6176a467592ee0ce9b097aee2be4c55 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -339,7 +339,9 @@ extern "C" { int itti_create_queue(const task_info_t *taskInfo) { pthread_mutex_lock (&lock_nb_queues); int newQueue=nb_queues++; - AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),""); + task_list_t **new_tasks = (task_list_t **)realloc(tasks, nb_queues * sizeof(*tasks)); + AssertFatal(new_tasks != NULL, "could not realloc() tasks list"); + tasks = new_tasks; tasks[newQueue]= new task_list_t; pthread_mutex_unlock (&lock_nb_queues); LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue); diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 18a8f7868c29f48b08e55f9aa16a6b690c311e18..7c17a6f3b12fe9d060b8fb3a9053d7c922ead83f 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -340,11 +340,13 @@ void *rrc_enb_process_msg(void *); TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\ TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ + TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\ TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \ + TASK_DEF(TASK_NAS_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL) #define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc }, @@ -471,6 +473,9 @@ void itti_subscribe_event_fd(task_id_t task_id, int fd); void itti_unsubscribe_event_fd(task_id_t task_id, int fd); /** \brief Return the list of events excluding the fd associated with itti + \the fd associated with itti can return, but it is marked events[i].events &= ~EPOLLIN + \as it is not EPOLLIN, the reader should ignore this fd + \or it can manage the list of fd's in his interest, so ignore the other ones \param task_id Task ID of the task \param events events list @returns number of events to handle diff --git a/common/utils/system.c b/common/utils/system.c index 1bd5c7d39bc500d979bd8d258c8fa7dd16a52b95..4c6c1a4dc0bf0b297b549d92d3a4e3f3aa70f39c 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -199,15 +199,32 @@ void start_background_system(void) { void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){ pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedpolicy(&attr, SCHED_FIFO); + int ret; + ret=pthread_attr_init(&attr); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + if(priority<sched_get_priority_min(SCHED_OAI) || priority>sched_get_priority_max(SCHED_FIFO)) { + LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n", + priority, + sched_get_priority_min(SCHED_OAI), + sched_get_priority_max(SCHED_OAI)); + if(priority<sched_get_priority_min(SCHED_OAI)) + priority=sched_get_priority_min(SCHED_OAI); + if(priority>sched_get_priority_max(SCHED_OAI)) + priority=sched_get_priority_max(SCHED_OAI); + } + AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),""); struct sched_param sparam={0}; sparam.sched_priority = priority; - pthread_attr_setschedparam(&attr, &sparam); - - pthread_create(t, &attr, func, param); + ret=pthread_attr_setschedparam(&attr, &sparam); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_create(t, &attr, func, param); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); pthread_setname_np(*t, name); if (affinity != -1 ) { @@ -216,7 +233,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, CPU_SET(affinity, &cpuset); AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity"); } - pthread_attr_destroy(&attr); } diff --git a/common/utils/system.h b/common/utils/system.h index a89a6c5b1729f0b968fbfd4baed9cfd3cce85b10..fbfd338a1a7a2b4e197d6011cb9405aa4d504abd 100644 --- a/common/utils/system.h +++ b/common/utils/system.h @@ -46,9 +46,11 @@ void set_latency_target(void); void configure_linux(void); void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority); -#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_FIFO) -#define OAI_PRIORITY_RT sched_get_priority_max(SCHED_FIFO)-10 -#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_FIFO) + +#define SCHED_OAI SCHED_RR +#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI) +#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2) +#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2 void thread_top_init(char *thread_name, int affinity, diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 03f7af99bc2ca9cc8d81c7f834f7ad8dd2a2c7ce..734126721ad03a9141e87eb5eff10b79db202f4c 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -461,12 +461,12 @@ int process_command(char *buf) { int i,j,k; char modulename[TELNET_CMD_MAXSIZE]; char cmd[TELNET_CMD_MAXSIZE]; - char cmdb[TELNET_MAX_MSGLENGTH]; + char *cmdb=NULL; char *bufbck; int rt; memset(modulename,0,sizeof(modulename)); memset(cmd,0,sizeof(cmd)); - memset(cmdb,0,sizeof(cmdb)); + if (strncasecmp(buf,"ex",2) == 0) return CMDSTATUS_EXIT; @@ -490,12 +490,10 @@ int process_command(char *buf) { return CMDSTATUS_FOUND; } - memset(modulename,0,sizeof(modulename)); - memset(cmd,0,sizeof(cmd)); - memset(cmdb,0,sizeof(cmdb)); + bufbck=strdup(buf); rt=CMDSTATUS_NOTFOUND; - j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb); + j = sscanf(buf,"%19s %19s %m[^\t\n]",modulename,cmd,&cmdb); if (telnetparams.telnetdbg > 0) printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb); @@ -562,7 +560,7 @@ int process_command(char *buf) { rt= CMDSTATUS_FOUND; } /* loop */ } /* for i */ - + free(cmdb); free(bufbck); return rt; } @@ -702,7 +700,7 @@ void poll_telnetcmdq(void *qid, void *arg) { */ void exec_moduleinit(char *modname) { void (*fptr)(void); - char initfunc[TELNET_CMD_MAXSIZE+9]; + char initfunc[TELNET_CMD_MAXSIZE+10]; if (strlen(modname) > TELNET_CMD_MAXSIZE) { fprintf(stderr,"[TELNETSRV] module %s not loaded, name exceeds the %i size limit\n", diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 5db1a5e34e6ca58a1b439977b26c9d1267ec867c..a32b7c38595bbfe83ce446d2eddf81de87e4d995 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -37,14 +37,21 @@ #else #define THREADINIT PTHREAD_MUTEX_INITIALIZER #endif -#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,""); -#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,""); -#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,""); +#define mutexinit(mutex) {int ret=pthread_mutex_init(&mutex,NULL); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condinit(signal) {int ret=pthread_cond_init(&signal,NULL); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define mutexlock(mutex) {int ret=pthread_mutex_lock(&mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} #define mutextrylock(mutex) pthread_mutex_trylock(&mutex) -#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,""); -#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,""); -#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); -#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); +#define mutexunlock(mutex) {int ret=pthread_mutex_unlock(&mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condwait(condition, mutex) {int ret=pthread_cond_wait(&condition, &mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condbroadcast(signal) {int ret=pthread_cond_broadcast(&signal); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condsignal(signal) {int ret=pthread_cond_broadcast(&signal); \ + AssertFatal(ret==0,"ret=%d\n",ret);} #define tpool_nbthreads(tpool) (tpool.nbThreads) typedef struct notifiedFIFO_elt_s { struct notifiedFIFO_elt_s *next; @@ -78,7 +85,7 @@ static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size, ret->reponseFifo=reponseFifo; ret->processingFunc=processingFunc; // We set user data piece aligend 32 bytes to be able to process it with SIMD - ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32; + ret->msgData=(void *)((uint8_t*)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32); ret->malloced=true; return ret; } diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md index a087b989faddba2b8374721ea34d609d589444a7..f2422d98225c5d5e4ea9d2f4a84dbcfa6e93ccb1 100644 --- a/common/utils/threadPool/thread-pool.md +++ b/common/utils/threadPool/thread-pool.md @@ -210,8 +210,8 @@ time the worker finished the job time the client reads the result if you set the environement variable: -thread-pool-measurements to a valid file name +threadPoolMeasurements to a valid file name These measurements will be wrote to this Linux pipe. -A tool to read the linux fifo and display it in ascii is provided: -see the local directory Makefile for this tool and to compile the thread pool unitary tests. +A tool to read the linux fifo and display it in ascii is provided; compute the binay: +in cmake building directory: make/ninja measurement_display diff --git a/doc/SW_archi.md b/doc/SW_archi.md index d92f8021488fb30b6a2b3fb7d209fc733b92347d..0d03591891f6877246a5f6e4b5e45d5fceec4943 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -296,6 +296,28 @@ gtp thread calls directly pdcp_data_req(), so it runs inside it's context intern ## inside other threads gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the other threads, without mutex. +# New GTP +## initialization +Coexistance until full merge with legacy GTP +cmake new option: NEW_GTPU to use the new implementation (it changes for the entire executable) +It is possible to use both old and new GTP in same executable because the itti task and all functions names are different +Current status of new implementation: not tested, X2 not developped, 5G new GTP option not developped, remain issues on data coming from void: muid, enb_flag, ... + +ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything +gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address + +newGtpuCreateTunnel() this function will replace the xxx_create_tunnel_xxx() for various cases +This creates a outgoing context for a teid (in input), it computes and return the incoming teid that will be used for incoming packets +These teids and in a "instance", so in a Linux socket: same teid can co-exist for different sockets + Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback +stuff like enb_flag, but also mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data. +The datamodel is still not fully understood, so this data source remain unknown +A new parameter is the callback function: will be pdpcp_data_req() and gtpv_data_req() (x2 case) for existing implementation and later other call backs like the F1-U implementation. + +incoming packets +the gtp layer retrieves the data, the teid, find out the related data: rnti, bearer and quite a lot of other parameters (not clear why, because it looks like all is statefull, so the lower layer should have the context) +if lower layers can be stateless, it is a good idea to keep the context in the gtp layer and pass it to the callback, but the design remain obfuscated. + # NGAP NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)? About all messages are exchanged with RRC thread diff --git a/doc/TESTING_GNB_W_COTS_UE.md b/doc/TESTING_GNB_W_COTS_UE.md index 73ae18351f2f1458a687ea41408321c3cc36180f..5f9299f0ef6f5c5e946fca30b541a78656f726fa 100644 --- a/doc/TESTING_GNB_W_COTS_UE.md +++ b/doc/TESTING_GNB_W_COTS_UE.md @@ -44,10 +44,11 @@ Our code might not work with all 5G phones yet, but we are constantly improving * Oppo Reno 5G * Samsung A90 5G -* Google Pixel 5G +* Google Pixel 5G (note1) * Simcom SIMCOM8200EA * Quectel RM500Q-GL +Note1: In the version we have at Eurecom, you need to set the PLMN to 50501, and you also need to change the firmware to "11.0.0 (RD1A.201105.003.B1, Nov 2020, EU carriers)" (see https://developers.google.com/android/images) ## Repository diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index 5fcd5a7b9f07d041f66d3aa92dca8a3c72c57c83..aa8b9aa228962ed012e39d2bb21a02e0a62d2b8f 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -27,14 +27,15 @@ FROM localhost/ran-build:latest AS enb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --eNB --ninja -w USRP + ./build_oai --eNB --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index cdfb37ebfc343637e2bfbdce2ff3d2f0f147a09c..95d7194c317e6c38fceefbfebfd93fc64e649ca0 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -27,14 +27,15 @@ FROM ran-build:latest AS enb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --eNB --ninja -w USRP + ./build_oai --eNB --ninja -w USRP --verbose-ci RUN apt-get install -y python3-pip && \ pip3 install --ignore-installed pyyaml && \ diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2 index fb9ade927f8db1a1c7d559b3ddb26db4cb6af8df..6969c691fdf6197dccb14cf8925bbda766f3581d 100644 --- a/docker/Dockerfile.gNB.rhel8.2 +++ b/docker/Dockerfile.gNB.rhel8.2 @@ -27,14 +27,15 @@ FROM localhost/ran-build:latest AS gnb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --gNB --ninja -w USRP + ./build_oai --gNB --ninja -w USRP --verbose-ci #debug #RUN ldconfig -v diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18 index d43ad4709dbedcef7c76861cc2677a38c95dc8d4..276d6989c4e9bf61d87cb4c86a32ff8c55ff7d4b 100644 --- a/docker/Dockerfile.gNB.ubuntu18 +++ b/docker/Dockerfile.gNB.ubuntu18 @@ -27,14 +27,15 @@ FROM ran-build:latest AS gnb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --gNB --ninja -w USRP + ./build_oai --gNB --ninja -w USRP --verbose-ci #debug RUN ldconfig -v diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index 0a853dcd6b5dc211a730cf0a82f074e9118eea61..e22343d63cec65d90e23051c44abb3da778094b3 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -27,15 +27,15 @@ FROM localhost/ran-build:latest AS lte-ue-build - +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --UE --ninja -w USRP + ./build_oai --UE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index 8793cc54f79d87e470a46a4520b7f2ee519d1865..6af2e619918e776d0b46ec4b466d4677dacd627a 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -27,14 +27,15 @@ FROM ran-build:latest AS lte-ue-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --UE --ninja -w USRP + ./build_oai --UE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2 index f9f3f8e4bfcdfd4e95d3d8ae10ed206788f7af53..01988fd6ff6608d8f132eefbce4524c16149a305 100644 --- a/docker/Dockerfile.nrUE.rhel8.2 +++ b/docker/Dockerfile.nrUE.rhel8.2 @@ -27,14 +27,15 @@ FROM localhost/ran-build:latest AS nr-ue-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --nrUE --ninja -w USRP + ./build_oai --nrUE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18 index 5450194f3539ad83663017e31e53e10185dc9a37..c96bcf80ef106613c06080574455f09f724cb42a 100644 --- a/docker/Dockerfile.nrUE.ubuntu18 +++ b/docker/Dockerfile.nrUE.ubuntu18 @@ -27,14 +27,15 @@ FROM ran-build:latest AS nr-ue-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ - ./build_oai --nrUE --ninja -w USRP + ./build_oai --nrUE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 new file mode 100644 index 0000000000000000000000000000000000000000..4472ece36313de139ff26710dc253f19fb4f9585 --- /dev/null +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -0,0 +1,123 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +# Dockerfile for the Open-Air-Interface BUILD service +# Valid for RHEL8 +# +#--------------------------------------------------------------------- + +FROM localhost/ran-build:develop AS phy-sim-build + +RUN rm -Rf /oai-ran +WORKDIR /oai-ran +COPY . . + +#run build_oai to build the target image +RUN /bin/sh oaienv && \ + cd cmake_targets && \ + mkdir -p log && \ + ./build_oai --phy_simulators --ninja --verbose-ci + + +#start from scratch for target executable +FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim + +RUN yum update -y && \ + yum install -y --enablerepo="ubi-8-codeready-builder" \ + lksctp-tools \ + nettle \ + atlas \ + hostname \ + sudo \ + procps-ng \ + net-tools \ + iputils \ + bc \ + iproute \ + libyaml && \ + echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ + echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf + +WORKDIR /opt/oai-physim/targets/bin +COPY --from=phy-sim-build /oai-ran/targets/bin/dlsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_prachsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulschsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/polartest.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/ulsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/ldpctest.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlschsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pbchsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pucchsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/smallblocktest.Rel15 . + +WORKDIR /usr/local/lib/ +COPY --from=phy-sim-build /oai-ran/targets/bin/libcoding.so . +COPY --from=phy-sim-build /lib64/liblapacke.so.3 . +COPY --from=phy-sim-build /lib64/libX11.so.6 . +COPY --from=phy-sim-build /lib64/libXpm.so.4 . +COPY --from=phy-sim-build /lib64/libxcb.so.1 . +COPY --from=phy-sim-build /lib64/libXau.so.6 . +COPY --from=phy-sim-build /lib64/libforms.so.2 . +COPY --from=phy-sim-build /lib64/libblas.so.3 . +COPY --from=phy-sim-build /lib64/liblapack.so.3 . +COPY --from=phy-sim-build /lib64/libexslt.so.0 . +COPY --from=phy-sim-build /lib64/libxslt.so.1 . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libdfts.so . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libSIMU.so . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc.so . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc_orig.so . + +RUN ldconfig + +#debug +#RUN ldd /opt/oai-physim/targets/bin/dlsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_dlsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_prachsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_ulschsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/polartest.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/ulsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/ldpctest.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_dlschsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_pbchsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_pucchsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_ulsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/smallblocktest.Rel15 + +# Copy some executables +WORKDIR /usr/bin/ + +COPY --from=phy-sim-build /usr/bin/killall . +COPY --from=phy-sim-build /usr/bin/xmlstarlet . +COPY --from=phy-sim-build /usr/bin/svn . + +# Copy the relevant configuration files for phySim +WORKDIR /opt/oai-physim/ + +COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/run_exec_autotests.bash /opt/oai-physim/cmake_targets/autotests/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/test_case_list.xml /opt/oai-physim/cmake_targets/autotests/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/tools/free_mem.bash /opt/oai-physim/cmake_targets/autotests/tools/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/build_helper /opt/oai-physim/cmake_targets/tools/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/test_helper /opt/oai-physim/cmake_targets/tools/ + +#CMD ["sleep", "infinity"] diff --git a/executables/main-ocp.c b/executables/main-ocp.c index ae1db7195bc6e2fb6add1059efc0ee5343d8213c..962b738e252e6b6c576b4a52a2488603655c8c8e 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -73,17 +73,20 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; volatile int oai_exit = 0; double cpuf; +msc_interface_t msc_interface; +THREAD_STRUCT thread_struct; + uint16_t sf_ahead=4; //uint16_t slot_ahead=6; int otg_enabled; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int split73; -int usrp_tx_thread = 0; char * split73_config; int split73; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0}; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]= {0}; +uint8_t proto_agent_flag = 0; void flexran_agent_slice_update(mid_t module_idP) { } int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p){ @@ -1318,7 +1321,7 @@ int main ( int argc, char **argv ) { // end of CI modifications //getchar(); - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("enb", NULL); itti_wait_tasks_end(); @@ -1327,7 +1330,7 @@ int main ( int argc, char **argv ) { // stop threads if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) { - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); LOG_I(ENB_APP,"stopping MODEM threads\n"); diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index fce01f04fd562867ccfc23a019e5440b234fae0a..5ee3287955a15d7db3d29675b6249088fadefb34 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -228,16 +228,6 @@ void rx_func(void *param) { rnti_to_remove_count = 0; if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); - // Call the scheduler - - pthread_mutex_lock(&gNB->UL_INFO_mutex); - gNB->UL_INFO.frame = frame_rx; - gNB->UL_INFO.slot = slot_rx; - gNB->UL_INFO.module_id = gNB->Mod_id; - gNB->UL_INFO.CC_id = gNB->CC_id; - gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); - pthread_mutex_unlock(&gNB->UL_INFO_mutex); - // RX processing int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); @@ -250,19 +240,32 @@ void rx_func(void *param) { L1_nr_prach_procedures(gNB,frame_rx,slot_rx); //apply the rx signal rotation here - apply_nr_rotation_ul(&gNB->frame_parms, - gNB->common_vars.rxdataF[0], - slot_rx, - 0, - gNB->frame_parms.Ncp==EXTENDED?12:14, - gNB->frame_parms.ofdm_symbol_size); - + for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { + apply_nr_rotation_ul(&gNB->frame_parms, + gNB->common_vars.rxdataF[aa], + slot_rx, + 0, + gNB->frame_parms.Ncp==EXTENDED?12:14, + gNB->frame_parms.ofdm_symbol_size); + } phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); } stop_meas( &softmodem_stats_rxtx_sf ); LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); + // Call the scheduler + + start_meas(&gNB->ul_indication_stats); + pthread_mutex_lock(&gNB->UL_INFO_mutex); + gNB->UL_INFO.frame = frame_rx; + gNB->UL_INFO.slot = slot_rx; + gNB->UL_INFO.module_id = gNB->Mod_id; + gNB->UL_INFO.CC_id = gNB->CC_id; + gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); + pthread_mutex_unlock(&gNB->UL_INFO_mutex); + stop_meas(&gNB->ul_indication_stats); + notifiedFIFO_elt_t *res; if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { @@ -322,18 +325,40 @@ static void *process_stats_thread(void *param) { PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param; + reset_meas(&gNB->phy_proc_tx); reset_meas(&gNB->dlsch_encoding_stats); - reset_meas(&gNB->dlsch_scrambling_stats); - reset_meas(&gNB->dlsch_modulation_stats); + reset_meas(&gNB->phy_proc_rx); + reset_meas(&gNB->ul_indication_stats); + reset_meas(&gNB->rx_pusch_stats); + reset_meas(&gNB->ulsch_decoding_stats); wait_sync("process_stats_thread"); while(!oai_exit) { sleep(1); - print_meas(&gNB->dlsch_encoding_stats, "pdsch_encoding", NULL, NULL); - print_meas(&gNB->dlsch_scrambling_stats, "pdsch_scrambling", NULL, NULL); - print_meas(&gNB->dlsch_modulation_stats, "pdsch_modulation", NULL, NULL); + print_meas(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL); + print_meas(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL); + print_meas(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL); + print_meas(&gNB->ul_indication_stats, "UL Indication", NULL, NULL); + print_meas(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL); + print_meas(&gNB->ulsch_decoding_stats, "PUSCH decoding", NULL, NULL); + } + return(NULL); +} + +void *nrL1_stats_thread(void *param) { + PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param; + wait_sync("L1_stats_thread"); + FILE *fd; + while (!oai_exit) { + sleep(1); + fd=fopen("nrL1_stats.log","w"); + AssertFatal(fd!=NULL,"Cannot open ngL1_stats.log\n"); + dump_nr_I0_stats(fd,gNB); + dump_pusch_stats(fd,gNB); + // dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx); + fclose(fd); } return(NULL); } @@ -372,7 +397,10 @@ void init_gNB_Tpool(int inst) { initNotifiedFIFO(gNB->resp_RU_tx); // Stats measurement thread - if(opp_enabled == 1) threadCreate(&proc->L1_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW); + if(opp_enabled == 1) threadCreate(&proc->process_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW); + threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW); + + } @@ -461,24 +489,24 @@ printf("after %p\n", gNB->common_vars.rxdataF[aa]); } + + void init_gNB(int single_thread_flag,int wait_for_sync) { int inst; PHY_VARS_gNB *gNB; if (RC.gNB == NULL) { - RC.gNB = (PHY_VARS_gNB **) malloc((1+RC.nb_nr_L1_inst)*sizeof(PHY_VARS_gNB *)); - for (inst=0; inst<RC.nb_nr_L1_inst; inst++) { - RC.gNB[inst] = (PHY_VARS_gNB *) malloc(sizeof(PHY_VARS_gNB)); - memset((void*)RC.gNB[inst],0,sizeof(PHY_VARS_gNB)); - } + RC.gNB = (PHY_VARS_gNB **) calloc(1+RC.nb_nr_L1_inst, sizeof(PHY_VARS_gNB *)); + LOG_I(PHY,"gNB L1 structure RC.gNB allocated @ %p\n",RC.gNB); } - LOG_I(PHY,"gNB L1 structure RC.gNB allocated @ %p\n",RC.gNB); - for (inst=0; inst<RC.nb_nr_L1_inst; inst++) { - LOG_I(PHY,"[lte-softmodem.c] gNB structure RC.gNB[%d] allocated @ %p\n",inst,RC.gNB[inst]); + if (RC.gNB[inst] == NULL) { + RC.gNB[inst] = (PHY_VARS_gNB *) calloc(1, sizeof(PHY_VARS_gNB)); + LOG_I(PHY,"[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n",inst,RC.gNB[inst]); + } gNB = RC.gNB[inst]; gNB->abstraction_flag = 0; gNB->single_thread_flag = single_thread_flag; @@ -508,7 +536,7 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { } - LOG_I(PHY,"[nr-softmodem.c] gNB structure allocated\n"); + LOG_I(PHY,"[nr-gnb.c] gNB structure allocated\n"); } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index ae897f4a1c619c57797c419db6f51f39c441f914..6d5b0ec8a35930e70a9594b52b6d16d1f24d98ea 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -89,7 +89,7 @@ static int DEFBFW[] = {0x00007fff}; #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" - +#include <openair1/PHY/TOOLS/phy_scope_interface.h> #include "T.h" @@ -119,7 +119,6 @@ uint16_t sl_ahead; extern int emulate_rf; extern int numerology; -extern int usrp_tx_thread; /*************************************************************/ /* Functions to attach and configure RRU */ @@ -755,17 +754,25 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { if (fp->freq_range==nr_FR2) { // the beam index is written in bits 8-10 of the flags // bit 11 enables the gpio programming + // currently we switch beams every 10 slots (should = 1 TDD period in FR2) and we take the beam index of the first symbol of the first slot of this period int beam=0; - //if (slot==0) beam = 11; //3 for boresight & 8 to enable + if (slot%10==0) { + if (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8) { + beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8; + } + } /* - if (slot==0 || slot==40) beam=0&8; - if (slot==10 || slot==50) beam=1&8; - if (slot==20 || slot==60) beam=2&8; - if (slot==30 || slot==70) beam=3&8; + if (slot==0 || slot==40) beam=0|8; + if (slot==10 || slot==50) beam=1|8; + if (slot==20 || slot==60) beam=2|8; + if (slot==30 || slot==70) beam=3|8; */ flags |= beam<<8; - } + LOG_D(HW,"slot %d, beam %d\n",slot,ru->common.beam_id[0][slot*fp->symbols_per_slot]); + + } + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS, flags ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, slot ); @@ -797,46 +804,94 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { int mu = config->ssb_config.scs_common.value; int N_RB = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value; - if (mu == NR_MU_0) { //or if LTE - if(N_RB == 100) { + if (mu == NR_MU_0) { + switch(N_RB) { + case 270: + if (fp->threequarter_fs) { + cfg->sample_rate=92.16e6; + cfg->samples_per_frame = 921600; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; + } else { + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 614400; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; + } + case 216: + if (fp->threequarter_fs) { + cfg->sample_rate=46.08e6; + cfg->samples_per_frame = 460800; + cfg->tx_bw = 40e6; + cfg->rx_bw = 40e6; + } + else { + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 614400; + cfg->tx_bw = 40e6; + cfg->rx_bw = 40e6; + } + break; + case 106: if (fp->threequarter_fs) { cfg->sample_rate=23.04e6; cfg->samples_per_frame = 230400; - cfg->tx_bw = 10e6; - cfg->rx_bw = 10e6; - } else { + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + } + else { cfg->sample_rate=30.72e6; cfg->samples_per_frame = 307200; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + } + break; + case 52: + if (fp->threequarter_fs) { + cfg->sample_rate=11.52e6; + cfg->samples_per_frame = 115200; cfg->tx_bw = 10e6; cfg->rx_bw = 10e6; } - } else if(N_RB == 50) { - cfg->sample_rate=15.36e6; - cfg->samples_per_frame = 153600; - cfg->tx_bw = 5e6; - cfg->rx_bw = 5e6; - } else if (N_RB == 25) { - cfg->sample_rate=7.68e6; - cfg->samples_per_frame = 76800; - cfg->tx_bw = 2.5e6; - cfg->rx_bw = 2.5e6; - } else if (N_RB == 6) { - cfg->sample_rate=1.92e6; - cfg->samples_per_frame = 19200; - cfg->tx_bw = 1.5e6; - cfg->rx_bw = 1.5e6; - } else AssertFatal(1==0,"Unknown N_RB %d\n",N_RB); + else { + cfg->sample_rate=15.36e6; + cfg->samples_per_frame = 153600; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + case 25: + if (fp->threequarter_fs) { + cfg->sample_rate=5.76e6; + cfg->samples_per_frame = 57600; + cfg->tx_bw = 5e6; + cfg->rx_bw = 5e6; + } + else { + cfg->sample_rate=7.68e6; + cfg->samples_per_frame = 76800; + cfg->tx_bw = 5e6; + cfg->rx_bw = 5e6; + } + break; + default: + AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); + } } else if (mu == NR_MU_1) { - if(N_RB == 273) { + switch(N_RB) { + case 273: if (fp->threequarter_fs) { - AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n"); + cfg->sample_rate=184.32e6; + cfg->samples_per_frame = 1843200; + cfg->tx_bw = 100e6; + cfg->rx_bw = 100e6; } else { cfg->sample_rate=122.88e6; cfg->samples_per_frame = 1228800; cfg->tx_bw = 100e6; cfg->rx_bw = 100e6; } - } else if(N_RB == 217) { + break; + case 217: if (fp->threequarter_fs) { cfg->sample_rate=92.16e6; cfg->samples_per_frame = 921600; @@ -848,7 +903,20 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { cfg->tx_bw = 80e6; cfg->rx_bw = 80e6; } - } else if(N_RB == 106) { + break; + case 133 : + if (fp->threequarter_fs) { + AssertFatal(1==0,"N_RB %d cannot use 3/4 sampling\n",N_RB); + } + else { + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 614400; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; + } + + break; + case 106: if (fp->threequarter_fs) { cfg->sample_rate=46.08e6; cfg->samples_per_frame = 460800; @@ -861,32 +929,69 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { cfg->tx_bw = 40e6; cfg->rx_bw = 40e6; } - } else if(N_RB == 133) { + break; + case 51: if (fp->threequarter_fs) { - AssertFatal(1==0,"N_RB %d cannot use 3/4 sampling\n",N_RB); + cfg->sample_rate=23.04e6; + cfg->samples_per_frame = 230400; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; } else { + cfg->sample_rate=30.72e6; + cfg->samples_per_frame = 307200; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + } + break; + case 24: + if (fp->threequarter_fs) { + cfg->sample_rate=11.52e6; + cfg->samples_per_frame = 115200; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + else { + cfg->sample_rate=15.36e6; + cfg->samples_per_frame = 153600; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + break; + default: + AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); + } + } else if (mu == NR_MU_3) { + switch(N_RB) { + case 66: + if (fp->threequarter_fs) { + cfg->sample_rate=184.32e6; + cfg->samples_per_frame = 1843200; + cfg->tx_bw = 100e6; + cfg->rx_bw = 100e6; + } else { + cfg->sample_rate = 122.88e6; + cfg->samples_per_frame = 1228800; + cfg->tx_bw = 100e6; + cfg->rx_bw = 100e6; + } + break; + case 32: + if (fp->threequarter_fs) { + cfg->sample_rate=92.16e6; + cfg->samples_per_frame = 921600; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; + } else { cfg->sample_rate=61.44e6; cfg->samples_per_frame = 614400; cfg->tx_bw = 50e6; cfg->rx_bw = 50e6; } - - } else { + break; + default: AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); } - } else if (mu == NR_MU_3) { - if (N_RB == 66) { - cfg->sample_rate = 122.88e6; - cfg->samples_per_frame = 1228800; - cfg->tx_bw = 100e6; - cfg->rx_bw = 100e6; - } else if(N_RB == 32) { - cfg->sample_rate=61.44e6; - cfg->samples_per_frame = 614400; - cfg->tx_bw = 50e6; - cfg->rx_bw = 50e6; - } } else { AssertFatal(0 == 1,"Numerology %d not supported for the moment\n",mu); } @@ -932,60 +1037,52 @@ int setup_RU_buffers(RU_t *ru) { int i,j; int card,ant; //uint16_t N_TA_offset = 0; - NR_DL_FRAME_PARMS *frame_parms; + NR_DL_FRAME_PARMS *fp; nfapi_nr_config_request_scf_t *config = &ru->config; if (ru) { - frame_parms = ru->nr_frame_parms; - printf("setup_RU_buffers: frame_parms = %p\n",frame_parms); + fp = ru->nr_frame_parms; + printf("setup_RU_buffers: frame_parms = %p\n",fp); } else { printf("ru pointer is NULL\n"); return(-1); } + int mu = config->ssb_config.scs_common.value; int N_RB = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value; - if (config->cell_config.frame_duplex_type.value == TDD) { int N_TA_offset = config->carrier_config.uplink_frequency.value < 6000000 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2 double factor=1; - switch (mu) { - case 0: //15 kHz scs - AssertFatal(N_TA_offset == 400,"scs_common 15kHz only for FR1\n"); - if (N_RB <= 25) factor = .25; // 7.68 Ms/s - else if (N_RB <=50) factor = .5; // 15.36 Ms/s - else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s - else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s - else AssertFatal(1==0,"Too many PRBS for mu=0\n"); - break; - case 1: //30 kHz sc - AssertFatal(N_TA_offset == 400,"scs_common 30kHz only for FR1\n"); - if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s - else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s - break; - case 2: //60 kHz scs - AssertFatal(1==0,"scs_common should not be 60 kHz\n"); - break; - case 3: //120 kHz scs - AssertFatal(N_TA_offset == 431,"scs_common 120kHz only for FR2\n"); - break; - case 4: //240 kHz scs - AssertFatal(1==0,"scs_common should not be 60 kHz\n"); - if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s - else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s - else AssertFatal(1==0,"N_RB %d is too big for curretn FR2 implementation\n",N_RB); - break; - - if (N_RB == 100) ru->N_TA_offset = 624; - else if (N_RB == 50) ru->N_TA_offset = 624/2; - else if (N_RB == 25) ru->N_TA_offset = 624/4; + case 0: //15 kHz scs + AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n"); + factor = fp->samples_per_subframe / 30720.0; + break; + case 1: //30 kHz sc + AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n"); + factor = fp->samples_per_subframe / 30720.0; + break; + case 2: //60 kHz scs + AssertFatal(1==0, "scs_common should not be 60 kHz\n"); + break; + case 3: //120 kHz scs + AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; + break; + case 4: //240 kHz scs + AssertFatal(N_TA_offset == 431, "scs_common 240kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; + break; + default: + AssertFatal(1==0, "Invalid scs_common!\n"); } - if (frame_parms->threequarter_fs == 1) factor = factor*.75; + ru->N_TA_offset = (int)(N_TA_offset * factor); - LOG_I(PHY,"RU %d Setting N_TA_offset to %d samples (factor %f, UL Freq %d, N_RB %d)\n",ru->idx,ru->N_TA_offset,factor, - config->carrier_config.uplink_frequency.value, N_RB); + + LOG_I(PHY,"RU %d Setting N_TA_offset to %d samples (factor %f, UL Freq %d, N_RB %d, mu %d)\n",ru->idx,ru->N_TA_offset,factor, + config->carrier_config.uplink_frequency.value, N_RB, mu); } else ru->N_TA_offset = 0; @@ -1258,12 +1355,17 @@ void *ru_thread( void *param ) { for (aa=0;aa<ru->nb_rx;aa++) memcpy((void*)RC.gNB[0]->common_vars.rxdataF[aa], (void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t)); - + if (IS_SOFTMODEM_DOSCOPE && RC.gNB[0]->scopeData) + ((scopeData_t*)RC.gNB[0]->scopeData)->slotFunc(ru->common.rxdataF[0],proc->tti_rx, RC.gNB[0]->scopeData); // Do PRACH RU processing int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); uint8_t prachStartSymbol,N_dur; if (prach_id>=0) { + + T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0), + T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2)); + N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt); /* get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value, @@ -1643,11 +1745,9 @@ void set_function_spec_param(RU_t *ru) { ru->nr_start_if = NULL; // no if interface ru->rfdevice.host_type = RAU_HOST; - // FK this here looks messed up. The following lines should be part of the if (ru->function == gNodeB_3GPP), shouldn't they? - - ru->fh_south_in = rx_rf; // local synchronous RF RX - ru->fh_south_out = tx_rf; // local synchronous RF TX - ru->start_rf = start_rf; // need to start the local RF interface + ru->fh_south_in = rx_rf; // local synchronous RF RX + 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); @@ -1859,37 +1959,39 @@ void RCconfig_RU(void) if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) { if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) { RC.ru[j]->openair0_cfg.clock_source = internal; - LOG_D(PHY, "RU clock source set as internal\n"); + LOG_I(PHY, "RU clock source set as internal\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) { RC.ru[j]->openair0_cfg.clock_source = external; - LOG_D(PHY, "RU clock source set as external\n"); + LOG_I(PHY, "RU clock source set as external\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) { RC.ru[j]->openair0_cfg.clock_source = gpsdo; - LOG_D(PHY, "RU clock source set as gpsdo\n"); + LOG_I(PHY, "RU clock source set as gpsdo\n"); } else { LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); } } else { - RC.ru[j]->openair0_cfg.clock_source = unset; + LOG_I(PHY,"Setting clock source to internal\n"); + RC.ru[j]->openair0_cfg.clock_source = internal; } if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) { if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) { RC.ru[j]->openair0_cfg.time_source = internal; - LOG_D(PHY, "RU time source set as internal\n"); + LOG_I(PHY, "RU time source set as internal\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) { RC.ru[j]->openair0_cfg.time_source = external; - LOG_D(PHY, "RU time source set as external\n"); + LOG_I(PHY, "RU time source set as external\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) { RC.ru[j]->openair0_cfg.time_source = gpsdo; - LOG_D(PHY, "RU time source set as gpsdo\n"); + LOG_I(PHY, "RU time source set as gpsdo\n"); } else { LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); } } else { - RC.ru[j]->openair0_cfg.time_source = unset; + LOG_I(PHY,"Setting time source to internal\n"); + RC.ru[j]->openair0_cfg.time_source = internal; } if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) { diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 500819e6844016ea2829d7b0472a8358fff9f70b..813ffcf8fac29f3060f72dbe74057fb8cb03755a 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -68,11 +68,15 @@ #define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n" #define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n" #define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n" -#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n" +#define CONFIG_HLP_DLMCS_PHYTEST "Set the downlink MCS for PHYTEST mode\n" #define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n" #define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n" #define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n" -#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n" +#define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n" +#define CONFIG_HLP_DLBW_PHYTEST "Set the number of PRBs used for DLSCH in PHYTEST mode\n" +#define CONFIG_HLP_ULBW_PHYTEST "Set the number of PRBs used for ULSCH in PHYTEST mode\n" +#define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n" +#define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n" #define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n" #define CONFIG_HLP_UE "Set the lte softmodem as a UE\n" #define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 924c32b8a7cddc7d09f06b68f811b1b315ad6f65..c7e636736b92e6b1a043ed8dff6effd0c98eebb4 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -85,6 +85,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "x2ap_eNB.h" #include "ngap_gNB.h" #include "gnb_paramdef.h" +#include <openair3/ocp-gtpu/gtp_itf.h> #include "nfapi/oai_integration/vendor_ext.h" pthread_cond_t nfapi_sync_cond; @@ -92,7 +93,7 @@ pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex extern uint8_t nfapi_mode; // Default to monolithic mode - +THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. @@ -114,7 +115,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; //Temp fix for inexistent NR upper layer unsigned char NB_gNB_INST = 1; -static char *itti_dump_file = NULL; int UE_scan = 1; int UE_scan_carrier = 0; @@ -136,9 +136,6 @@ double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}}; double rx_gain_off = 0.0; -double sample_rate=30.72e6; -double bw = 10.0e6; - static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/; @@ -163,8 +160,6 @@ int otg_enabled; //static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; //static nfapi_nr_config_request_t *config[MAX_NUM_CCs]; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; uint32_t timing_advance = 0; uint64_t num_missed_slots=0; // counter for the number of missed slots @@ -182,7 +177,6 @@ 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; @@ -344,7 +338,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { } - if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0 && get_softmodem_params()->sa==0)) { + if (AMF_MODE_ENABLED) { if (gnb_nb > 0) { /* if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { @@ -369,21 +363,45 @@ int create_gNB_tasks(uint32_t gnb_nb) { } } - if (itti_create_task (TASK_GTPV1_U, >pv1u_gNB_task, NULL) < 0) { + if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) { LOG_E(GTPU, "Create task for GTPV1U failed\n"); return -1; } } } + if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==1)){ + if (gnb_nb > 0) { + if(NGAP_CONF_MODE){ + if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) { + LOG_E(NGAP, "Create task for NGAP failed\n"); + return -1; + } + } else { + LOG_E(NGAP, "Ngap task not created\n"); + } + + if(!emulate_rf){ + if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { + LOG_E(UDP_, "Create task for UDP failed\n"); + return -1; + } + } + + if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) { + LOG_E(GTPU, "Create task for GTPV1U failed\n"); + return -1; + } + } + } if (gnb_nb > 0) { if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) { LOG_E(GNB_APP, "Create task for gNB APP failed\n"); return -1; } - LOG_I(NR_RRC,"Creating NR RRC gNB Task\n"); + LOG_I(NR_RRC,"Creating NR RRC gNB Task\n"); if (itti_create_task (TASK_RRC_GNB, rrc_gnb_task, NULL) < 0) { LOG_E(NR_RRC, "Create task for NR RRC gNB failed\n"); return -1; @@ -476,93 +494,6 @@ void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], } } -/* -void init_openair0(void) { - - int card; - int i; - - for (card=0; card<MAX_CARDS; card++) { - - openair0_cfg[card].mmapped_dma=mmapped_dma; - openair0_cfg[card].configFilename = NULL; - - if(config[0]->rf_config.dl_carrier_bandwidth.value == 100) { - if (frame_parms[0]->threequarter_fs) { - openair0_cfg[card].sample_rate=23.04e6; - openair0_cfg[card].samples_per_frame = 230400; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; - } else { - openair0_cfg[card].sample_rate=30.72e6; - openair0_cfg[card].samples_per_frame = 307200; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; - } - } else if(config[0]->rf_config.dl_carrier_bandwidth.value == 50) { - openair0_cfg[card].sample_rate=15.36e6; - openair0_cfg[card].samples_per_frame = 153600; - openair0_cfg[card].tx_bw = 5e6; - openair0_cfg[card].rx_bw = 5e6; - } else if (config[0]->rf_config.dl_carrier_bandwidth.value == 25) { - openair0_cfg[card].sample_rate=7.68e6; - openair0_cfg[card].samples_per_frame = 76800; - openair0_cfg[card].tx_bw = 2.5e6; - openair0_cfg[card].rx_bw = 2.5e6; - } else if (config[0]->rf_config.dl_carrier_bandwidth.value == 6) { - openair0_cfg[card].sample_rate=1.92e6; - openair0_cfg[card].samples_per_frame = 19200; - openair0_cfg[card].tx_bw = 1.5e6; - openair0_cfg[card].rx_bw = 1.5e6; - } - - - if (config[0]->subframe_config.duplex_mode.value==TDD) - openair0_cfg[card].duplex_mode = duplex_mode_TDD; - else //FDD - openair0_cfg[card].duplex_mode = duplex_mode_FDD; - - printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card, - RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value, - RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - openair0_cfg[card].Mod_id = 0; - - openair0_cfg[card].num_rb_dl=config[0]->rf_config.dl_carrier_bandwidth.value; - - openair0_cfg[card].clock_source = clock_source; - - - openair0_cfg[card].tx_num_channels=min(2,RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - openair0_cfg[card].rx_num_channels=min(2,RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - - for (i=0; i<4; i++) { - - if (i<openair0_cfg[card].tx_num_channels) - openair0_cfg[card].tx_freq[i] = downlink_frequency[0][i] ; - else - openair0_cfg[card].tx_freq[i]=0.0; - - if (i<openair0_cfg[card].rx_num_channels) - openair0_cfg[card].rx_freq[i] =downlink_frequency[0][i] + uplink_frequency_offset[0][i] ; - else - openair0_cfg[card].rx_freq[i]=0.0; - - openair0_cfg[card].autocal[i] = 1; - openair0_cfg[card].tx_gain[i] = tx_gain[0][i]; - openair0_cfg[card].rx_gain[i] = RC.gNB[0]->rx_total_gain_dB; - - - openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file; - printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", - card,i, openair0_cfg[card].tx_gain[i], - openair0_cfg[card].rx_gain[i], - openair0_cfg[card].tx_freq[i], - openair0_cfg[card].rx_freq[i]); - } - } // for loop on cards -} -*/ - void wait_RUs(void) { LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask); // wait for all RUs to be configured over fronthaul @@ -710,33 +641,37 @@ static void wait_nfapi_init(char *thread_name) { } void init_pdcp(void) { - //if (!NODE_IS_DU(RC.rrc[0]->node_type)) { - pdcp_layer_init(); - uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? - (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; - - if (IS_SOFTMODEM_NOS1) { - printf("IS_SOFTMODEM_NOS1 option enabled \n"); - pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ; - } + if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) { + // pdcp_layer_init(); + // pdcp_layer_init_for_CU(); + uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? + (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; + if (IS_SOFTMODEM_NOS1) { + printf("IS_SOFTMODEM_NOS1 option enabled \n"); + pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT; + } - pdcp_module_init(pdcp_initmask); + pdcp_module_init(pdcp_initmask); - /*if (NODE_IS_CU(RC.rrc[0]->node_type)) { - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); - } else {*/ - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); - //} - /*} else { + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n"); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); + } else { + LOG_I(PDCP, "node is gNB \n"); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); + pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + } + } else { + LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); - }*/ + } } int main( int argc, char **argv ) { int ru_id, CC_id = 0; + start_background_system(); ///static configuration for NR at the moment @@ -762,8 +697,8 @@ int main( int argc, char **argv ) } openair0_cfg[0].threequarter_fs = threequarter_fs; - AMF_MODE_ENABLED = !IS_SOFTMODEM_NOS1; //!get_softmodem_params()->phy_test; - NGAP_CONF_MODE = !IS_SOFTMODEM_NOS1; //!get_softmodem_params()->phy_test; + AMF_MODE_ENABLED = get_softmodem_params()->sa; + NGAP_CONF_MODE = get_softmodem_params()->sa; if (get_softmodem_params()->do_ra) AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); @@ -804,16 +739,19 @@ if(!IS_SOFTMODEM_NOS1) #endif LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); + if(IS_SOFTMODEM_NOS1) init_pdcp(); - if (RC.nb_nr_inst > 0) { + if (RC.nb_nr_L1_inst > 0) + RCconfig_NR_L1(); + // don't create if node doesn't connect to RRC/S1/GTP AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n"); - } else { - printf("No ITTI, Initializing L1\n"); - RCconfig_NR_L1(); - } + + + + /* Start the agent. If it is turned off in the configuration, it won't start */ /* @@ -894,36 +832,38 @@ if(!IS_SOFTMODEM_NOS1) wait_nfapi_init("main?"); } - printf("wait RUs\n"); - wait_RUs(); - printf("ALL RUs READY!\n"); - printf("RC.nb_RU:%d\n", RC.nb_RU); - // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration) - printf("ALL RUs ready - init gNBs\n"); - if(IS_SOFTMODEM_DOFORMS) { - sleep(1); - scopeParms_t p; - p.argc=&argc; - p.argv=argv; - p.gNB=RC.gNB[0]; - p.ru=RC.ru[0]; - load_softscope("nr",&p); - } + if (RC.nb_nr_L1_inst > 0) { + printf("wait RUs\n"); + wait_RUs(); + printf("ALL RUs READY!\n"); + printf("RC.nb_RU:%d\n", RC.nb_RU); + // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration) + printf("ALL RUs ready - init gNBs\n"); + if(IS_SOFTMODEM_DOSCOPE) { + sleep(1); + scopeParms_t p; + p.argc=&argc; + p.argv=argv; + p.gNB=RC.gNB[0]; + p.ru=RC.ru[0]; + load_softscope("nr",&p); + } - if (NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_VNF) { - printf("Not NFAPI mode - call init_eNB_afterRU()\n"); - init_eNB_afterRU(); - } else { - printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n"); - } + if (NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_VNF) { + printf("Not NFAPI mode - call init_eNB_afterRU()\n"); + init_eNB_afterRU(); + } else { + printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n"); + } - printf("ALL RUs ready - ALL gNBs ready\n"); - // connect the TX/RX buffers - printf("Sending sync to all threads\n"); - pthread_mutex_lock(&sync_mutex); - sync_var=0; - pthread_cond_broadcast(&sync_cond); - pthread_mutex_unlock(&sync_mutex); + printf("ALL RUs ready - ALL gNBs ready\n"); + // connect the TX/RX buffers + printf("Sending sync to all threads\n"); + pthread_mutex_lock(&sync_mutex); + sync_var=0; + pthread_cond_broadcast(&sync_cond); + pthread_mutex_unlock(&sync_mutex); + } printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); end_configmodule(); printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); @@ -961,7 +901,10 @@ if(!IS_SOFTMODEM_NOS1) printf("stopping MODEM threads\n"); // cleanup stop_gNB(NB_gNB_INST); - stop_RU(NB_RU); + + if (RC.nb_nr_L1_inst > 0) { + stop_RU(NB_RU); + } /* release memory used by the RU/gNB threads (incomplete), after all * threads have been stopped (they partially use the same memory) */ diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index d6cfe6b906acef4026dcf08d7b03433b32fd1986..928558013c8e6bd3dbc6bbfc4fdecbdadb5b7a43 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -18,19 +18,27 @@ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_PARAMS_DESC_GNB { \ - {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ - {"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \ - {"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ - {"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ + {"m" , CONFIG_HLP_DLMCS_PHYTEST,0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ + {"t" , CONFIG_HLP_ULMCS_PHYTEST,0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ + {"M" , CONFIG_HLP_DLBW_PHYTEST,0, uptr:&target_dl_bw, defintval:0, TYPE_UINT, 0}, \ + {"T" , CONFIG_HLP_ULBW_PHYTEST,0, uptr:&target_ul_bw, defintval:0, TYPE_UINT, 0}, \ + {"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \ + {"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 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}, \ } #include "threads_t.h" extern threads_t threads; +extern uint32_t target_dl_mcs; +extern uint32_t target_ul_mcs; +extern uint32_t target_dl_bw; +extern uint32_t target_ul_bw; +extern uint64_t dlsch_slot_bitmap; +extern uint64_t ulsch_slot_bitmap; // In nr-gnb.c extern void init_gNB(int single_thread_flag,int wait_for_sync); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index dd1107168244e44225399f7af41c87cc29146df7..76a7f36439c736c567476886fe8c86c995947f69 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -85,12 +85,6 @@ * */ -#ifndef NO_RAT_NR - #define DURATION_RX_TO_TX (NR_UE_CAPABILITY_SLOT_RX_TO_TX) /* for NR this will certainly depends to such UE capability which is not yet defined */ -#else - #define DURATION_RX_TO_TX (6) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */ -#endif - typedef enum { pss = 0, pbch = 1, @@ -237,43 +231,6 @@ static void UE_synch(void *arg) { openair0_cfg[UE->rf_map.card].rx_freq[0], openair0_cfg[UE->rf_map.card].tx_freq[0]); - // reconfigure for potentially different bandwidth - switch(UE->frame_parms.N_RB_DL) { - case 6: - openair0_cfg[UE->rf_map.card].sample_rate =1.92e6; - openair0_cfg[UE->rf_map.card].rx_bw =.96e6; - openair0_cfg[UE->rf_map.card].tx_bw =.96e6; - // openair0_cfg[0].rx_gain[0] -= 12; - break; - - case 25: - openair0_cfg[UE->rf_map.card].sample_rate =7.68e6; - openair0_cfg[UE->rf_map.card].rx_bw =2.5e6; - openair0_cfg[UE->rf_map.card].tx_bw =2.5e6; - // openair0_cfg[0].rx_gain[0] -= 6; - break; - - case 50: - openair0_cfg[UE->rf_map.card].sample_rate =15.36e6; - openair0_cfg[UE->rf_map.card].rx_bw =5.0e6; - openair0_cfg[UE->rf_map.card].tx_bw =5.0e6; - // openair0_cfg[0].rx_gain[0] -= 3; - break; - - case 100: - openair0_cfg[UE->rf_map.card].sample_rate=30.72e6; - openair0_cfg[UE->rf_map.card].rx_bw=10.0e6; - openair0_cfg[UE->rf_map.card].tx_bw=10.0e6; - // openair0_cfg[0].rx_gain[0] -= 0; - break; - - case 66: - openair0_cfg[UE->rf_map.card].sample_rate=122.88e6; - openair0_cfg[UE->rf_map.card].rx_bw=100.e6; - openair0_cfg[UE->rf_map.card].tx_bw=100.e6; - break; - } - if (UE->mode != loop_through_memory) { UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); @@ -321,6 +278,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx); uint8_t gNB_id = 0; + LOG_D(PHY,"%d.%d => slot type %d\n",proc->frame_tx,proc->nr_slot_tx,tx_slot_type); if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){ // trigger L2 to run ue_scheduler thru IF module @@ -370,11 +328,19 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500); #endif - if(IS_SOFTMODEM_NOS1){ + if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa){ NR_UE_MAC_INST_t *mac = get_mac_inst(0); protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); pdcp_run(&ctxt); + + /* send tick to RLC and PDCP every ms */ + if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) { + void nr_rlc_tick(int frame, int subframe); + void nr_pdcp_tick(int frame, int subframe); + nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); + nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); + } } } @@ -669,8 +635,8 @@ void *UE_thread(void *arg) { } curMsg->proc.timestamp_tx = timestamp+ - UE->frame_parms.get_samples_slot_timestamp(slot_nr, - &UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp; + UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX) + - firstSymSamp; notifiedFIFO_elt_t *res; @@ -692,8 +658,10 @@ void *UE_thread(void *arg) { decoded_frame_rx, curMsg->proc.frame_rx ); // use previous timing_advance value to compute writeTimestamp - writeTimestamp = timestamp + UE->frame_parms.get_samples_slot_timestamp(slot_nr, &UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) - - firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance; + writeTimestamp = timestamp+ + UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX + - RX_NB_TH) - firstSymSamp - openair0_cfg[0].tx_sample_advance - + UE->N_TA_offset - timing_advance; // but use current UE->timing_advance value to compute writeBlockSize if (UE->timing_advance != timing_advance) { @@ -707,7 +675,11 @@ void *UE_thread(void *arg) { if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) { uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots; - int nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + int nrofUplinkSlots = 0; + if (mac->scc_SIB) + nrofUplinkSlots = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + else if (mac->scc) + nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSlots != 0); uint8_t first_tx_slot = tdd_period - num_UL_slots; @@ -722,13 +694,13 @@ void *UE_thread(void *arg) { } if (flags || IS_SOFTMODEM_RFSIM) - AssertFatal( writeBlockSize == - UE->rfdevice.trx_write_func(&UE->rfdevice, - writeTimestamp, - txp, - writeBlockSize, - UE->frame_parms.nb_antennas_tx, - flags),""); + AssertFatal(writeBlockSize == + UE->rfdevice.trx_write_func(&UE->rfdevice, + writeTimestamp, + txp, + writeBlockSize, + UE->frame_parms.nb_antennas_tx, + flags),""); for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++) memset(txp[i], 0, writeBlockSize); @@ -768,23 +740,6 @@ void init_NR_UE(int nb_inst, char* rrc_config_path) { AssertFatal((rrc_inst = nr_l3_init_ue(rrc_config_path)) != NULL, "can not initialize RRC module\n"); AssertFatal((mac_inst = nr_l2_init_ue(rrc_inst)) != NULL, "can not initialize L2 module\n"); AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n"); - - NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; - if (mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; - } - else if (mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; - } - - if (pusch_TimeDomainAllocationList) { - for(int i = 0; i < pusch_TimeDomainAllocationList->list.count; i++) { - AssertFatal(*pusch_TimeDomainAllocationList->list.array[i]->k2 >= DURATION_RX_TO_TX, - "Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d)\n", - *pusch_TimeDomainAllocationList->list.array[i]->k2, - DURATION_RX_TO_TX); - } - } } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 451dcd3d29d373d0f10aa152ec52f85854f9c86f..531c1bbf4bf4910e47cfa78fff436860ecf7b46b 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -87,7 +87,12 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "executables/softmodem-common.h" #include "executables/thread-common.h" +#if defined(ITTI_SIM) || defined(RFSIM_NAS) +#include "nr_nas_msg_sim.h" +#endif + extern const char *duplex_mode[]; +THREAD_STRUCT thread_struct; // Thread variables pthread_cond_t nfapi_sync_cond; @@ -146,10 +151,9 @@ int card_offset = 0; 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; int oaisim_flag = 0; int emulate_rf = 0; - +uint32_t N_RB_DL=106; char uecap_xer[1024],uecap_xer_in=0; /* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed @@ -179,6 +183,27 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) { void print_difftimes(void) { LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec); } +int create_tasks_nrue(uint32_t ue_nb) { + LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb); + itti_wait_ready(1); + + if (ue_nb > 0) { + LOG_I(NR_RRC,"create TASK_RRC_NRUE \n"); + if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) { + LOG_E(NR_RRC, "Create task for RRC UE failed\n"); + return -1; + } +#if defined(ITTI_SIM) || defined(RFSIM_NAS) + if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) { + LOG_E(NR_RRC, "Create task for NAS UE failed\n"); + return -1; + } +#endif + } + + itti_wait_ready(0); + return 0; +} void exit_function(const char *file, const char *function, const int line, const char *s) { int CC_id; @@ -303,8 +328,8 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ LOG_I(PHY, "Set UE frame_type %d\n", fp->frame_type); } - LOG_I(PHY, "Set UE N_RB_DL %d\n", fp->N_RB_DL); - + LOG_I(PHY, "Set UE N_RB_DL %d\n", N_RB_DL); + fp->N_RB_DL = N_RB_DL; LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs); } @@ -316,92 +341,10 @@ void init_openair0(void) { for (card=0; card<MAX_CARDS; card++) { uint64_t dl_carrier, ul_carrier; - openair0_cfg[card].configFilename = NULL; - openair0_cfg[card].threequarter_fs = frame_parms->threequarter_fs; - numerology = frame_parms->numerology_index; - - if(frame_parms->N_RB_DL == 66) { - if (numerology==3) { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } else { - LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); - exit(-1); - } - }else if(frame_parms->N_RB_DL == 32) { - if (numerology==3) { - openair0_cfg[card].sample_rate=61.44e6; - openair0_cfg[card].samples_per_frame = 614400; - } else { - LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); - exit(-1); - } - }else if(frame_parms->N_RB_DL == 217) { - if (numerology==1) { - if (frame_parms->threequarter_fs) { - openair0_cfg[card].sample_rate=92.16e6; - openair0_cfg[card].samples_per_frame = 921600; - } - else { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } - } else { - LOG_E(PHY,"Unsupported numerology!\n"); - exit(-1); - } - } else if(frame_parms->N_RB_DL == 273) { - if (numerology==1) { - if (frame_parms->threequarter_fs) { - AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n"); - } - else { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } - } else { - LOG_E(PHY,"Unsupported numerology!\n"); - exit(-1); - } - } else if(frame_parms->N_RB_DL == 106) { - if (numerology==0) { - if (frame_parms->threequarter_fs) { - openair0_cfg[card].sample_rate=23.04e6; - openair0_cfg[card].samples_per_frame = 230400; - } else { - openair0_cfg[card].sample_rate=30.72e6; - openair0_cfg[card].samples_per_frame = 307200; - } - } else if (numerology==1) { - if (frame_parms->threequarter_fs) { - openair0_cfg[card].sample_rate=46.08e6; - openair0_cfg[card].samples_per_frame = 460800; - } - else { - openair0_cfg[card].sample_rate=61.44e6; - openair0_cfg[card].samples_per_frame = 614400; - } - } else if (numerology==2) { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } else { - LOG_E(PHY,"Unsupported numerology!\n"); - exit(-1); - } - } else if(frame_parms->N_RB_DL == 50) { - openair0_cfg[card].sample_rate=15.36e6; - openair0_cfg[card].samples_per_frame = 153600; - } else if (frame_parms->N_RB_DL == 25) { - openair0_cfg[card].sample_rate=7.68e6; - openair0_cfg[card].samples_per_frame = 76800; - } else if (frame_parms->N_RB_DL == 6) { - openair0_cfg[card].sample_rate=1.92e6; - openair0_cfg[card].samples_per_frame = 19200; - } - else { - LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms->N_RB_DL); - exit(-1); - } + openair0_cfg[card].configFilename = NULL; + openair0_cfg[card].threequarter_fs = frame_parms->threequarter_fs; + openair0_cfg[card].sample_rate = frame_parms->samples_per_subframe * 1e3; + openair0_cfg[card].samples_per_frame = frame_parms->samples_per_frame; if (frame_parms->frame_type==TDD) openair0_cfg[card].duplex_mode = duplex_mode_TDD; @@ -415,8 +358,9 @@ void init_openair0(void) { openair0_cfg[card].tx_num_channels = min(2, frame_parms->nb_antennas_tx); openair0_cfg[card].rx_num_channels = min(2, frame_parms->nb_antennas_rx); - LOG_I(PHY, "HW: Configuring card %d, tx/rx num_channels %d/%d, duplex_mode %s\n", + LOG_I(PHY, "HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %s\n", card, + openair0_cfg[card].sample_rate, openair0_cfg[card].tx_num_channels, openair0_cfg[card].rx_num_channels, duplex_mode[openair0_cfg[card].duplex_mode]); @@ -447,10 +391,10 @@ void init_pdcp(void) { } pdcp_layer_init(); nr_DRB_preconfiguration();*/ + pdcp_layer_init(); pdcp_module_init(pdcp_initmask); pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); - LOG_I(PDCP, "Before getting out from init_pdcp() \n"); } // Stupid function addition because UE itti messages queues definition is common with eNB @@ -500,8 +444,12 @@ int main( int argc, char **argv ) { #endif LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); + RC.nrrrc = (gNB_RRC_INST **)malloc(1*sizeof(gNB_RRC_INST *)); + RC.nrrrc[0] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST)); + RC.nrrrc[0]->node_type = ngran_gNB; + init_NR_UE(1,rrc_config_path); - if(IS_SOFTMODEM_NOS1) + if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) init_pdcp(); NB_UE_INST=1; @@ -529,8 +477,20 @@ int main( int argc, char **argv ) { mac->if_module->phy_config_request(&mac->phy_config); fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; + if (get_softmodem_params()->sa) { // set frame config to initial values from command line and assume that the SSB is centered on the grid + nrUE_config->ssb_config.scs_common = get_softmodem_params()->numerology; + nrUE_config->carrier_config.dl_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL; + nrUE_config->carrier_config.ul_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL; + nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; + nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; + nrUE_config->cell_config.frame_duplex_type = TDD; + nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1; - nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); + + } + + nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, + mac->scc == NULL ? 78 : *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); init_symbol_rotation(&UE[CC_id]->frame_parms); init_nr_ue_vars(UE[CC_id], 0, abstraction_flag); @@ -552,7 +512,7 @@ int main( int argc, char **argv ) { configure_linux(); mlockall(MCL_CURRENT | MCL_FUTURE); - if(IS_SOFTMODEM_DOFORMS) { + if(IS_SOFTMODEM_DOSCOPE) { load_softscope("nr",PHY_vars_UE_g[0][0]); } @@ -562,6 +522,20 @@ int main( int argc, char **argv ) { // wait for end of program printf("TYPE <CTRL-C> TO TERMINATE\n"); + + //Don't understand why generation of RRCSetupRequest is called here. It seems wrong + protocol_ctxt_t ctxt_pP = {0}; + ctxt_pP.enb_flag = ENB_FLAG_NO; + ctxt_pP.rnti = 0x1234; + RC.nrrrc = (gNB_RRC_INST **)malloc(1*sizeof(gNB_RRC_INST *)); + RC.nrrrc[0] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST)); + RC.nrrrc[0]->node_type = ngran_gNB; + nr_rrc_ue_generate_RRCSetupRequest(ctxt_pP.module_id, 0); + if (create_tasks_nrue(1) < 0) { + printf("cannot create ITTI tasks\n"); + exit(-1); // need a softer mode + } + // Sleep a while before checking all parameters have been used // Some are used directly in external threads, asynchronously sleep(20); diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 5902c8cca8b30f1fa7bb410db266790bb7b6c6fc..5ef6bffd7ed529d3c9d9a55ed2f93d7b3358d8db 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -55,7 +55,7 @@ {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \ {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \ {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \ - {"r" , CONFIG_HLP_PRB, 0, iptr:&(fp->N_RB_DL), defintval:25, TYPE_UINT, 0}, \ + {"r" , CONFIG_HLP_PRB, 0, uptr:&(N_RB_DL), defuintval:160, TYPE_UINT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 4ddc7870d9c7f06301ba66752a0a4039d3f8fe50..326f7d277f7df5c5ff20f09da30d174d63d8f605 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -61,8 +61,6 @@ uint32_t do_forms=0; unsigned int mmapped_dma=0; int8_t threequarter_fs=0; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; int chain_offset=0; uint16_t sl_ahead=6; uint16_t sf_ahead=6; @@ -70,16 +68,15 @@ uint32_t timing_advance = 0; int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; int config_sync_var=-1; pthread_mutex_t nfapi_sync_mutex; pthread_cond_t nfapi_sync_cond; int nfapi_sync_var=-1; -uint8_t nfapi_mode = NFAPI_MONOLITHIC; // Default to monolithic mode double cpuf; +THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; @@ -95,7 +92,8 @@ time_stats_t nfapi_meas; // total tx time time_stats_t softmodem_stats_rx_sf; // total rx time // not used but needed for link openair0_config_t openair0_cfg[MAX_CARDS]; - +uint16_t slot_ahead=6; +msc_interface_t msc_interface; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; int flexran_agent_start(mid_t mod_id) { @@ -122,7 +120,6 @@ int restart_L1L2(module_id_t gnb_id) { } static int wait_for_sync = 0; -static char *itti_dump_file = NULL; static double snr_dB=20; static int DEFBANDS[] = {7}; static int DEFENBS[] = {0}; @@ -996,7 +993,7 @@ int main( int argc, char **argv ) { (void *)NULL, "time_meas", -1, OAI_PRIORITY_RT_LOW); } - if(IS_SOFTMODEM_DOFORMS) { + if(IS_SOFTMODEM_DOSCOPE) { scopeParms_t tmp= {&argc, argv, &ru, RC.gNB[0]}; load_softscope("nr",&tmp); } diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 1077c0e1ac4ae40c32953758c77424dbda479880..fa6b6747652c18dc5eb4d541d06e3133b3722a0f 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -45,6 +45,8 @@ static softmodem_params_t softmodem_params; char *parallel_config=NULL; char *worker_config=NULL; +msc_interface_t msc_interface; +int usrp_tx_thread = 0; uint8_t nfapi_mode=0; @@ -86,7 +88,7 @@ char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) { void get_common_options(uint32_t execmask) { uint32_t online_log_messages=0; uint32_t glog_level=0 ; - uint32_t start_telnetsrv = 0; + uint32_t start_telnetsrv = 0, start_telnetclt = 0; uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0; uint32_t rfsim = 0, basicsim = 0, do_forms = 0; char *logmem_filename = NULL; @@ -95,21 +97,26 @@ void get_common_options(uint32_t execmask) { checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC; check_execmask(execmask); config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); - config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams, - sizeof(cmdline_logparams)/sizeof(paramdef_t)); - config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL); - - if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) { + + int numparams=sizeof(cmdline_logparams)/sizeof(paramdef_t); + config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,numparams); + config_get( cmdline_logparams,numparams,NULL); + + if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) { set_glog_onlinelog(online_log_messages); } - if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { + if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_LOGL_OPT))) { set_glog(glog_level); } if (start_telnetsrv) { load_module_shlib("telnetsrv",NULL,0,NULL); } + + if (start_telnetclt) { + set_softmodem_optmask(SOFTMODEM_TELNETCLT_BIT); + } if (logmem_filename != NULL && strlen(logmem_filename) > 0) { log_mem_filename = &logmem_filename[0]; @@ -140,7 +147,7 @@ void get_common_options(uint32_t execmask) { } if (do_forms) { - set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT); + set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); } if(parallel_config != NULL) set_parallel_conf(parallel_config); diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 7a7be1de966909c23d3f2e61b6a9a9712b954d31..a2eb66333e0775a736839e608fdb8092d64532eb 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -84,6 +84,7 @@ extern "C" #define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n" #define CONFIG_HLP_NUMEROLOGY "adding numerology for 5G\n" +#define CONFIG_HLP_BAND "band index\n" #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" @@ -91,6 +92,7 @@ extern "C" #define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" +#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -107,6 +109,7 @@ extern "C" #define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag #define CHAIN_OFFSET softmodem_params.chain_offset #define NUMEROLOGY softmodem_params.numerology +#define BAND softmodem_params.band #define EMULATE_RF softmodem_params.emulate_rf #define CLOCK_SOURCE softmodem_params.clock_source #define TIMING_SOURCE softmodem_params.timing_source @@ -117,6 +120,7 @@ extern "C" #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; +extern int usrp_tx_thread; #define CMDLINE_PARAMS_DESC { \ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\ {"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)},\ @@ -135,6 +139,7 @@ extern "C" {"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \ {"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \ + {"band" , CONFIG_HLP_BAND, PARAMFLAG_BOOL, iptr:&BAND, defintval:78, TYPE_INT, 0}, \ {"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \ {"parallel-config", CONFIG_HLP_PARALLEL_CMD, 0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \ {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \ @@ -144,6 +149,7 @@ extern "C" {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \ + {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ } @@ -153,23 +159,22 @@ extern "C" #define CONFIG_HLP_LOGV "Set the global log verbosity \n" #define CONFIG_HLP_TELN "Start embedded telnet server \n" #define CONFIG_HLP_MSC "Enable the MSC tracing utility \n" -/*----------------------------------------------------------------------------------------------------------------------------*/ -/* command line parameters for LOG utility */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*----------------------------------------------------------------------------------------------------------------------------*/ +#define CONFIG_FLOG_OPT "R" +#define CONFIG_LOGL_OPT "g" +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* command line parameters for LOG utility */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ #define START_MSC softmodem_params.start_msc #define CMDLINE_LOGPARAMS_DESC { \ - {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ - {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ - {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ - {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ - {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ + {CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ + {CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ + {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ + {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ + {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ + {"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \ } -#define CMDLINE_ONLINELOG_IDX 0 -#define CMDLINE_GLOGLEVEL_IDX 1 -#define CMDLINE_GLOGVERBO_IDX 2 -#define CMDLINE_STARTTELN_IDX 3 /* check function for global log level */ #define CMDLINE_LOGPARAMS_CHECK_DESC { \ @@ -178,6 +183,7 @@ extern "C" { .s5= {NULL} } , \ { .s5= {NULL} } , \ { .s5= {NULL} } , \ + { .s5= {NULL} } , \ } /***************************************************************************************************************************************/ @@ -188,8 +194,9 @@ extern "C" #define SOFTMODEM_RFSIM_BIT (1<<10) #define SOFTMODEM_BASICSIM_BIT (1<<11) #define SOFTMODEM_SIML1_BIT (1<<12) -#define SOFTMODEM_DOFORMS_BIT (1<<15) +#define SOFTMODEM_DOSCOPE_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) +#define SOFTMODEM_TELNETCLT_BIT (1<<17) #define SOFTMODEM_ENB_BIT (1<<20) #define SOFTMODEM_GNB_BIT (1<<21) #define SOFTMODEM_4GUE_BIT (1<<22) @@ -204,8 +211,9 @@ extern "C" #define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) #define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT) #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) -#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT) +#define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) +#define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT) #define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT) #define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT) #define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT) @@ -226,6 +234,7 @@ typedef struct { int single_thread_flag; //eNodeB only int chain_offset; int numerology; + int band; unsigned int start_msc; uint32_t clock_source; uint32_t timing_source; diff --git a/executables/thread-common.h b/executables/thread-common.h index 6f3af3cfc00f69fef57958f58d3b0a0f193de10b..0aaeb3c30ed04a48ae596ab19852adccee56502d 100644 --- a/executables/thread-common.h +++ b/executables/thread-common.h @@ -3,7 +3,7 @@ #include "PHY/defs_common.h" -THREAD_STRUCT thread_struct; +extern THREAD_STRUCT thread_struct; static inline void set_parallel_conf(char *parallel_conf) { mapping config[]= { diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 4ca02ed929c2f2d5444462135c9cc85e1a61c3fd..5ce66aad89b4952e8e46df0bce9c776ce97ea750 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -73,7 +73,6 @@ extern pthread_mutex_t nfapi_sync_mutex; extern int nfapi_sync_var; extern int sync_var; -char uecap_xer_in; extern void init_eNB_afterRU(void); extern void init_UE_stub(int nb_inst,int,int); @@ -2199,7 +2198,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add pnf.phys[0].udp.tx_port = vnf_p7_port; strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr); - printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n", + printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n", __FUNCTION__,config->vnf_ip_addr, config->vnf_p5_port, pnf.phys[0].local_addr, pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port, @@ -2250,7 +2249,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, pnf.phys[0].udp.tx_port = vnf_p7_port; strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr); - printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n", + printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n", __FUNCTION__, config->vnf_ip_addr, config->vnf_p5_port, pnf.phys[0].local_addr, diff --git a/nfapi/oai_integration/nfapi_pnf.h b/nfapi/oai_integration/nfapi_pnf.h index b3ab7cbdbc874ac08eeba71bb5975bb4a4ce7f44..61d4847ebab2a70196366753135a846d6efb96f5 100644 --- a/nfapi/oai_integration/nfapi_pnf.h +++ b/nfapi/oai_integration/nfapi_pnf.h @@ -21,6 +21,7 @@ #if !defined(NFAPI_PNF_H__) #define NFAPI_PNF_H__ +extern nfapi_ue_release_request_body_t release_rntis; int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); diff --git a/nfapi/open-nFAPI/common/src/debug.c b/nfapi/open-nFAPI/common/src/debug.c index a45d41d7d7218f806869f6fda7dd9c628b893d9a..f53be43223f132a2f43bc3c3d69e2f0760f730e5 100644 --- a/nfapi/open-nFAPI/common/src/debug.c +++ b/nfapi/open-nFAPI/common/src/debug.c @@ -1,76 +1,76 @@ -/* - * Copyright 2017 Cisco Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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. - */ - - -#include <stdio.h> -#include <stdarg.h> -#include <stdint.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <sys/time.h> -#include <sys/types.h> -#include <pthread.h> -#include <syslog.h> - -#include <debug.h> - -#define MAX_MSG_LENGTH 2096 -#define TRACE_HEADER_LENGTH 44 - -void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...); - -// initialize the trace function to 0 -void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg; - -nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO; -//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN; - -void nfapi_set_trace_level(nfapi_trace_level_t new_level) -{ - nfapi_trace_level_g = new_level; -} - -void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...) -{ - char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH]; - uint32_t num_chars; - va_list p_args; - struct timeval tv; - pthread_t tid = pthread_self(); - - (void)gettimeofday(&tv, NULL); - - num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid); - - if (num_chars > TRACE_HEADER_LENGTH) - { - printf("trace_dbg: Error, num_chars is too large: %d", num_chars); - return; - } - - va_start(p_args, format); - if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args))) - { - if (level <= NFAPI_TRACE_WARN) - { - printf("%s", trace_buff); - } - printf("%s", trace_buff); - } - va_end(p_args); -} +/* + * Copyright 2017 Cisco Systems, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + + +#include <stdio.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <sys/time.h> +#include <sys/types.h> +#include <pthread.h> +#include <syslog.h> + +#include <debug.h> + +#define MAX_MSG_LENGTH 2096 +#define TRACE_HEADER_LENGTH 44 + +void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...); + +// initialize the trace function to 0 +void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg; + +nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO; +//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN; + +void nfapi_set_trace_level(nfapi_trace_level_t new_level) +{ + nfapi_trace_level_g = new_level; +} + +void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...) +{ + char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH]; + uint32_t num_chars; + va_list p_args; + struct timeval tv; + pthread_t tid = pthread_self(); + + (void)gettimeofday(&tv, NULL); + + num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid); + + if (num_chars > TRACE_HEADER_LENGTH) + { + printf("trace_dbg: Error, num_chars is too large: %u", num_chars); + return; + } + + va_start(p_args, format); + if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args))) + { + if (level <= NFAPI_TRACE_WARN) + { + printf("%s", trace_buff); + } + printf("%s", trace_buff); + } + va_end(p_args); +} diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h index 0a83c1a27f015a2e0bd5c49960ae515fba602319..8e6bf9a8026ae90dd7d5ab3a0a9d65af53e5f233 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h @@ -14,7 +14,7 @@ /// RX_IND -#define FAPI_NR_RX_PDU_TYPE_MIB 0x01 +#define FAPI_NR_RX_PDU_TYPE_SSB 0x01 #define FAPI_NR_RX_PDU_TYPE_SIB 0x02 #define FAPI_NR_RX_PDU_TYPE_DLSCH 0x03 #define FAPI_NR_DCI_IND 0x04 @@ -45,6 +45,8 @@ #define FAPI_NR_DL_CONFIG_TYPE_DLSCH 0x02 #define FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH 0x03 #define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04 +#define FAPI_NR_DL_CONFIG_TYPE_P_DLSCH 0x05 +#define FAPI_NR_DL_CONFIG_TYPES 0x05 #define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01 #define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02 @@ -59,6 +61,6 @@ #define FAPI_NR_UL_CONFIG_TYPE_PUCCH 0x02 #define FAPI_NR_UL_CONFIG_TYPE_PUSCH 0x03 #define FAPI_NR_UL_CONFIG_TYPE_SRS 0x04 - +#define FAPI_NR_UL_CONFIG_TYPES 0x04 #endif diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 9df9be4cbd4b656be44f4fb282a06cb8dff5148e..8b3cb6eec04a39d8a712130b405d6dc4c7038b4e 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -111,8 +111,8 @@ typedef struct { uint8_t ssb_index; uint8_t ssb_length; uint16_t cell_id; - -} fapi_nr_mib_pdu_t; + uint16_t ssb_start_subcarrier; +} fapi_nr_ssb_pdu_t; typedef struct { uint32_t pdu_length; @@ -124,7 +124,7 @@ typedef struct { uint8_t pdu_type; union { fapi_nr_pdsch_pdu_t pdsch_pdu; - fapi_nr_mib_pdu_t mib_pdu; + fapi_nr_ssb_pdu_t ssb_pdu; fapi_nr_sib_pdu_t sib_pdu; }; } fapi_nr_rx_indication_body_t; @@ -972,7 +972,7 @@ typedef struct typedef struct { - uint32_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) + int ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) uint8_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload uint8_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3 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 bc5e7af45fb98e4c50c938457fed1afec386e7f0..bcb0a94ca838ac9cdca7c32ebcd35202dac4a7b6 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 @@ -357,7 +357,7 @@ typedef struct //table 3-23 typedef struct { - nfapi_uint32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) + nfapi_int32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) nfapi_uint8_tlv_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload nfapi_uint8_tlv_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3 @@ -398,13 +398,13 @@ typedef struct { nfapi_uint32_tlv_t ssb_mask;//Bitmap for actually transmitted SSB. MSB->LSB of first 32 bit number corresponds to SSB 0 to SSB 31 MSB->LSB of second 32 bit number corresponds to SSB 32 to SSB 63 Value for each bit: 0: not transmitted 1: transmitted -} nfapi_nr_ssb_mask_size_2_t; +} nfapi_nr_ssb_mask_list_t; typedef struct { - nfapi_uint8_tlv_t beam_id[64];//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63 + nfapi_uint8_tlv_t beam_id;//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63 -} nfapi_nr_ssb_mask_size_64_t; +} nfapi_nr_ssb_beam_id_list_t; typedef struct { @@ -413,8 +413,8 @@ typedef struct nfapi_uint8_tlv_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160 nfapi_uint8_tlv_t ssb_subcarrier_offset;//ssbSubcarrierOffset or ð‘˜ð‘†ð‘†ðµ (38.211, section 7.4.3.1) Value: 0->31 nfapi_uint32_tlv_t MIB;//MIB payload, where the 24 MSB are used and represent the MIB in [38.331 MIB IE] and represent 0 1 2 3 1 , , , ,..., A− a a a a a [38.212, sec 7.1.1] - nfapi_nr_ssb_mask_size_2_t ssb_mask_list[2]; - nfapi_nr_ssb_mask_size_64_t* ssb_beam_id_list;//64 + nfapi_nr_ssb_mask_list_t ssb_mask_list[2]; + nfapi_nr_ssb_beam_id_list_t ssb_beam_id_list[64]; nfapi_uint8_tlv_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled nfapi_uint8_tlv_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled @@ -678,7 +678,7 @@ typedef struct { } nfapi_nr_slot_indication_scf_t; -// 3.4.2 +// 3.4.2 //for pdcch_pdu: @@ -691,11 +691,10 @@ typedef struct typedef struct { uint16_t pm_idx;//Index to precoding matrix (PM) pre-stored at cell configuration. Note: If precoding is not used this parameter should be set to 0. Value: 0->65535. - nfapi_nr_dig_bf_interface_t* dig_bf_interface_list; + nfapi_nr_dig_bf_interface_t dig_bf_interface_list[1];//max dig_bf_interfaces }nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t; -/* //table 3-43 typedef struct { @@ -703,23 +702,10 @@ typedef struct uint16_t prg_size;//Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275 //watchout: dig_bf_interfaces here, in table 3-53 it's dig_bf_interface uint8_t dig_bf_interfaces;//Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 - nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t* prgs_list;// + nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t prgs_list[1];//max prg_size }nfapi_nr_tx_precoding_and_beamforming_t; -*/ -typedef struct { - /// Number of PRGs spanning this allocation. Value : 1->275 - uint16_t numPRGs; - /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275 - uint16_t prgSize; - /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 - uint8_t digBFInterfaces; - // Depends on numPRGs - uint16_t PMIdx[275]; - // Depends on digBFInterfaces - uint16_t beamIdx[256]; -} nfapi_nr_tx_precoding_and_beamforming_t; //table 3-37 @@ -755,16 +741,6 @@ typedef struct { } nfapi_nr_dl_dci_pdu_t; -typedef struct { - /// Number of PRGs spanning this allocation. Value : 1->275 - uint16_t numPRGs; - /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275 - uint16_t prgSize; - /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 - uint8_t digBFInterfaces; - uint16_t PMIdx[275]; - uint16_t *beamIdx[275]; -} nr_beamforming_t; typedef struct { ///Bandwidth part size [TS38.213 sec12]. Number of contiguous PRBs allocated to the BWP,Value: 1->275 @@ -1028,7 +1004,7 @@ typedef struct { typedef struct { uint16_t PDUType; - uint16_t PDUSize; + uint32_t PDUSize; union { nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu; diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index 837f33fe6f6907436ee3d15346dc9225322ee471..ec59ba39b2681dbee3506343a5fae49bcca84d67 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -1,8269 +1,8269 @@ -/* - * Copyright 2017 Cisco Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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. - */ - - -#include <assert.h> -#include <signal.h> -#include <sys/time.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <zlib.h> -#include <sched.h> -#include <time.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <pthread.h> -#include <stdint.h> - -#include <nfapi_interface.h> -#include <nfapi.h> -#include <debug.h> -#include "nfapi_nr_interface_scf.h" - -extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data); -extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data); - -uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len) -{ - uint32_t chksum = 0; - // calcaulte upto the checksum - chksum = crc32(chksum, buffer, 8); - - // skip the checksum - uint8_t zeros[4] = {0, 0, 0, 0}; - chksum = crc32(chksum, zeros, 4); - - // continu with the rest of the mesage - chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH); - - // return the inverse - return ~(chksum); -} - -int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len) -{ - uint32_t checksum = nfapi_calculate_checksum(buffer, len); - - uint8_t* p_write = &buffer[8]; - return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1); -} - -int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp) -{ - uint8_t* p_write = &buffer[12]; - return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1); -} - -uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len) -{ - return nfapi_calculate_checksum(buffer, len); -} - -void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config) -{ - if(size == 0) - return 0; - - void* buffer_p = NULL; - if(config && config->allocate) - { - buffer_p = (config->allocate)(size); - if(buffer_p != NULL){ - memset(buffer_p,0,size); - } - return buffer_p; - } - else - { - buffer_p = calloc(1, size); - return buffer_p; - } -} - -void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config) -{ - if(ptr == NULL) - return; - - if(config && config->deallocate) - { - return (config->deallocate)(ptr); - } - else - { - return free(ptr); - } -} -// Pack routines - - -static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; - - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format); - - return ( push8(value->dci_format, ppWritePackedMsg, end) && - push8(value->cce_idx, ppWritePackedMsg, end) && - push8(value->aggregation_level, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->mcs_1, ppWritePackedMsg, end) && - push8(value->redundancy_version_1, ppWritePackedMsg, end) && - push8(value->new_data_indicator_1, ppWritePackedMsg, end) && - push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && - push8(value->mcs_2, ppWritePackedMsg, end) && - push8(value->redundancy_version_2, ppWritePackedMsg, end) && - push8(value->new_data_indicator_2, ppWritePackedMsg, end) && - push8(value->harq_process, ppWritePackedMsg, end) && - push8(value->tpmi, ppWritePackedMsg, end) && - push8(value->pmi, ppWritePackedMsg, end) && - push8(value->precoding_information, ppWritePackedMsg, end) && - push8(value->tpc, ppWritePackedMsg, end) && - push8(value->downlink_assignment_index, ppWritePackedMsg, end) && - push8(value->ngap, ppWritePackedMsg, end) && - push8(value->transport_block_size_index, ppWritePackedMsg, end) && - push8(value->downlink_power_offset, ppWritePackedMsg, end) && - push8(value->allocate_prach_flag, ppWritePackedMsg, end) && - push8(value->preamble_index, ppWritePackedMsg, end) && - push8(value->prach_mask_index, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; - - return( push8(value->mcch_flag, ppWritePackedMsg, end) && - push8(value->mcch_change_notification, ppWritePackedMsg, end) && - push8(value->scrambling_identity, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; - - return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && - push8(value->carrier_indicator, ppWritePackedMsg, end) && - push8(value->srs_flag, ppWritePackedMsg, end) && - push8(value->srs_request, ppWritePackedMsg, end) && - push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) && - push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && - push8(value->n_dl_rb, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; - - return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; - - return ( push8(value->primary_cell_type, ppWritePackedMsg, end) && - push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) && - push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) && - pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end)); -} - -static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) && - push8(value->number_of_subbands, ppWritePackedMsg, end) && - push8(value->num_antennas, ppWritePackedMsg, end))) - return 0; - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); - - if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) && - push8(subband_info->scheduled_ues, ppWritePackedMsg, end))) - return 0; - - - uint8_t antenna_idx = 0; - uint8_t scheduled_ue_idx = 0; - - for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) - { - for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) - { - if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end)) - return 0; - } - } - - } - - - return 1; - -} - - -static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; - - return( - push16(value->bwp_size, ppWritePackedMsg, end) && - push16(value->bwp_start, ppWritePackedMsg, end) && - - push8(value->subcarrier_spacing, ppWritePackedMsg, end) && - push8(value->cyclic_prefix, ppWritePackedMsg, end) && - - push16(value->start_rb, ppWritePackedMsg, end) && - push16(value->nr_of_rbs, ppWritePackedMsg, end) && - - push8(value->csi_type, ppWritePackedMsg, end) && - push8(value->row, ppWritePackedMsg, end) && - - push16(value->freq_domain, ppWritePackedMsg, end) && - push8(value->symb_l0, ppWritePackedMsg, end) && - - push8(value->symb_l1, ppWritePackedMsg, end) && - push8(value->cdm_type, ppWritePackedMsg, end) && - - push8(value->freq_density, ppWritePackedMsg, end) && - push16(value->scramb_id, ppWritePackedMsg, end) && - - push8(value->power_control_offset, ppWritePackedMsg, end) && - push8(value->power_control_offset_ss, ppWritePackedMsg, end) - ); - -} - - -static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; - - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) && - push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && - - push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && - push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) && - push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && - push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && - - push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && - push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && - pusharray8(value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)); - - return 0; - } - - // TODO: resolve the packaging of array (currently sending a single element) - return( - push16(value->BWPSize, ppWritePackedMsg, end) && - push16(value->BWPStart, ppWritePackedMsg, end) && - push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && - push8(value->CyclicPrefix, ppWritePackedMsg, end) && - - push8(value->StartSymbolIndex, ppWritePackedMsg, end) && - push8(value->DurationSymbols, ppWritePackedMsg, end) && - pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) && - push8(value->CceRegMappingType, ppWritePackedMsg, end) && - - push8(value->RegBundleSize, ppWritePackedMsg, end) && - push8(value->InterleaverSize, ppWritePackedMsg, end) && - push8(value->CoreSetType, ppWritePackedMsg, end) && - push16(value->ShiftIndex, ppWritePackedMsg, end) && - - push8(value->precoderGranularity, ppWritePackedMsg, end) && - push16(value->numDlDci, ppWritePackedMsg, end)); - -} - - -static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; - - // TODO: resolve the packaging of array (currently sending a single element) - return( - push16(value->pduBitmap, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push16(value->pduIndex, ppWritePackedMsg, end) && - push16(value->BWPSize, ppWritePackedMsg, end) && - - push16(value->BWPStart, ppWritePackedMsg, end) && - push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && - push8(value->CyclicPrefix, ppWritePackedMsg, end) && - push8(value->NrOfCodewords, ppWritePackedMsg, end) && - - pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) && - pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) && - pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) && - pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) && - - pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) && - pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) && - push16(value->dataScramblingId, ppWritePackedMsg, end) && - push8(value->nrOfLayers, ppWritePackedMsg, end) && - - push8(value->transmissionScheme, ppWritePackedMsg, end) && - push8(value->refPoint, ppWritePackedMsg, end) && - push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) && - push8(value->dmrsConfigType, ppWritePackedMsg, end) && - - push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) && - push8(value->SCID, ppWritePackedMsg, end) && - push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) && - push16(value->dmrsPorts, ppWritePackedMsg, end) && - - push8(value->resourceAlloc, ppWritePackedMsg, end) && - push16(value->rbStart, ppWritePackedMsg, end) && - push16(value->rbSize, ppWritePackedMsg, end) && - - push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) && - push8(value->StartSymbolIndex, ppWritePackedMsg, end) && - push8(value->NrOfSymbols, ppWritePackedMsg, end) && - push8(value->PTRSPortIndex, ppWritePackedMsg, end) && - - push8(value->PTRSTimeDensity, ppWritePackedMsg, end) && - push8(value->PTRSFreqDensity, ppWritePackedMsg, end) && - push8(value->PTRSReOffset, ppWritePackedMsg, end) - ); - -} - - -static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; - - return( - push16(value->PhysCellId, ppWritePackedMsg, end) && - push8(value->BetaPss, ppWritePackedMsg, end) && - push8(value->SsbBlockIndex, ppWritePackedMsg, end) && - push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) && - push16(value->ssbOffsetPointA, ppWritePackedMsg, end) && - push8(value->bchPayloadFlag, ppWritePackedMsg, end) && - push32(value->bchPayload, ppWritePackedMsg, end) - // TODO: pack precoding_and_beamforming too - ); - -} - - -static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; - - return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) && - push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) && - push8(value->initial_lbt_sf, ppWritePackedMsg, end) && - push8(value->codebook_size_determination, ppWritePackedMsg, end) && - push8(value->drms_table_flag, ppWritePackedMsg, end) && - push8(value->tpm_struct_flag, ppWritePackedMsg, end) && - (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1)); -} - -static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; - - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__); - - return( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; - - return ( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->modulation, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push16(value->mbsfn_area_id, ppWritePackedMsg, end)); -} - -static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem; - - return ( push8(bf->subband_index, ppWritePackedMsg, end) && - push8(bf->num_antennas, ppWritePackedMsg, end) && - pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end)); - - -} -static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; - - return ( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->modulation, ppWritePackedMsg, end) && - push8(value->redundancy_version, ppWritePackedMsg, end) && - push8(value->transport_blocks, ppWritePackedMsg, end) && - push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && - push8(value->transmission_scheme, ppWritePackedMsg, end) && - push8(value->number_of_layers, ppWritePackedMsg, end) && - push8(value->number_of_subbands, ppWritePackedMsg, end) && - pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) && - push8(value->ue_category_capacity, ppWritePackedMsg, end) && - push8(value->pa, ppWritePackedMsg, end) && - push8(value->delta_power_offset_index, ppWritePackedMsg, end) && - push8(value->ngap, ppWritePackedMsg, end) && - push8(value->nprb, ppWritePackedMsg, end) && - push8(value->transmission_mode, ppWritePackedMsg, end) && - push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) && - push8(value->num_bf_vector, ppWritePackedMsg, end) && - packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info)); - -} -static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; - return ( push8(value->nscid, ppWritePackedMsg, end) ); -} -static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; - - return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) && - push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && - push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && - push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && - pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && - push8(value->pdsch_start, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; - - return( push8(value->drms_config_flag, ppWritePackedMsg, end) && - push16(value->drms_scrambling, ppWritePackedMsg, end) && - push8(value->csi_config_flag, ppWritePackedMsg, end) && - push16(value->csi_scrambling, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; - - return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) && - push8(value->maxlayers, ppWritePackedMsg, end) && - push8(value->n_dl_harq, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; - - return( push8(value->dwpts_symbols, ppWritePackedMsg, end) && - push8(value->initial_lbt_sf, ppWritePackedMsg, end) && - push8(value->ue_type, ppWritePackedMsg, end) && - push8(value->pdsch_payload_type, ppWritePackedMsg, end) && - push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && - push8(value->drms_table_flag, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; - - return( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->p_rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->mcs, ppWritePackedMsg, end) && - push8(value->redundancy_version, ppWritePackedMsg, end) && - push8(value->number_of_transport_blocks, ppWritePackedMsg, end) && - push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && - push8(value->transmission_scheme, ppWritePackedMsg, end) && - push8(value->number_of_layers, ppWritePackedMsg, end) && - push8(value->codebook_index, ppWritePackedMsg, end) && - push8(value->ue_category_capacity, ppWritePackedMsg, end) && - push8(value->pa, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push8(value->nprb, ppWritePackedMsg, end) && - push8(value->ngap, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; - - return ( push8(value->ue_mode, ppWritePackedMsg, end) && - push16(value->initial_transmission_sf_io, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; - - return( push16(value->transmission_power, ppWritePackedMsg, end) && - push8(value->prs_bandwidth, ppWritePackedMsg, end) && - push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) && - push8(value->prs_muting, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; - - return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) && - push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && - push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) && - pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; - - if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) && - push8(value->cdm_type, ppWritePackedMsg, end) && - push8(value->num_bf_vector, ppWritePackedMsg, end))) - { - return 0; - } - - uint16_t i; - for(i = 0; i < value->num_bf_vector; ++i) - { - if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) && - pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end))) - return 0; - } - - return 1; -} -static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(vector->subband_index, ppWritePackedMsg, end) && - push8(vector->num_antennas, ppWritePackedMsg, end) && - pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; - - return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) && - push16(value->epdcch_id, ppWritePackedMsg, end) && - push8(value->epdcch_start_symbol, ppWritePackedMsg, end) && - push8(value->epdcch_num_prb, ppWritePackedMsg, end) && - pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) && - pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; - - return (push8(value->dwpts_symbols, ppWritePackedMsg, end) && - push8(value->initial_lbt_sf, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; - - return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) && - push8(value->number_of_prb_pairs, ppWritePackedMsg, end) && - push8(value->resource_block_assignment, ppWritePackedMsg, end) && - push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) && - push8(value->start_symbol, ppWritePackedMsg, end) && - push8(value->ecce_index, ppWritePackedMsg, end) && - push8(value->aggregation_level, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->ce_mode, ppWritePackedMsg, end) && - push16(value->drms_scrambling_init, ppWritePackedMsg, end) && - push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push8(value->dci_format, ppWritePackedMsg, end) && - push16(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->mcs, ppWritePackedMsg, end) && - push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) && - push8(value->redundancy_version, ppWritePackedMsg, end) && - push8(value->new_data_indicator, ppWritePackedMsg, end) && - push8(value->harq_process, ppWritePackedMsg, end) && - push8(value->tpmi_length, ppWritePackedMsg, end) && - push8(value->tpmi, ppWritePackedMsg, end) && - push8(value->pmi_flag, ppWritePackedMsg, end) && - push8(value->pmi, ppWritePackedMsg, end) && - push8(value->harq_resource_offset, ppWritePackedMsg, end) && - push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && - push8(value->tpc, ppWritePackedMsg, end) && - push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) && - push8(value->downlink_assignment_index, ppWritePackedMsg, end) && - push8(value->allocate_prach_flag, ppWritePackedMsg, end) && - push8(value->preamble_index, ppWritePackedMsg, end) && - push8(value->prach_mask_index, ppWritePackedMsg, end) && - push8(value->starting_ce_level, ppWritePackedMsg, end) && - push8(value->srs_request, ppWritePackedMsg, end) && - push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) && - push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) && - push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && - push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) && - push8(value->direct_indication, ppWritePackedMsg, end) && - push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && - push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) && - pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end)); -} - - -static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; - - return (push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end)); -} - - -static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; - - return (push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push8(value->ncce_index, ppWritePackedMsg, end) && - push8(value->aggregation_level, ppWritePackedMsg, end) && - push8(value->start_symbol, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && - push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && - push8(value->dci_format, ppWritePackedMsg, end) && - push8(value->scheduling_delay, ppWritePackedMsg, end) && - push8(value->resource_assignment, ppWritePackedMsg, end) && - push8(value->repetition_number, ppWritePackedMsg, end) && - push8(value->mcs, ppWritePackedMsg, end) && - push8(value->new_data_indicator, ppWritePackedMsg, end) && - push8(value->harq_ack_resource, ppWritePackedMsg, end) && - push8(value->npdcch_order_indication, ppWritePackedMsg, end) && - push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) && - push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) && - push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) && - push8(value->direct_indication, ppWritePackedMsg, end) && - push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && - push8(value->total_dci_length_including_padding, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; - - return (push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push8(value->start_symbol, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push16(value->resource_assignment, ppWritePackedMsg, end) && - push16(value->repetition_number, ppWritePackedMsg, end) && - push8(value->modulation, ppWritePackedMsg, end) && - push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) && - push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && - push16(value->sf_idx, ppWritePackedMsg, end) && - push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end)); -} - - -static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv; - - if(!(push16(value->PDUSize, ppWritePackedMsg, end) && - push16(value->PDUType, ppWritePackedMsg, end) )) - return 0; - - - // first match the pdu type, then call the respective function - switch(value->PDUType) - { - case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: - { - if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - - case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: - { - if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: - { - if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: - { - if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); - } - break; - } - - return 1; -} - -static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; - - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich); - - if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) && - push8(value->number_dci, ppWritePackedMsg, end) && - push16(value->number_pdu, ppWritePackedMsg, end) && - push8(value->number_pdsch_rnti, ppWritePackedMsg, end) && - push16(value->transmission_power_pcfich, ppWritePackedMsg, end))) - { - return 0; - } - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_pdu; - for(; i < total_number_of_pdus; ++i) - { - nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); - - if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: - { - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__); - - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value))) - { - return 0; - } - } - break; - case NFAPI_DL_CONFIG_BCH_PDU_TYPE: - { - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__); - - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_MCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_PCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_PRS_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) & - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value))) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - } - - return 1; -} - - -static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; - - if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && - push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) && - push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) && - pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end) - //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) - )) - return 0; - - int arr[12]; - for(int i=0;i<pNfapiMsg->dl_tti_request_body.nGroup;i++) - { - for(int j=0;j<pNfapiMsg->dl_tti_request_body.nUe[i];j++) - { - arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; - } - if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end))) - return 0; - } - - for(int i=0;i<pNfapiMsg->dl_tti_request_body.nPDUs;i++) - { - if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end)) - return 0; - } - -return 1; -} - - -static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; - - //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) && - //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - { - uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); - uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value); - uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - - if (!x || !y || !z) - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z); - } - - return x && y && z; - } -} - - - - -static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end) -{ - nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; - - return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; - - return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && - push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; - - return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; - - return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end)); -} - -//Pack fns for ul_tti PDUS - - -static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return( - push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) && - push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) && - push8(prach_pdu->prach_format, ppWritePackedMsg, end) && - push8(prach_pdu->num_ra, ppWritePackedMsg, end) && - push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) && - push16(prach_pdu->num_cs, ppWritePackedMsg, end) - // TODO: ignoring beamforming tlv for now - ); - -} - -static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return( - push16(pucch_pdu->rnti, ppWritePackedMsg, end) && - push32(pucch_pdu->handle, ppWritePackedMsg, end) && - push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) && - push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) && - push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && - push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) && - push8(pucch_pdu->format_type, ppWritePackedMsg, end) && - push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) && - push16(pucch_pdu->prb_start, ppWritePackedMsg, end) && - push16(pucch_pdu->prb_size, ppWritePackedMsg, end) && - push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) && - push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) && - push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) && - push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) && - push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) && - push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) && - push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) && - push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) && - push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) && - push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) && - push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) && - push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) && - push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) && - push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) && - push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) && - push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) && - push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) && - push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) && - push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end) - // TODO: ignoring beamforming tlv for now - ); - -} - - -static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - - if (!( - push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) && - push16(pusch_pdu->rnti, ppWritePackedMsg, end) && - push32(pusch_pdu->handle, ppWritePackedMsg, end) && - push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) && - push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) && - push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && - push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) && - push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) && - push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) && - push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) && - push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) && - push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) && - push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) && - push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) && - push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) && - push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) && - push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) && - push8(pusch_pdu->scid, ppWritePackedMsg, end) && - push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) && - push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && - push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) && - push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) && - push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && - push16(pusch_pdu->rb_start, ppWritePackedMsg, end) && - push16(pusch_pdu->rb_size, ppWritePackedMsg, end) && - push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) && - push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) && - push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) && - push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) && - push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) && - push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end) - // TODO: ignoring beamforming tlv for now - )) - return 0; - - - //Pack Optional Data only included if indicated in pduBitmap - switch(pusch_pdu->pdu_bit_map){ - case PUSCH_PDU_BITMAP_PUSCH_DATA: - { - // pack optional TLVs - return( - push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) && - push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) && - pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_UCI: - { - return( - push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_PTRS: - { - return( - push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_DFTS_OFDM: - { - return( - push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) && - push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) && - push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) && - push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end) - ); - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); - } - } - - return 1; -} - -static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return( - push16(srs_pdu->rnti, ppWritePackedMsg, end) && - push32(srs_pdu->handle, ppWritePackedMsg, end) && - push16(srs_pdu->bwp_size, ppWritePackedMsg, end) && - push16(srs_pdu->bwp_start, ppWritePackedMsg, end) && - push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) && - push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) && - push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) && - push8(srs_pdu->num_symbols, ppWritePackedMsg, end) && - push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) && - push8(srs_pdu->time_start_position, ppWritePackedMsg, end) && - push8(srs_pdu->config_index, ppWritePackedMsg, end) && - push16(srs_pdu->sequence_id, ppWritePackedMsg, end) && - push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) && - push8(srs_pdu->comb_size, ppWritePackedMsg, end) && - push8(srs_pdu->comb_offset, ppWritePackedMsg, end) && - push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) && - push8(srs_pdu->frequency_position, ppWritePackedMsg, end) && - push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) && - push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) && - push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) && - push8(srs_pdu->resource_type, ppWritePackedMsg, end) && - push16(srs_pdu->t_srs, ppWritePackedMsg, end) && - push16(srs_pdu->t_offset, ppWritePackedMsg, end) - - // TODO: ignoring beamforming tlv for now - ); - -} - -static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value)); -} - -static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; - - return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; - - if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end))) - { - return 0; - } - - switch(cqi_ri_info_rel9->report_type) - { - case NFAPI_CSI_REPORT_TYPE_PERIODIC: - { - if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end))) - { - return 0; - } - } - break; - case NFAPI_CSI_REPORT_TYPE_APERIODIC: - { - if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0) - return 0; - - uint8_t i; - for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) - { - if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0) - return 0; - - uint8_t j; - for(j = 0; j < 8; ++j) - { - if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0) - return 0; - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); - } - break; - }; - - return 1; -} - -static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; - - switch(cqi_ri_info_rel13->report_type) - { - case NFAPI_CSI_REPORT_TYPE_PERIODIC: - { - if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0) - return 0; - } - break; - case NFAPI_CSI_REPORT_TYPE_APERIODIC: - { - // No parameters - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type ); - } - break; - }; - - return 1; -} - -static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value)); - -} - -static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; - - return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) && - push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value); -} - -static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; - - return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) && - push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) && - push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; - - return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && - push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value)); -} - -static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; - - return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) && - push16(ue_info_rel8->rnti, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; - - return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && - push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; - - return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) && - push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) && - push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && - push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value)); -} - -static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; - - return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) && - push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) && - push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; - - return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) && - push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; - - return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) && - push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) && - push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; - - return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; - - return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && - push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) && - push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) && - push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) && - push8(harq_info_rel13->n_srs, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value)); - -} - -static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; - - return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) && - push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; - - return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) && - push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; - - return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) && - push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) && - push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) && - push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) && - push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) && - push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value)); - -} - -static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; - return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end); -} -static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; - - return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) && - push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value)); -} - -static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; - - return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->size, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; - return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end); -} - -static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; - - return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; - - return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; - - return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) && - push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) && - pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value)); -} -static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; - - return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) && - push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) && - push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end)); - -} - - - -static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv; - - if(!(push16(value->pdu_size, ppWritePackedMsg, end) && - push16(value->pdu_type, ppWritePackedMsg, end) )) - return 0; - - - // first match the pdu type, then call the respective function - switch(value->pdu_type) - { - case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: - { - if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: - { - if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: - { - if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: - { - if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type ); - } - break; - } - - return 1; -} - -static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv; - - if(!push8(value->n_ue, ppWritePackedMsg, end)) - return 0; - for(int i=0; i<value->n_ue;i++) - { - if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end)) - return 0; - } - return 1; -} - -static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; - - if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) && - push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) && - push8(value->srs_present, ppWritePackedMsg, end))) - return 0; - - uint16_t i = 0; - for(i = 0; i < value->number_of_pdus; ++i) - { - nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); - - if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: - { - if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end)) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && - pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) && - pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && - pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) && - pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_SRS_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value))) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - - } - return 1; -} - - -static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; - - if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && - push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) && - push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) && - push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) && - push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) && - push8(pNfapiMsg->n_group, ppWritePackedMsg, end) )) - return 0; - - for(int i=0; i<pNfapiMsg->n_pdus; i++) - { - if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end)) - return 0; - } - - for(int i=0; i<pNfapiMsg->n_group; i++) - { - if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end)) - return 0; - - } - - return 1; -} - - -static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ; -} - -static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; - - return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && - push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && - push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) && - push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) && - push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; - - return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) && - push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; - - return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) && - push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) && - push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) && - push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; - - return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && - push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; - - return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) && - push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; - - return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) && - push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) && - pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end)); - -} - -static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; - - return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && - push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end)); -} - - -static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; - - if(!(push16(value->sfnsf, ppWritePackedMsg, end) && - push8(value->number_of_dci, ppWritePackedMsg, end) && - push8(value->number_of_hi, ppWritePackedMsg, end))) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); - - if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_HI_DCI0_HI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value))) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - - } - - return 1; -} - -static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv; - - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && - - push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && - - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && - - pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)); - - return 0; - } - - return (push16(value->PDUType, ppWritePackedMsg, end) && - push16(value->PDUSize, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) && - - push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) && - pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) && - - push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end)); - -} - -static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; - - if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && - push8(pNfapiMsg->numPdus, ppWritePackedMsg, end) - )) - return 0; - - for(int i=0; i<pNfapiMsg->numPdus; i++) - { - if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end)) - return 0; - } - return 1; - - -} - - - -static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -//pack_tx_data_pdu_list_value -static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv; - - if(!(push32(value->num_TLV, ppWritePackedMsg, end) && - push16(value->PDU_index, ppWritePackedMsg, end) && - push16(value->PDU_length, ppWritePackedMsg, end) - )) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_tlvs = value->num_TLV; - for(; i < total_number_of_tlvs; ++i) - { - - if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) && - push16(value->TLVs[i].tag, ppWritePackedMsg, end))) - return 0; - - switch(value->TLVs[i].tag) - { - case 0: - { - if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end)) - return 0; - break; - - } - - case 1: - { - if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end)) - return 0; - break; - - } - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag ); - break; - } - - } - } - return 1; -} - -static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv; - - if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(; i < total_number_of_pdus; ++i) - { - nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]); - - if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) && - push16(pdu->pdu_index, ppWritePackedMsg, end))) - return 0; - - uint8_t j; - for(j = 0; j < pdu->num_segments; ++j) - { - // Use -1 as it is unbounded - // DJP - does not handle -1 - // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0) - int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end); - - if (pdu->segments[j].segment_length == 3) - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, - pdu->segments[j].segment_data[0], - pdu->segments[j].segment_data[1], - pdu->segments[j].segment_data[2] - ); - } - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret); - - if (push_ret == 0) - { - return 0; - } - } - } - - return 1; -} - -static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; - - if (!( - push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && - push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end) - )) - return 0; - - for(int i=0; i<pNfapiMsg->Number_of_PDUs; i++) - { - if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end)) - return 0; - } - - return 1; -} - -static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; - - int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); - int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value); - int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z); - - return x && y && z; -} - -static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv; - if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){ - return 0; - } - - uint8_t j; - uint16_t num = value->number_of_TLVs; - for(j = 0; j < num; ++j){ - if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){ - return 0; - } - } - return 1; -} - -static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; - int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); - int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value); - int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - return x && y && z; -} - -static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - - nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; - - int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end); - int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - return x && z; -} - -static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) ); -} - -static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; - - return ( pull32(ppReadPackedMsg, &value->handle, end) && - pull16(ppReadPackedMsg, &value->rnti, end)); -} - -static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) && - push8(data->value_1, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) && - push8(data->value_1, ppWritePackedMsg, end) && - push8(data->value_2, ppWritePackedMsg, end) && - push8(data->value_3, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) ); -} - -static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) ); -} - -static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv; - - if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) && - push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end))) - return 0; - - uint8_t result = 0; - switch(harq_indication_tdd_rel8->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = 1; - break; - default: - // err.... - break; - } - - return result; - -} - -static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv; - - if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) && - push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end))) - return 0; - - uint8_t idx; - for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - - switch(harq_indication_tdd_rel9->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end); - break; - default: - // err.... - break; - } - - if(result == 0) - return 0; - } - - return 1; -} - -static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv; - - if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) && - push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end))) - return 0; - - uint8_t idx; - for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - switch(harq_indication_tdd_rel13->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end); - break; - default: - // err.... - break; - } - - if(result == 0) - return 0; - } - - return 1; -} - -static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv; - - return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) && - push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv; - - return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) && - push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) && - pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv; - - return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) && - push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) && - pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; - - return ( push8(value->ul_cqi, ppWritePackedMsg, end) && - push8(value->channel, ppWritePackedMsg, end)); - -} - -static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; - - if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_harqs; - for(; i < total_number_of_pdus; ++i) - { - nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) && - pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) && - pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) && - pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) && - pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) && - pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv; - - return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) ); -} - -static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; - - if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_crcs; - for(; i < total_number_of_pdus; ++i) - { - nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - return 1; -} - -static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} -static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; - - return ( push16(value->length, ppWritePackedMsg, end) && - push16(value->offset, ppWritePackedMsg, end) && - push8(value->ul_cqi, ppWritePackedMsg, end) && - push16(value->timing_advance, ppWritePackedMsg, end)); -} -static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; - - return ( push16(value->timing_advance_r9, ppWritePackedMsg, end)); -} - -static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; - - //printf("RX ULSCH BODY\n"); - - if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - // need to calculate the data offset's. - uint16_t i = 0; - uint16_t offset = 2; // taking into account the number_of_pdus - uint16_t total_number_of_pdus = value->number_of_pdus; - //printf("ULSCH:pdus:%d\n", total_number_of_pdus); - - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) - { - //printf("NFAPI_RX_UE_INFORMATION_TAG\n"); - offset += 4 + 6; - } - - if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - //printf("NFAPI_RX_INDICATION_REL8_TAG\n"); - offset += 4 + 7; - } - - if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG) - { - //printf("NFAPI_RX_INDICATION_REL9_TAG\n"); - offset += 4 + 2; - } - } - - // Now update the structure to include the offset - for(i =0; i < total_number_of_pdus; ++i) - { - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - - if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - if(pdu->rx_indication_rel8.offset == 1) - { - pdu->rx_indication_rel8.offset = offset; - offset += pdu->rx_indication_rel8.length; - } - } - } - - // Write out the pdu - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) && - pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value))) - return 0; - } - - // Write out the pdu data - for(i = 0; i < total_number_of_pdus; ++i) - { - uint16_t length = 0; - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - - if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - length = pdu->rx_indication_rel8.length; - } - - if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0) - return 0; - } - return 1; -} - - -static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; - - return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) && - push8(preamble_rel8->preamble, ppWritePackedMsg, end) && - push16(preamble_rel8->timing_advance, ppWritePackedMsg, end)); -} -static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; - - return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) ); -} -static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; - - return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) ); -} - -static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; - - if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_preambles; - for(; i < total_number_of_pdus; ++i) - { - nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) && - pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) && - pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; - - return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) && - pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end)); -} - -static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; - - return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) ); -} - -static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; - - return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) ); - -} - -static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; - - return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ; -} - -static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; - - if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) && - push8(value->number_of_subbands, ppWritePackedMsg, end) && - push8(value->num_atennas, ppWritePackedMsg, end))) - return 0; - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) && - pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end))) - return 0; - } - - return 1; -} - -static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv; - - if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_ues; - for(; i < total_number_of_pdus; ++i) - { - nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) && - pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) && - pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) && - pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) && - pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) && - pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} - -static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; - - if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_srs; - for(; i < total_number_of_pdus; ++i) - { - nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - return 1; -} - -static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} - -static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; - - return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) && - push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) && - push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) && - push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) && - push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end)); -} - -static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; - - return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) && - push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) && - push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) && - push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && - pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && - push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) && - push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end)); -} - -static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; - - if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0) - return 0; - - // need to calculate the data offset's. This very bittle due the hardcoding - // of the sizes. can not use the sizeof as we have an array for the Rel9 - // info - uint16_t i = 0; - uint16_t offset = 2; // taking into account the number_of_cqis - uint16_t total_number_of_pdus = value->number_of_cqis; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - offset += 2; // for the instance length - - if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) - { - offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t) - } - - if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - offset += 4 + 8; - } - - if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported; - } - - if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG) - { - offset += 4 + 2; - } - } - - // Now update the structure to include the offset - for(i =0; i < total_number_of_pdus; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - if(pdu->cqi_indication_rel8.data_offset == 1) - { - pdu->cqi_indication_rel8.data_offset = offset; - offset += pdu->cqi_indication_rel8.length; - } - } - - if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - if(pdu->cqi_indication_rel9.data_offset == 1) - { - pdu->cqi_indication_rel9.data_offset = offset; - offset += pdu->cqi_indication_rel9.length; - } - } - - } - - // Write out the cqi information - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) && - pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) && - pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - - } - - // Write out the cqi raw data - for(i = 0; i < total_number_of_pdus; ++i) - { - uint16_t length = 0; - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - length = pdu->cqi_indication_rel8.length; - } - - if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - length = pdu->cqi_indication_rel9.length; - } - - if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0) - return 0; - } - - return 1; -} - -static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} - -static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->mp_cca, ppWritePackedMsg, end) && - push32(value->n_cca, ppWritePackedMsg, end) && - push32(value->offset, ppWritePackedMsg, end) && - push32(value->lte_txop_sf, ppWritePackedMsg, end) && - push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) && - push32(value->lbt_mode, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->offset, ppWritePackedMsg, end) && - push16(value->sfn_sf_end, ppWritePackedMsg, end) && - push32(value->lbt_mode, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; - - if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); - - if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: - { - if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0) - return 0; - } - break; - case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: - { - if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - } - - return 1; -} - -static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->result, ppWritePackedMsg, end) && - push32(value->lte_txop_symbols, ppWritePackedMsg, end) && - push32(value->initial_partial_sf, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->result, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; - - if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); - - if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: - { - if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0) - return 0; - } - break; - case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: - { - if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - } - - return 1; -} - -static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; - - return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) ); -} - -static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; - - if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_harqs = value->number_of_harqs; - for(; i < total_number_of_harqs; ++i) - { - nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - - -static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv; - - return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) && - push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) && - push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) && - push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end)); -} - - -static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; - - if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected; - for(; i < total_number_of_initial_scs_detected; ++i) - { - nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); - - //uint8_t* instance_length_p = *ppWritePackedMsg; - //if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - // return 0; - - if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - //push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; - - return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; - - return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; - - return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - push32(pNfapiMsg->t2, ppWritePackedMsg, end) && - push32(pNfapiMsg->t3, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; - - return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - push32(pNfapiMsg->t2, ppWritePackedMsg, end) && - push32(pNfapiMsg->t3, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; - - return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) && - push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && - push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; - - return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) && - push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) && - push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && - push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - - - -// Main pack function - public - -int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) -{ - nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; - uint8_t *pWritePackedMessage = pPackedBuf; - uint8_t *pPackedLengthField = &pWritePackedMessage[4]; - uint8_t *end = pPackedBuf + packedBufLen; - - if (pMessageBuf == NULL || pPackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); - return -1; - } - /* - printf("\n P7 MESSAGE SENT: \n"); - for(int i=0; i< packedBufLen; i++){ - printf("%d", *(uint8_t *)(pMessageBuf + i)); - } - printf("\n"); - */ - // process the header - if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && - push16(pMessageHeader->message_id, &pWritePackedMessage, end) && - push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && - push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && - push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && - push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); - return -1; - } - - if (pMessageHeader->message_id != NFAPI_TIMING_INFO) - { - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); - } - // look for the specific message - uint8_t result = 0; - switch (pMessageHeader->message_id) - { - case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: - result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: - result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: - result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: - result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_REQUEST: - result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_HARQ_INDICATION: - result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_CRC_INDICATION: - result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_ULSCH_INDICATION: - //printf("RX ULSCH\n"); - result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RACH_INDICATION: - result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_SRS_INDICATION: - result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_SR_INDICATION: - result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_CQI_INDICATION: - result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_INDICATION: - result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NB_HARQ_INDICATION: - result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NRACH_INDICATION: - result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: - result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: - result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_TIMING_INFO: - result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config); - break; - - default: - { - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->pack_p7_vendor_extension) - { - result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - } - break; - } - - if(result == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); - return -1; - } - - // check for a valid message length - uintptr_t msgHead = (uintptr_t)pPackedBuf; - uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; - uint32_t packedMsgLen = msgEnd - msgHead; - uint16_t packedMsgLen16; - if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); - return -1; - } - else - { - packedMsgLen16 = (uint16_t)packedMsgLen; - } - - // Update the message length in the header - pMessageHeader->message_length = packedMsgLen16; - - if(!push16(packedMsgLen16, &pPackedLengthField, end)) - return -1; - - if(1) - { - //quick test - if(pMessageHeader->message_length != packedMsgLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); - } - } - - return (packedMsgLen); -} - -int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) -{ - nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; - uint8_t *pWritePackedMessage = pPackedBuf; - uint8_t *pPackedLengthField = &pWritePackedMessage[4]; - uint8_t *end = pPackedBuf + packedBufLen; - - if (pMessageBuf == NULL || pPackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); - return -1; - } - /* - printf("\n P7 MESSAGE SENT: \n"); - for(int i=0; i< packedBufLen; i++){ - printf("%d", *(uint8_t *)(pMessageBuf + i)); - } - printf("\n"); - */ - // process the header - if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && - push16(pMessageHeader->message_id, &pWritePackedMessage, end) && - push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && - push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && - push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && - push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); - return -1; - } - - if (pMessageHeader->message_id != NFAPI_TIMING_INFO) - { - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); - } - // look for the specific message - uint8_t result = 0; - switch (pMessageHeader->message_id) - { - case NFAPI_DL_CONFIG_REQUEST: - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__); - result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UL_CONFIG_REQUEST: - result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_TX_REQUEST: - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__); - result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_HI_DCI0_REQUEST: - result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_REQUEST: - result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_HARQ_INDICATION: - result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_CRC_INDICATION: - result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_ULSCH_INDICATION: - //printf("RX ULSCH\n"); - result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RACH_INDICATION: - result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_SRS_INDICATION: - result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_SR_INDICATION: - result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_CQI_INDICATION: - result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_INDICATION: - result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NB_HARQ_INDICATION: - result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NRACH_INDICATION: - result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_DL_NODE_SYNC: - result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UL_NODE_SYNC: - result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_TIMING_INFO: - result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config); - break; - - default: - { - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->pack_p7_vendor_extension) - { - result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - } - break; - } - - if(result == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); - return -1; - } - - // check for a valid message length - uintptr_t msgHead = (uintptr_t)pPackedBuf; - uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; - uint32_t packedMsgLen = msgEnd - msgHead; - uint16_t packedMsgLen16; - if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); - return -1; - } - else - { - packedMsgLen16 = (uint16_t)packedMsgLen; - } - - // Update the message length in the header - pMessageHeader->message_length = packedMsgLen16; - - if(!push16(packedMsgLen16, &pPackedLengthField, end)) - return -1; - - if(1) - { - //quick test - if(pMessageHeader->message_length != packedMsgLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); - } - } - - return (packedMsgLen); -} - -// Unpack routines -// NR: -static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; - - return( - pull16(ppReadPackedMsg, &value->bwp_size, end) && - pull16(ppReadPackedMsg, &value->bwp_start, end) && - - pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &value->cyclic_prefix, end) && - - pull16(ppReadPackedMsg, &value->start_rb, end) && - pull16(ppReadPackedMsg, &value->nr_of_rbs, end) && - - pull8(ppReadPackedMsg, &value->csi_type, end) && - pull8(ppReadPackedMsg, &value->row, end) && - - pull16(ppReadPackedMsg, &value->freq_domain, end) && - pull8(ppReadPackedMsg, &value->symb_l0, end) && - - pull8(ppReadPackedMsg, &value->symb_l1, end) && - pull8(ppReadPackedMsg, &value->cdm_type, end) && - - pull8(ppReadPackedMsg, &value->freq_density, end) && - pull16(ppReadPackedMsg, &value->scramb_id, end) && - - pull8(ppReadPackedMsg, &value->power_control_offset, end) && - pull8(ppReadPackedMsg, &value->power_control_offset_ss, end) - ); - -} - - -static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; - - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) && - pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) && - - pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) && - pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) && - pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) && - pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) && - - pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) && - pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) && - - pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, end)); - - return 0; - } - - // TODO: resolve the packaging of array (currently sending a single element) - return( - pull16(ppReadPackedMsg, &value->BWPSize, end) && - pull16(ppReadPackedMsg, &value->BWPStart, end) && - pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && - pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && - - pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && - pull8(ppReadPackedMsg, &value->DurationSymbols, end) && - pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) && - pull8(ppReadPackedMsg, &value->CceRegMappingType, end) && - - pull8(ppReadPackedMsg, &value->RegBundleSize, end) && - pull8(ppReadPackedMsg, &value->InterleaverSize, end) && - pull8(ppReadPackedMsg, &value->CoreSetType, end) && - pull16(ppReadPackedMsg, &value->ShiftIndex, end) && - - pull8(ppReadPackedMsg, &value->precoderGranularity, end) && - pull16(ppReadPackedMsg, &value->numDlDci, end)); - -} - - -static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; - - // TODO: resolve the packaging of array (currently sending a single element) - return( - pull16(ppReadPackedMsg, &value->pduBitmap, end) && - pull16(ppReadPackedMsg, &value->rnti, end) && - pull16(ppReadPackedMsg, &value->pduIndex, end) && - pull16(ppReadPackedMsg, &value->BWPSize, end) && - - pull16(ppReadPackedMsg, &value->BWPStart, end) && - pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && - pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && - pull8(ppReadPackedMsg, &value->NrOfCodewords, end) && - - pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) && - pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) && - pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) && - pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) && - - pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) && - pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) && - pull16(ppReadPackedMsg, &value->dataScramblingId, end) && - pull8(ppReadPackedMsg, &value->nrOfLayers, end) && - - pull8(ppReadPackedMsg, &value->transmissionScheme, end) && - pull8(ppReadPackedMsg, &value->refPoint, end) && - pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) && - pull8(ppReadPackedMsg, &value->dmrsConfigType, end) && - - pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) && - pull8(ppReadPackedMsg, &value->SCID, end) && - pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) && - pull16(ppReadPackedMsg, &value->dmrsPorts, end) && - - pull8(ppReadPackedMsg, &value->resourceAlloc, end) && - pull16(ppReadPackedMsg, &value->rbStart, end) && - pull16(ppReadPackedMsg, &value->rbSize, end) && - - pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) && - pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && - pull8(ppReadPackedMsg, &value->NrOfSymbols, end) && - pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) && - - pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) && - pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) && - pull8(ppReadPackedMsg, &value->PTRSReOffset, end) - ); - -} - - -static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; - - return( - pull16(ppReadPackedMsg, &value->PhysCellId, end) && - pull8(ppReadPackedMsg, &value->BetaPss, end) && - pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) && - pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) && - pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) && - pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) && - pull32(ppReadPackedMsg, &value->bchPayload, end) - // TODO: pack precoding_and_beamforming too - ); - -} - - -// LTE: -static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) && - pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) && - pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) && - pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end)); - -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end)); -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end)); -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end)); -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) && - pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end)); -} - -static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end) -{ - if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && - pull8(ppReadPackedMsg, &value->number_of_subbands, end) && - pull8(ppReadPackedMsg, &value->num_antennas, end))) - return 0; - - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); - - if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) && - pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end))) - return 0; - - uint8_t antenna_idx = 0; - uint8_t scheduled_ue_idx = 0; - - for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) - { - for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) - { - if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end)) - return 0; - } - } - - } - - - return 1; - -} - - -static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; - - // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been - // added - uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5; - dci_dl_pdu_rel13->tpm_struct_flag = 0; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) && - ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) && - ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1)); - -} - -static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end)); -} - -static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) && - pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) && - pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) && - pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end)); -} - -static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; - - if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) && - pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) && - pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end))) - return 0; - - uint16_t j = 0; - for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j) - { - if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) && - pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end))) - return 0; - } - return 1; -} -static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) ); -} -static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && - pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ; -} -static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end)); -} -static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end)); -} -static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end)); -} - -static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) && - pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) && - pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end)); -} -static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; - - return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) && - pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end)); -} - -static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; - - return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) && - pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) && - pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) && - pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end)); -} - -static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; - - return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) && - pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) && - pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) && - pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end)); -} - -static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; - - if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end))) - return 0; - - - uint16_t idx =0; - for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx) - { - if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end))) - return 0; - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n"); - //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??); - } - return 1; -} - -static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) && - pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) && - pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) && - pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end)); -} - -static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; - - return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end)); -} - -static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; - - - return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) && - pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end)); -} - - -static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; - - return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) && - pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) && - pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end)); -} - -static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; - - return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) && - pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end)); -} - -static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; - - return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end)); -} - - -static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg; - - if(!(pull16(ppReadPackedMsg, &value->PDUSize, end) && - pull16(ppReadPackedMsg, &value->PDUType, end) )) - return 0; - - - // first match the pdu type, then call the respective function - switch(value->PDUType) - { - case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: - { - if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - - case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: - { - if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: - { - if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: - { - if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); - } - break; - } - - return 1; -} - - - - -static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) && - pull8(ppReadPackedMsg, &value->number_dci, end) && - pull16(ppReadPackedMsg, &value->number_pdu, end) && - pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) && - pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end))) - return 0; - - if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU); - return 0; - } - - if(value->number_pdu) - { - value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config); - if(value->dl_config_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu); - return 0; - } - } - else - { - value->dl_config_pdu_list = 0; - } - - uint16_t i; - uint16_t total_number_of_pdus = value->number_pdu; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - { - // pdu end of beyond buffer end - return 0; - } - - switch(pdu->pdu_type) - { - case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_BCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_MCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_PCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_PRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - - } - break; - case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - - } - break; - default: - // Need to log an error - break; - } - } - - return 1; -} - - -static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; - - if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) && - pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end) - //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) - )) - return 0; - - int arr[12]; - for(int i=0;i<pNfapiMsg->dl_tti_request_body.nGroup;i++) - { - for(int j=0;j<pNfapiMsg->dl_tti_request_body.nUe[i];j++) - { - arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; - } - if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end))) - return 0; - } - - for(int i=0;i<pNfapiMsg->dl_tti_request_body.nPDUs;i++) - { - if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i])) - return 0; - } - -return 1; -} - - -static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv; - - return( - pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) && - pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) && - pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) && - pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) && - pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) && - pull16(ppReadPackedMsg, &prach_pdu->num_cs, end) - // TODO: ignoring beamforming tlv for now - ); -} - - -static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv; - - return( - pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) && - pull32(ppReadPackedMsg, &pucch_pdu->handle, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) && - pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) && - pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) && - pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) && - pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) && - pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) && - pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) && - pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) && - pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) && - pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) && - pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) && - pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) && - pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) && - pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) && - pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) && - pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) && - pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) && - pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) && - pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) && - pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) && - pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) && - pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) && - pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end) - // TODO: ignoring beamforming tlv for now - ); -} - - -static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv; - - if (!( - pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) && - pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) && - pull32(ppReadPackedMsg, &pusch_pdu->handle, end) && - pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) && - pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) && - pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) && - pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) && - pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) && - pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) && - pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) && - pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) && - pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) && - pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) && - pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) && - pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) && - pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) && - pull8(ppReadPackedMsg, &pusch_pdu->scid, end) && - pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) && - pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && - pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) && - pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) && - pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && - pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) && - pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) && - pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) && - pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) && - pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) && - pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) && - pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) && - pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end) - // TODO: ignoring beamforming tlv for now - )) - return 0; - - - //Pack Optional Data only included if indicated in pduBitmap - switch(pusch_pdu->pdu_bit_map){ - case PUSCH_PDU_BITMAP_PUSCH_DATA: - { - // pack optional TLVs - return( - pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) && - pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) && - pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) && - pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_UCI: - { - return( - pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) && - pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) && - pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_PTRS: - { - return( - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) && -+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) && -+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_DFTS_OFDM: - { - return( - pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) && - pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) && - pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) && - pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end) - ); - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); - } - } - - return 1; -} - - -static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv; - - return( - pull16(ppReadPackedMsg, &srs_pdu->rnti, end) && - pull32(ppReadPackedMsg, &srs_pdu->handle, end) && - pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) && - pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) && - pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) && - pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) && - pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) && - pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) && - pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) && - pull8(ppReadPackedMsg, &srs_pdu->config_index, end) && - pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) && - pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) && - pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) && - pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) && - pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) && - pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) && - pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) && - pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) && - pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) && - pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) && - pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) && - pull16(ppReadPackedMsg, &srs_pdu->t_offset, end) - // TODO: ignoring beamforming tlv for now - ); -} - - -static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg; - - if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) )) - return 0; - - - // first natch the pdu type, then call the respective function - switch(pNfapiMsg->pdu_type) - { - - case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: - { - if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: - { - if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: - { - if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: - { - if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type ); - } - break; - - - } - - return 1; -} - - -static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg; - - if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end)) - return 0; - for (int i = 0; i < pNfapiMsg->n_ue; i++) - { - if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) ) - return 0; - } - return 1; -} - - -static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; - - if (!( - pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) )) - return 0; - - for(int i=0; i< pNfapiMsg->n_pdus; i++) - { - if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i])) - return 0; - } - - for(int i=0; i< pNfapiMsg->n_group; i++) - { - if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i])) - return 0; - } - - return 1; -} - - - -static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value}, - }; - - return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - - - - nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; - - return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end )); -} - -static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) && - pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) & - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end)); -} -static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; - - return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end)); -} -static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end)); -} -static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end)); -} - -static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end))) - return 0; - - switch(cqi_ri_info_rel9->report_type) - { - case NFAPI_CSI_REPORT_TYPE_PERIODIC: - { - if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end))) - return 0; - } - break; - case NFAPI_CSI_REPORT_TYPE_APERIODIC: - { - if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0) - return 0; - - uint8_t i; - for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) - { - if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0) - return 0; - - uint8_t j; - for(j = 0; j < 8; ++j) - { - if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0) - return 0; - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); - return 0; - } - break; - }; - return 1; -} - -// NOTE : This function is a little unconventional as we uese the side to -// determine the report type -static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; - if(cqi_ri_info_rel13->tl.length == 0) - { - cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC; - } - else - { - cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC; - if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0) - return 0; - } - return 1; -} -static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) && - pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end)); -} -static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) && - pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) && - pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end)); -} - -static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; - - return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end)); -} - -static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; - - return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) && - pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end)); -} -static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) && - pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end)); -} -static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) && - pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) && - pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) && - pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end)); -} - -static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) && - pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end)); -} -static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) && - pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end)); -} -static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) && - pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end)); -} - -static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end)); -} - -static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) && - pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) && - pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) && - pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; - - return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) && - pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) && - pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) && - pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; - - return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end)); -} - - -static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; - - return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) && - pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) && - pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) && - pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end)); -} - -static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; - return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end); -} - -static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end)); -} - -static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; - - return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end)); -} - -static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) && - pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end))) - return 0; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, - { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value}, - }; - - return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0); -} - -static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) && - pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) && - pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end)); -} - - -static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value}, - - #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value}, - - #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value}, - - #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value}, - - #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \ - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, - - #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value}, - - #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value}, - - #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value}, - - #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \ - { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value}, - - #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value}, - - #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value}, - - - nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) && - pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) && - pull8(ppReadPackedMsg, &value->srs_present, end))) - return 0; - - if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU); - return 0; - } - - if(value->number_of_pdus > 0) - { - value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config); - - if(value->ul_config_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->ul_config_pdu_list = 0; - } - - - uint16_t i; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - { - // pdu end is past buffer end - return 0; - } - - switch(pdu->pdu_type) - { - case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - - case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu) - UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information) - UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu) - UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information) - UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu) - UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information) - UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information) - UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_SRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - } - } - return 1; -} - - -static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; - - return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) && - pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end)); -} - -static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end)); -} - -static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) && - pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) && - pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) && - pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end)); -} - -static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) && - pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end)); -} - -static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end)); -} - -static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) && - pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) && - pull8(ppReadPackedMsg, &value->resource_block_assignment, end) && - pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) && - pull8(ppReadPackedMsg, &value->start_symbol, end) && - pull8(ppReadPackedMsg, &value->ecce_index, end) && - pull8(ppReadPackedMsg, &value->aggreagation_level, end) && - pull8(ppReadPackedMsg, &value->rnti_type, end) && - pull16(ppReadPackedMsg, &value->rnti, end) && - pull8(ppReadPackedMsg, &value->ce_mode, end) && - pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) && - pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) && - pull16(ppReadPackedMsg, &value->transmission_power, end) && - pull8(ppReadPackedMsg, &value->dci_format, end) && - pull8(ppReadPackedMsg, &value->resource_block_start, end) && - pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) && - pull8(ppReadPackedMsg, &value->mcs, end) && - pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) && - pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) && - pull8(ppReadPackedMsg, &value->new_data_indication, end) && - pull8(ppReadPackedMsg, &value->harq_process, end) && - pull8(ppReadPackedMsg, &value->redudency_version, end) && - pull8(ppReadPackedMsg, &value->tpc, end) && - pull8(ppReadPackedMsg, &value->csi_request, end) && - pull8(ppReadPackedMsg, &value->ul_inex, end) && - pull8(ppReadPackedMsg, &value->dai_presence_flag, end) && - pull8(ppReadPackedMsg, &value->dl_assignment_index, end) && - pull8(ppReadPackedMsg, &value->srs_request, end) && - pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) && - pull32(ppReadPackedMsg, &value->tcp_bitmap, end) && - pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) && - pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) && - pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end)); -} - -static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->ncce_index, end) && - pull8(ppReadPackedMsg, &value->aggregation_level, end) && - pull8(ppReadPackedMsg, &value->start_symbol, end) && - pull16(ppReadPackedMsg, &value->rnti, end) && - pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) && - pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) && - pull8(ppReadPackedMsg, &value->subcarrier_indication, end) && - pull8(ppReadPackedMsg, &value->resource_assignment, end) && - pull8(ppReadPackedMsg, &value->scheduling_delay, end) && - pull8(ppReadPackedMsg, &value->mcs, end) && - pull8(ppReadPackedMsg, &value->redudancy_version, end) && - pull8(ppReadPackedMsg, &value->repetition_number, end) && - pull8(ppReadPackedMsg, &value->new_data_indicator, end) && - pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end)); -} - -static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; - - if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) && - pull8(ppReadPackedMsg, &value->number_of_dci, end) && - pull8(ppReadPackedMsg, &value->number_of_hi, end))) - return 0; - - uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci; - - if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU); - return 0; - } - - if(totalNumPdus > 0) - { - value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config); - if(value->hi_dci0_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus); - return 0; - } - } - else - { - value->hi_dci0_pdu_list = 0; - } - - uint8_t i; - for(i = 0; i < totalNumPdus; ++i) - { - nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - { - // pdu end if past buffer end - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end); - return 0; - } - - switch(pdu->pdu_type) - { - case NFAPI_HI_DCI0_HI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value}, - { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, - { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, - { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, - { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, - { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - } - - return 1; -} -//unpack_ul_dci_pdu_list_value - -static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg; - - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) && - - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) && - - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) && - - pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end)); - - return 0; - } - - return (pull16(ppReadPackedMsg, &value->PDUType, end) && - pull16(ppReadPackedMsg, &value->PDUSize, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) && - - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) && - pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) && - - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) && - - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end)); - -} - -static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ -nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; - - if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end) - )) - return 0; - for(int i=0; i< pNfapiMsg->numPdus; i++) - { - if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i])) - return 0; - } - - return 1; - -} - -static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); - -} -static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg; - - if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end) - )) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV; - for(; i < total_number_of_tlvs; ++i) - { - - if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end))) - return 0; - - switch(pNfapiMsg->TLVs[i].tag){ - case 0: - { - if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end)) - return 0; - break; - - } - - case 1: - { - if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end)) - return 0; - break; - - } - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag ); - break; - } - - } - } - - - return 1; -} - -static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; - - if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end))) - return 0; - - for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++) - { - if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i])) - return 0; - } - - return 1; -} - -static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - uint8_t proceed = 1; - nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; - - if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) - return 0; - - while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) - { - nfapi_tl_t generic_tl; - if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_TX_REQUEST_BODY_TAG: - { - pNfapiMsg->tx_request_body.tl = generic_tl; - - if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0) - return 0; - - if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU); - return 0; - } - - if(pNfapiMsg->tx_request_body.number_of_pdus > 0) - { - pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config); - if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus); - return 0; - } - } - else - { - pNfapiMsg->tx_request_body.tx_pdu_list = 0; - } - - - uint16_t i; - uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus; - for(i = 0; i < totalNumPdus; ++i) - { - nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]); - if (pdu) { - uint16_t length = 0; - uint16_t index = 0; - - if(!(pull16(ppReadPackedMsg, &length, end) && - pull16(ppReadPackedMsg, &index, end))) - return 0; - - pdu->pdu_length = length; - pdu->pdu_index = index; - - - // TODO : May need to rethink this bit - pdu->num_segments = 1; - pdu->segments[0].segment_length = pdu->pdu_length; - pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config); - - if(pdu->segments[0].segment_data) - { - if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end)) - return 0; - if (pdu->segments[0].segment_length == 3) - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, - pdu->segments[0].segment_data[0], - pdu->segments[0].segment_data[1], - pdu->segments[0].segment_data[2] - ); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index); - } - } else { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n"); - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag ); - } - break; - }; - } - - return 1; -} - -static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - uint8_t proceed = 1; - nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; - - if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) - return 0; - - while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) - { - nfapi_tl_t generic_tl; - if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_UE_RELEASE_BODY_TAG: - { - pNfapiMsg->ue_release_request_body.tl = generic_tl; - if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0) - return 0; - - if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI); - return 0; - } else { - uint8_t j; - uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs; - for(j = 0; j < num; ++j){ - if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){ - return 0; - } - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag ); - } - break; - }; - } - - return 1; -} - -static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->value_0, end) && - pull8(ppReadPackedMsg, &value->value_1, end)); -} - -static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->value_0, end) && - pull8(ppReadPackedMsg, &value->value_1, end) && - pull8(ppReadPackedMsg, &value->value_2, end) && - pull8(ppReadPackedMsg, &value->value_3, end)); -} -static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv; - return ( pull8(ppReadPackedMsg, &value->value_0, end)); -} -static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv; - return (pull8(ppReadPackedMsg, &value->value_0, end)); -} - -static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->mode, end) && - pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) - return 0; - - uint8_t result = 0; - switch(value->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = 1; - break; - default: - // TODO add error message - return 0; - break; - } - return result; -} - -static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->mode, end) && - pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) - return 0; - - if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) - { - // TODO : add error message - return 0; - } - - uint16_t idx = 0; - for(idx = 0; idx < value->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - switch(value->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); - break; - default: - // TODO add error message - return 0; - break; - } - - if(result == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->mode, end) && - pull16(ppReadPackedMsg, &value->number_of_ack_nack, end))) - return 0; - - if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) - { - // TODO : add error message - return 0; - } - - uint16_t idx = 0; - for(idx = 0; idx < value->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - switch(value->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end); - break; - default: - // TODO add error message - return 0; - break; - } - - if(result == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv; - return (pull8(ppReadPackedMsg, &value->harq_tb1, end) && - pull8(ppReadPackedMsg, &value->harq_tb2, end)); -} - -static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->mode, end) && - pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) && - pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end)); -} - -static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->mode, end) && - pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) && - pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end)); -} - -static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->ul_cqi, end) && - pull8(ppReadPackedMsg, &value->channel, end)); -} - - - -static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; - uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(harqBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) - return 0; - - if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); - return 0; - } - - value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config); - if(value->harq_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); - return 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_harqs; ++i) - { - nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value}, - { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value}, - { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value}, - { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value}, - { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value}, - { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value}, - { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) - return 0; - - } - - return 1; -} - -static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv; - return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) ); -} - -static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; - uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(crcBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0) - return 0; - - if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU); - return 0; - } - - if(value->number_of_crcs > 0) - { - value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config); - if(value->crc_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs); - return 0; - } - } - else - { - value->crc_pdu_list = 0; - } - - - uint8_t i = 0; - for(i = 0; i < value->number_of_crcs; ++i) - { - nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value }, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0) - return 0; - } - - return 1; -} - -static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &value->length, end) && - pull16(ppReadPackedMsg, &value->offset, end) && - pull8(ppReadPackedMsg, &value->ul_cqi, end) && - pull16(ppReadPackedMsg, &value->timing_advance, end)); -} -static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; - return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end)); -} - -static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; - - // the rxBodyEnd points to the end of the cqi PDU's - uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length; - uint8_t* rxPduEnd = rxBodyEnd; - - uint8_t* numberOfPdusAddress = *ppReadPackedMsg; - - if(rxBodyEnd > end) - { - // pdu end is past buffer end - return 0; - } - - if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) - return 0; - - if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU); - return 0; - } - - if(value->number_of_pdus > 0) - { - value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config); - if(value->rx_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->rx_pdu_list = 0; - } - - uint8_t i = 0; - nfapi_rx_indication_pdu_t* pdu = 0; - while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd) - { - nfapi_tl_t generic_tl; - if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_RX_UE_INFORMATION_TAG: - { - pdu = &(value->rx_pdu_list[i++]); - pdu->rx_ue_information.tl = generic_tl; - if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) - return 0; - } - break; - case NFAPI_RX_INDICATION_REL8_TAG: - { - if(pdu != 0) - { - pdu->rx_indication_rel8.tl = generic_tl; - if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) - return 0; - - if(pdu->rx_indication_rel8.offset > 0) - { - // Need to check that the data is within the tlv - if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd) - { - // If this the first pdu set the rxPduEnd - if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd) - { - rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset; - - if(rxPduEnd > end) - { - // pdu end is past buffer end - return 0; - } - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n"); - } - } - } - } - break; - case NFAPI_RX_INDICATION_REL9_TAG: - { - if(pdu != 0) - { - pdu->rx_indication_rel9.tl = generic_tl; - if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) - return 0; - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag ); - } - break; - } - } - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_pdus; ++idx) - { - if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length; - value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config); - if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0) - { - return 0; - } - } - } - - return 1; -} - -static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) && - pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end)); -} - -static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; - return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end); -} - -static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; - return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end); -} - -static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; - uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(rachBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0) - return 0; - - if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU); - return 0; - } - - if(value->number_of_preambles > 0) - { - value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config); - if(value->preamble_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles); - return 0; - } - } - else - { - value->preamble_list = 0; - } - - - uint8_t i = 0; - for(i = 0; i < value->number_of_preambles; ++i) - { - nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value }, - { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value }, - { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value }, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; - - if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) && - pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) && - pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) && - pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) && - pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end))) - return 0; - return 1; -} - -static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; - return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end)); -} - -static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; - return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end)); -} - -static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; - return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end)); -} - -static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && - pull8(ppReadPackedMsg, &value->number_of_subbands, end) && - pull8(ppReadPackedMsg, &value->num_atennas, end))) - return 0; - - if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS) - { - // todo : add error - return 0; - } - - if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS) - { - // todo : add error - return 0; - } - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) && - pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end))) - return 0; - } - - return 1; -} - - -static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv; - uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(srsBodyEnd > end) - return 0; - - if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0) - return 0; - - if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU); - return 0; - } - - if(value->number_of_ues > 0) - { - value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config); - if(value->srs_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues); - return 0; - } - } - else - { - value->srs_pdu_list = 0; - } - - - - uint8_t i = 0; - for(i = 0; i < value->number_of_ues; ++i) - { - nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); - - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value}, - { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value}, - { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value}, - { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value}, - { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value}, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; - uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(srBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0) - return 0; - - if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU); - return 0; - } - - if(value->number_of_srs > 0) - { - value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config); - if(value->sr_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs); - return 0; - } - } - else - { - value->sr_pdu_list = 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_srs; ++i) - { - nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value }, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0) - return 0; - } - - return 1; - -} - -static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} -static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end)); - -} - -static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; - - if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end))) - return 0; - - if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n"); - return 0; - } - - if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end))) - return 0; - - return 1; -} - -static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; - - // the cqiBodyEnd points to the end of the cqi PDU's - uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length; - - //uint8_t* cqiPduEnd = cqiBodyEnd; - //uint8_t* numberOfPdusAddress = *ppReadPackedMsg; - - if(cqiBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0) - return 0; - - if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU); - return -1; - } - - if(value->number_of_cqis > 0) - { - value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config); - if(value->cqi_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); - return 0; - } - } - else - { - value->cqi_pdu_list = 0; - } - - if(value->number_of_cqis > 0) - { - value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config); - if(value->cqi_raw_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); - return 0; - } - } - else - { - value->cqi_raw_pdu_list = 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_cqis; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t)); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd) - { - nfapi_tl_t generic_tl; - if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_RX_UE_INFORMATION_TAG: - pdu->rx_ue_information.tl = generic_tl; - if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) - return 0; - break; - case NFAPI_CQI_INDICATION_REL8_TAG: - pdu->cqi_indication_rel8.tl = generic_tl; - if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0) - return 0; - - break; - case NFAPI_CQI_INDICATION_REL9_TAG: - pdu->cqi_indication_rel9.tl = generic_tl; - if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0) - return 0; - - break; - case NFAPI_UL_CQI_INFORMATION_TAG: - pdu->ul_cqi_information.tl = generic_tl; - if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0) - return 0; - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag ); - } - break; - - }; - } - } - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_cqis; ++idx) - { - if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0) - return 0; - } - else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0) - return 0; - } - } - - - return 1; - -} - -static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} -static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->mp_cca, end) && - pull32(ppReadPackedMsg, &value->n_cca, end) && - pull32(ppReadPackedMsg, &value->offset, end) && - pull32(ppReadPackedMsg, &value->lte_txop_sf, end) && - pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) && - pull32(ppReadPackedMsg, &value->lbt_mode, end)); -} - -static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->offset, end) && - pull16(ppReadPackedMsg, &value->sfn_sf_end, end) && - pull32(ppReadPackedMsg, &value->lbt_mode, end)); -} - - -static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; - - if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) - return 0; - - if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU); - return 0; - } - - if(value->number_of_pdus) - { - value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config); - if(value->lbt_dl_config_req_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->lbt_dl_config_req_pdu_list = 0; - } - - - uint16_t i; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type); - return 0; - } - } - - return 1; -} -static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->result, end) && - pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) && - pull32(ppReadPackedMsg, &value->initial_partial_sf, end)); - -} -static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->result, end)); -} - -static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; - - if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) - return 0; - - if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU); - return 0; - } - - if(value->number_of_pdus > 0) - { - value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config); - if(value->lbt_indication_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->lbt_indication_pdu_list = 0; - } - - uint16_t i; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type); - return 0; - } - } - - return 1; -} -static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; - return (pull8(ppReadPackedMsg, &value->harq_tb1, end)); -} - - -static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; - uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(nbharqBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) - return 0; - - if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); - return 0; - } - - value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config); - if(value->nb_harq_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); - return 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_harqs; ++i) - { - nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value}, - { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) - return 0; - - } - - return 1; -} - -static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv; - - return (pull16(ppReadPackedMsg, &value->rnti, end) && - pull8(ppReadPackedMsg, &value->initial_sc, end) && - pull16(ppReadPackedMsg, &value->timing_advance, end) && - pull8(ppReadPackedMsg, &value->nrach_ce_level, end)); -} - -static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; - if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){ - return 0; - } - else{ - NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code); - } - return 1; -} - -static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; - uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(nrachBodyEnd > end) - return 0; - - if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0) - return 0; - - if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU); - return 0; - } - - value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config); - if(value->nrach_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected); - return 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_initial_scs_detected; ++i) - { - nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); - - uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value}, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0) - return 0; - - } - - return 1; -} - -static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - - -// unpack length check - -static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) -{ - int retLen = 0; - - switch (msgId) - { - case NFAPI_DL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t)) - retLen = sizeof(nfapi_dl_config_request_t); - break; - - case NFAPI_UL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t)) - retLen = sizeof(nfapi_ul_config_request_t); - break; - - case NFAPI_SUBFRAME_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) - retLen = sizeof(nfapi_subframe_indication_t); - break; - - case NFAPI_HI_DCI0_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t)) - retLen = sizeof(nfapi_hi_dci0_request_t); - break; - - case NFAPI_TX_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_tx_request_t)) - retLen = sizeof(nfapi_tx_request_t); - break; - - case NFAPI_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) - retLen = sizeof(nfapi_harq_indication_t); - break; - - case NFAPI_CRC_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) - retLen = sizeof(nfapi_crc_indication_t); - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) - retLen = sizeof(nfapi_rx_indication_t); - break; - - case NFAPI_RACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) - retLen = sizeof(nfapi_rach_indication_t); - break; - - case NFAPI_SRS_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) - retLen = sizeof(nfapi_srs_indication_t); - break; - - case NFAPI_RX_SR_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) - retLen = sizeof(nfapi_sr_indication_t); - break; - - case NFAPI_RX_CQI_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) - retLen = sizeof(nfapi_cqi_indication_t); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) - retLen = sizeof(nfapi_lbt_dl_config_request_t); - break; - - case NFAPI_LBT_DL_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) - retLen = sizeof(nfapi_lbt_dl_indication_t); - break; - - case NFAPI_NB_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) - retLen = sizeof(nfapi_nb_harq_indication_t); - break; - - case NFAPI_NRACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) - retLen = sizeof(nfapi_nrach_indication_t); - break; - - case NFAPI_DL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t)) - retLen = sizeof(nfapi_dl_node_sync_t); - break; - - case NFAPI_UL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t)) - retLen = sizeof(nfapi_ul_node_sync_t); - break; - - case NFAPI_TIMING_INFO: - if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) - retLen = sizeof(nfapi_timing_info_t); - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) - retLen = sizeof(nfapi_ue_release_request_t); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) - retLen = sizeof(nfapi_ue_release_response_t); - break; - - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); - break; - } - - return retLen; -} - -static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) -{ - int retLen = 0; - - switch (msgId) - { - case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t)) - retLen = sizeof(nfapi_nr_dl_tti_request_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t)) - retLen = sizeof(nfapi_nr_ul_tti_request_t); - break; - - case NFAPI_SUBFRAME_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) - retLen = sizeof(nfapi_subframe_indication_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t)) - retLen = sizeof(nfapi_nr_ul_dci_request_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t)) - retLen = sizeof(nfapi_nr_tx_data_request_t); - break; - - case NFAPI_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) - retLen = sizeof(nfapi_harq_indication_t); - break; - - case NFAPI_CRC_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) - retLen = sizeof(nfapi_crc_indication_t); - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) - retLen = sizeof(nfapi_rx_indication_t); - break; - - case NFAPI_RACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) - retLen = sizeof(nfapi_rach_indication_t); - break; - - case NFAPI_SRS_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) - retLen = sizeof(nfapi_srs_indication_t); - break; - - case NFAPI_RX_SR_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) - retLen = sizeof(nfapi_sr_indication_t); - break; - - case NFAPI_RX_CQI_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) - retLen = sizeof(nfapi_cqi_indication_t); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) - retLen = sizeof(nfapi_lbt_dl_config_request_t); - break; - - case NFAPI_LBT_DL_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) - retLen = sizeof(nfapi_lbt_dl_indication_t); - break; - - case NFAPI_NB_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) - retLen = sizeof(nfapi_nb_harq_indication_t); - break; - - case NFAPI_NRACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) - retLen = sizeof(nfapi_nrach_indication_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t)) - retLen = sizeof(nfapi_nr_dl_node_sync_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t)) - retLen = sizeof(nfapi_nr_ul_node_sync_t); - break; - - case NFAPI_TIMING_INFO: - if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) - retLen = sizeof(nfapi_timing_info_t); - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) - retLen = sizeof(nfapi_ue_release_request_t); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) - retLen = sizeof(nfapi_ue_release_response_t); - break; - - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); - break; - } - - return retLen; -} - - - -// Main unpack functions - public - -int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) -{ - nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf; - uint8_t *pReadPackedMessage = pMessageBuf; - uint8_t *end = pMessageBuf + messageBufLen; - - if (pMessageBuf == NULL || pUnpackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n"); - return -1; - } - - if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); - return -1; - } - - // process the header - if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && - pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && - pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && - pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) - return -1; - - return 0; -} - -int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) -{ - int result = 0; - nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; - uint8_t *pReadPackedMessage = pMessageBuf; - uint8_t *end = pMessageBuf + messageBufLen; - - if (pMessageBuf == NULL || pUnpackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); - return -1; - } - - if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); - return -1; - } - /* - uint8_t *ptr = pMessageBuf; - printf("\n Read P7 message unpack: "); - while(ptr < end){ - printf(" %d ", *ptr); - ptr++; - } - printf("\n"); -*/ - // clean the supplied buffer for - tag value blanking - (void)memset(pUnpackedBuf, 0, unpackedBufLen); - - // process the header - if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && - pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && - pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && - pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); - return -1; - } - - if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); - return -1; - } - - /* - if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); - return -1; - } - */ - - // look for the specific message - switch (pMessageHeader->message_id) - { - case NFAPI_DL_CONFIG_REQUEST: - if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UL_CONFIG_REQUEST: - if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_TX_REQUEST: - if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen)) - result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_HI_DCI0_REQUEST: - if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen)) - result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) - result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_HARQ_INDICATION: - if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) - result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_CRC_INDICATION: - if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) - result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) - result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RACH_INDICATION: - if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) - result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_SRS_INDICATION: - if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) - result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_SR_INDICATION: - if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) - result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_CQI_INDICATION: - if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) - result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_INDICATION: - if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) - result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NB_HARQ_INDICATION: - if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) - result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NRACH_INDICATION: - if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) - result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_DL_NODE_SYNC: - if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen)) - result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UL_NODE_SYNC: - if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen)) - result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_TIMING_INFO: - if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) - result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) - result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - default: - - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->unpack_p7_vendor_extension) - { - result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - break; - } - - if(result == 0) - return -1; - else - return 0; -} - -int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) -{ - int result = 0; - nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; - uint8_t *pReadPackedMessage = pMessageBuf; - uint8_t *end = pMessageBuf + messageBufLen; - - if (pMessageBuf == NULL || pUnpackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); - return -1; - } - - if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); - return -1; - } - /* - uint8_t *ptr = pMessageBuf; - printf("\n Read P7 message unpack: "); - while(ptr < end){ - printf(" %d ", *ptr); - ptr++; - } - printf("\n"); -*/ - // clean the supplied buffer for - tag value blanking - (void)memset(pUnpackedBuf, 0, unpackedBufLen); - - // process the header - if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && - pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && - pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && - pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); - return -1; - } - - if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); - return -1; - } - - /* - if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); - return -1; - } - */ - - // look for the specific message - switch (pMessageHeader->message_id) - { - case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen)) - result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen)) - result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen)) - result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen)) - result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) - result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_HARQ_INDICATION: - if (check_nr_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) - result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_CRC_INDICATION: - if (check_nr_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) - result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (check_nr_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) - result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RACH_INDICATION: - if (check_nr_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) - result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_SRS_INDICATION: - if (check_nr_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) - result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_SR_INDICATION: - if (check_nr_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) - result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_CQI_INDICATION: - if (check_nr_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) - result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (check_nr_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_INDICATION: - if (check_nr_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) - result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NB_HARQ_INDICATION: - if (check_nr_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) - result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NRACH_INDICATION: - if (check_nr_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) - result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen)) - result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen)) - result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_TIMING_INFO: - if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) - result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) - result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - default: - - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->unpack_p7_vendor_extension) - { - result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - break; - } - - if(result == 0) - return -1; - else - return 0; -} - - +/* + * Copyright 2017 Cisco Systems, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + + +#include <assert.h> +#include <signal.h> +#include <sys/time.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <zlib.h> +#include <sched.h> +#include <time.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <pthread.h> +#include <stdint.h> + +#include <nfapi_interface.h> +#include <nfapi.h> +#include <debug.h> +#include "nfapi_nr_interface_scf.h" + +extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data); +extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data); + +uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len) +{ + uint32_t chksum = 0; + // calcaulte upto the checksum + chksum = crc32(chksum, buffer, 8); + + // skip the checksum + uint8_t zeros[4] = {0, 0, 0, 0}; + chksum = crc32(chksum, zeros, 4); + + // continu with the rest of the mesage + chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH); + + // return the inverse + return ~(chksum); +} + +int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len) +{ + uint32_t checksum = nfapi_calculate_checksum(buffer, len); + + uint8_t* p_write = &buffer[8]; + return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1); +} + +int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp) +{ + uint8_t* p_write = &buffer[12]; + return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1); +} + +uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len) +{ + return nfapi_calculate_checksum(buffer, len); +} + +void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config) +{ + if(size == 0) + return 0; + + void* buffer_p = NULL; + if(config && config->allocate) + { + buffer_p = (config->allocate)(size); + if(buffer_p != NULL){ + memset(buffer_p,0,size); + } + return buffer_p; + } + else + { + buffer_p = calloc(1, size); + return buffer_p; + } +} + +void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config) +{ + if(ptr == NULL) + return; + + if(config && config->deallocate) + { + return (config->deallocate)(ptr); + } + else + { + return free(ptr); + } +} +// Pack routines + + +static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; + + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format); + + return ( push8(value->dci_format, ppWritePackedMsg, end) && + push8(value->cce_idx, ppWritePackedMsg, end) && + push8(value->aggregation_level, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->mcs_1, ppWritePackedMsg, end) && + push8(value->redundancy_version_1, ppWritePackedMsg, end) && + push8(value->new_data_indicator_1, ppWritePackedMsg, end) && + push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && + push8(value->mcs_2, ppWritePackedMsg, end) && + push8(value->redundancy_version_2, ppWritePackedMsg, end) && + push8(value->new_data_indicator_2, ppWritePackedMsg, end) && + push8(value->harq_process, ppWritePackedMsg, end) && + push8(value->tpmi, ppWritePackedMsg, end) && + push8(value->pmi, ppWritePackedMsg, end) && + push8(value->precoding_information, ppWritePackedMsg, end) && + push8(value->tpc, ppWritePackedMsg, end) && + push8(value->downlink_assignment_index, ppWritePackedMsg, end) && + push8(value->ngap, ppWritePackedMsg, end) && + push8(value->transport_block_size_index, ppWritePackedMsg, end) && + push8(value->downlink_power_offset, ppWritePackedMsg, end) && + push8(value->allocate_prach_flag, ppWritePackedMsg, end) && + push8(value->preamble_index, ppWritePackedMsg, end) && + push8(value->prach_mask_index, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; + + return( push8(value->mcch_flag, ppWritePackedMsg, end) && + push8(value->mcch_change_notification, ppWritePackedMsg, end) && + push8(value->scrambling_identity, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; + + return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && + push8(value->carrier_indicator, ppWritePackedMsg, end) && + push8(value->srs_flag, ppWritePackedMsg, end) && + push8(value->srs_request, ppWritePackedMsg, end) && + push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) && + push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && + push8(value->n_dl_rb, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; + + return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; + + return ( push8(value->primary_cell_type, ppWritePackedMsg, end) && + push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) && + push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) && + pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end)); +} + +static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) && + push8(value->number_of_subbands, ppWritePackedMsg, end) && + push8(value->num_antennas, ppWritePackedMsg, end))) + return 0; + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); + + if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) && + push8(subband_info->scheduled_ues, ppWritePackedMsg, end))) + return 0; + + + uint8_t antenna_idx = 0; + uint8_t scheduled_ue_idx = 0; + + for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) + { + for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) + { + if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end)) + return 0; + } + } + + } + + + return 1; + +} + + +static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; + + return( + push16(value->bwp_size, ppWritePackedMsg, end) && + push16(value->bwp_start, ppWritePackedMsg, end) && + + push8(value->subcarrier_spacing, ppWritePackedMsg, end) && + push8(value->cyclic_prefix, ppWritePackedMsg, end) && + + push16(value->start_rb, ppWritePackedMsg, end) && + push16(value->nr_of_rbs, ppWritePackedMsg, end) && + + push8(value->csi_type, ppWritePackedMsg, end) && + push8(value->row, ppWritePackedMsg, end) && + + push16(value->freq_domain, ppWritePackedMsg, end) && + push8(value->symb_l0, ppWritePackedMsg, end) && + + push8(value->symb_l1, ppWritePackedMsg, end) && + push8(value->cdm_type, ppWritePackedMsg, end) && + + push8(value->freq_density, ppWritePackedMsg, end) && + push16(value->scramb_id, ppWritePackedMsg, end) && + + push8(value->power_control_offset, ppWritePackedMsg, end) && + push8(value->power_control_offset_ss, ppWritePackedMsg, end) + ); + +} + + +static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; + + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) && + push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && + + push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && + push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) && + push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && + push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && + + push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && + push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && + pusharray8(value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)); + + return 0; + } + + // TODO: resolve the packaging of array (currently sending a single element) + return( + push16(value->BWPSize, ppWritePackedMsg, end) && + push16(value->BWPStart, ppWritePackedMsg, end) && + push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && + push8(value->CyclicPrefix, ppWritePackedMsg, end) && + + push8(value->StartSymbolIndex, ppWritePackedMsg, end) && + push8(value->DurationSymbols, ppWritePackedMsg, end) && + pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) && + push8(value->CceRegMappingType, ppWritePackedMsg, end) && + + push8(value->RegBundleSize, ppWritePackedMsg, end) && + push8(value->InterleaverSize, ppWritePackedMsg, end) && + push8(value->CoreSetType, ppWritePackedMsg, end) && + push16(value->ShiftIndex, ppWritePackedMsg, end) && + + push8(value->precoderGranularity, ppWritePackedMsg, end) && + push16(value->numDlDci, ppWritePackedMsg, end)); + +} + + +static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; + + // TODO: resolve the packaging of array (currently sending a single element) + return( + push16(value->pduBitmap, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push16(value->pduIndex, ppWritePackedMsg, end) && + push16(value->BWPSize, ppWritePackedMsg, end) && + + push16(value->BWPStart, ppWritePackedMsg, end) && + push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && + push8(value->CyclicPrefix, ppWritePackedMsg, end) && + push8(value->NrOfCodewords, ppWritePackedMsg, end) && + + pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) && + pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) && + pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) && + pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) && + + pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) && + pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) && + push16(value->dataScramblingId, ppWritePackedMsg, end) && + push8(value->nrOfLayers, ppWritePackedMsg, end) && + + push8(value->transmissionScheme, ppWritePackedMsg, end) && + push8(value->refPoint, ppWritePackedMsg, end) && + push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) && + push8(value->dmrsConfigType, ppWritePackedMsg, end) && + + push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) && + push8(value->SCID, ppWritePackedMsg, end) && + push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) && + push16(value->dmrsPorts, ppWritePackedMsg, end) && + + push8(value->resourceAlloc, ppWritePackedMsg, end) && + push16(value->rbStart, ppWritePackedMsg, end) && + push16(value->rbSize, ppWritePackedMsg, end) && + + push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) && + push8(value->StartSymbolIndex, ppWritePackedMsg, end) && + push8(value->NrOfSymbols, ppWritePackedMsg, end) && + push8(value->PTRSPortIndex, ppWritePackedMsg, end) && + + push8(value->PTRSTimeDensity, ppWritePackedMsg, end) && + push8(value->PTRSFreqDensity, ppWritePackedMsg, end) && + push8(value->PTRSReOffset, ppWritePackedMsg, end) + ); + +} + + +static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; + + return( + push16(value->PhysCellId, ppWritePackedMsg, end) && + push8(value->BetaPss, ppWritePackedMsg, end) && + push8(value->SsbBlockIndex, ppWritePackedMsg, end) && + push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) && + push16(value->ssbOffsetPointA, ppWritePackedMsg, end) && + push8(value->bchPayloadFlag, ppWritePackedMsg, end) && + push32(value->bchPayload, ppWritePackedMsg, end) + // TODO: pack precoding_and_beamforming too + ); + +} + + +static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; + + return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) && + push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) && + push8(value->initial_lbt_sf, ppWritePackedMsg, end) && + push8(value->codebook_size_determination, ppWritePackedMsg, end) && + push8(value->drms_table_flag, ppWritePackedMsg, end) && + push8(value->tpm_struct_flag, ppWritePackedMsg, end) && + (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1)); +} + +static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; + + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__); + + return( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; + + return ( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->modulation, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push16(value->mbsfn_area_id, ppWritePackedMsg, end)); +} + +static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem; + + return ( push8(bf->subband_index, ppWritePackedMsg, end) && + push8(bf->num_antennas, ppWritePackedMsg, end) && + pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end)); + + +} +static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; + + return ( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->modulation, ppWritePackedMsg, end) && + push8(value->redundancy_version, ppWritePackedMsg, end) && + push8(value->transport_blocks, ppWritePackedMsg, end) && + push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && + push8(value->transmission_scheme, ppWritePackedMsg, end) && + push8(value->number_of_layers, ppWritePackedMsg, end) && + push8(value->number_of_subbands, ppWritePackedMsg, end) && + pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) && + push8(value->ue_category_capacity, ppWritePackedMsg, end) && + push8(value->pa, ppWritePackedMsg, end) && + push8(value->delta_power_offset_index, ppWritePackedMsg, end) && + push8(value->ngap, ppWritePackedMsg, end) && + push8(value->nprb, ppWritePackedMsg, end) && + push8(value->transmission_mode, ppWritePackedMsg, end) && + push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) && + push8(value->num_bf_vector, ppWritePackedMsg, end) && + packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info)); + +} +static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; + return ( push8(value->nscid, ppWritePackedMsg, end) ); +} +static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; + + return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) && + push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && + push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && + push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && + pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && + push8(value->pdsch_start, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; + + return( push8(value->drms_config_flag, ppWritePackedMsg, end) && + push16(value->drms_scrambling, ppWritePackedMsg, end) && + push8(value->csi_config_flag, ppWritePackedMsg, end) && + push16(value->csi_scrambling, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; + + return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) && + push8(value->maxlayers, ppWritePackedMsg, end) && + push8(value->n_dl_harq, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; + + return( push8(value->dwpts_symbols, ppWritePackedMsg, end) && + push8(value->initial_lbt_sf, ppWritePackedMsg, end) && + push8(value->ue_type, ppWritePackedMsg, end) && + push8(value->pdsch_payload_type, ppWritePackedMsg, end) && + push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && + push8(value->drms_table_flag, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; + + return( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->p_rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->mcs, ppWritePackedMsg, end) && + push8(value->redundancy_version, ppWritePackedMsg, end) && + push8(value->number_of_transport_blocks, ppWritePackedMsg, end) && + push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && + push8(value->transmission_scheme, ppWritePackedMsg, end) && + push8(value->number_of_layers, ppWritePackedMsg, end) && + push8(value->codebook_index, ppWritePackedMsg, end) && + push8(value->ue_category_capacity, ppWritePackedMsg, end) && + push8(value->pa, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push8(value->nprb, ppWritePackedMsg, end) && + push8(value->ngap, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; + + return ( push8(value->ue_mode, ppWritePackedMsg, end) && + push16(value->initial_transmission_sf_io, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; + + return( push16(value->transmission_power, ppWritePackedMsg, end) && + push8(value->prs_bandwidth, ppWritePackedMsg, end) && + push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) && + push8(value->prs_muting, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; + + return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) && + push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && + push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) && + pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; + + if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) && + push8(value->cdm_type, ppWritePackedMsg, end) && + push8(value->num_bf_vector, ppWritePackedMsg, end))) + { + return 0; + } + + uint16_t i; + for(i = 0; i < value->num_bf_vector; ++i) + { + if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) && + pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end))) + return 0; + } + + return 1; +} +static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(vector->subband_index, ppWritePackedMsg, end) && + push8(vector->num_antennas, ppWritePackedMsg, end) && + pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; + + return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) && + push16(value->epdcch_id, ppWritePackedMsg, end) && + push8(value->epdcch_start_symbol, ppWritePackedMsg, end) && + push8(value->epdcch_num_prb, ppWritePackedMsg, end) && + pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) && + pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; + + return (push8(value->dwpts_symbols, ppWritePackedMsg, end) && + push8(value->initial_lbt_sf, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; + + return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) && + push8(value->number_of_prb_pairs, ppWritePackedMsg, end) && + push8(value->resource_block_assignment, ppWritePackedMsg, end) && + push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) && + push8(value->start_symbol, ppWritePackedMsg, end) && + push8(value->ecce_index, ppWritePackedMsg, end) && + push8(value->aggregation_level, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->ce_mode, ppWritePackedMsg, end) && + push16(value->drms_scrambling_init, ppWritePackedMsg, end) && + push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push8(value->dci_format, ppWritePackedMsg, end) && + push16(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->mcs, ppWritePackedMsg, end) && + push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) && + push8(value->redundancy_version, ppWritePackedMsg, end) && + push8(value->new_data_indicator, ppWritePackedMsg, end) && + push8(value->harq_process, ppWritePackedMsg, end) && + push8(value->tpmi_length, ppWritePackedMsg, end) && + push8(value->tpmi, ppWritePackedMsg, end) && + push8(value->pmi_flag, ppWritePackedMsg, end) && + push8(value->pmi, ppWritePackedMsg, end) && + push8(value->harq_resource_offset, ppWritePackedMsg, end) && + push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && + push8(value->tpc, ppWritePackedMsg, end) && + push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) && + push8(value->downlink_assignment_index, ppWritePackedMsg, end) && + push8(value->allocate_prach_flag, ppWritePackedMsg, end) && + push8(value->preamble_index, ppWritePackedMsg, end) && + push8(value->prach_mask_index, ppWritePackedMsg, end) && + push8(value->starting_ce_level, ppWritePackedMsg, end) && + push8(value->srs_request, ppWritePackedMsg, end) && + push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) && + push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) && + push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && + push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) && + push8(value->direct_indication, ppWritePackedMsg, end) && + push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && + push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) && + pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end)); +} + + +static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; + + return (push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end)); +} + + +static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; + + return (push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push8(value->ncce_index, ppWritePackedMsg, end) && + push8(value->aggregation_level, ppWritePackedMsg, end) && + push8(value->start_symbol, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && + push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && + push8(value->dci_format, ppWritePackedMsg, end) && + push8(value->scheduling_delay, ppWritePackedMsg, end) && + push8(value->resource_assignment, ppWritePackedMsg, end) && + push8(value->repetition_number, ppWritePackedMsg, end) && + push8(value->mcs, ppWritePackedMsg, end) && + push8(value->new_data_indicator, ppWritePackedMsg, end) && + push8(value->harq_ack_resource, ppWritePackedMsg, end) && + push8(value->npdcch_order_indication, ppWritePackedMsg, end) && + push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) && + push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) && + push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) && + push8(value->direct_indication, ppWritePackedMsg, end) && + push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && + push8(value->total_dci_length_including_padding, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; + + return (push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push8(value->start_symbol, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push16(value->resource_assignment, ppWritePackedMsg, end) && + push16(value->repetition_number, ppWritePackedMsg, end) && + push8(value->modulation, ppWritePackedMsg, end) && + push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) && + push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && + push16(value->sf_idx, ppWritePackedMsg, end) && + push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end)); +} + + +static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv; + + if(!(push16(value->PDUSize, ppWritePackedMsg, end) && + push16(value->PDUType, ppWritePackedMsg, end) )) + return 0; + + + // first match the pdu type, then call the respective function + switch(value->PDUType) + { + case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: + { + if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + + case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: + { + if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: + { + if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: + { + if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); + } + break; + } + + return 1; +} + +static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; + + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich); + + if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) && + push8(value->number_dci, ppWritePackedMsg, end) && + push16(value->number_pdu, ppWritePackedMsg, end) && + push8(value->number_pdsch_rnti, ppWritePackedMsg, end) && + push16(value->transmission_power_pcfich, ppWritePackedMsg, end))) + { + return 0; + } + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_pdu; + for(; i < total_number_of_pdus; ++i) + { + nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); + + if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: + { + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__); + + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value))) + { + return 0; + } + } + break; + case NFAPI_DL_CONFIG_BCH_PDU_TYPE: + { + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__); + + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_MCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_PCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_PRS_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) & + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value))) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + } + + return 1; +} + + +static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; + + if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && + push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) && + push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) && + pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end) + //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) + )) + return 0; + + int arr[12]; + for(int i=0;i<pNfapiMsg->dl_tti_request_body.nGroup;i++) + { + for(int j=0;j<pNfapiMsg->dl_tti_request_body.nUe[i];j++) + { + arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; + } + if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end))) + return 0; + } + + for(int i=0;i<pNfapiMsg->dl_tti_request_body.nPDUs;i++) + { + if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end)) + return 0; + } + +return 1; +} + + +static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; + + //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) && + //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + { + uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); + uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value); + uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + + if (!x || !y || !z) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z); + } + + return x && y && z; + } +} + + + + +static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end) +{ + nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; + + return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; + + return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && + push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; + + return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; + + return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end)); +} + +//Pack fns for ul_tti PDUS + + +static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return( + push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) && + push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) && + push8(prach_pdu->prach_format, ppWritePackedMsg, end) && + push8(prach_pdu->num_ra, ppWritePackedMsg, end) && + push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) && + push16(prach_pdu->num_cs, ppWritePackedMsg, end) + // TODO: ignoring beamforming tlv for now + ); + +} + +static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return( + push16(pucch_pdu->rnti, ppWritePackedMsg, end) && + push32(pucch_pdu->handle, ppWritePackedMsg, end) && + push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) && + push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) && + push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && + push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) && + push8(pucch_pdu->format_type, ppWritePackedMsg, end) && + push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) && + push16(pucch_pdu->prb_start, ppWritePackedMsg, end) && + push16(pucch_pdu->prb_size, ppWritePackedMsg, end) && + push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) && + push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) && + push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) && + push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) && + push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) && + push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) && + push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) && + push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) && + push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) && + push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) && + push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) && + push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) && + push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) && + push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) && + push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) && + push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) && + push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) && + push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) && + push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end) + // TODO: ignoring beamforming tlv for now + ); + +} + + +static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + + if (!( + push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) && + push16(pusch_pdu->rnti, ppWritePackedMsg, end) && + push32(pusch_pdu->handle, ppWritePackedMsg, end) && + push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) && + push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) && + push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && + push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) && + push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) && + push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) && + push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) && + push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) && + push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) && + push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) && + push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) && + push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) && + push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) && + push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) && + push8(pusch_pdu->scid, ppWritePackedMsg, end) && + push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) && + push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && + push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) && + push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) && + push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && + push16(pusch_pdu->rb_start, ppWritePackedMsg, end) && + push16(pusch_pdu->rb_size, ppWritePackedMsg, end) && + push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) && + push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) && + push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) && + push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) && + push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) && + push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end) + // TODO: ignoring beamforming tlv for now + )) + return 0; + + + //Pack Optional Data only included if indicated in pduBitmap + switch(pusch_pdu->pdu_bit_map){ + case PUSCH_PDU_BITMAP_PUSCH_DATA: + { + // pack optional TLVs + return( + push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) && + push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) && + pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_UCI: + { + return( + push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_PTRS: + { + return( + push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_DFTS_OFDM: + { + return( + push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) && + push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) && + push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) && + push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end) + ); + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); + } + } + + return 1; +} + +static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return( + push16(srs_pdu->rnti, ppWritePackedMsg, end) && + push32(srs_pdu->handle, ppWritePackedMsg, end) && + push16(srs_pdu->bwp_size, ppWritePackedMsg, end) && + push16(srs_pdu->bwp_start, ppWritePackedMsg, end) && + push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) && + push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) && + push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) && + push8(srs_pdu->num_symbols, ppWritePackedMsg, end) && + push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) && + push8(srs_pdu->time_start_position, ppWritePackedMsg, end) && + push8(srs_pdu->config_index, ppWritePackedMsg, end) && + push16(srs_pdu->sequence_id, ppWritePackedMsg, end) && + push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) && + push8(srs_pdu->comb_size, ppWritePackedMsg, end) && + push8(srs_pdu->comb_offset, ppWritePackedMsg, end) && + push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) && + push8(srs_pdu->frequency_position, ppWritePackedMsg, end) && + push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) && + push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) && + push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) && + push8(srs_pdu->resource_type, ppWritePackedMsg, end) && + push16(srs_pdu->t_srs, ppWritePackedMsg, end) && + push16(srs_pdu->t_offset, ppWritePackedMsg, end) + + // TODO: ignoring beamforming tlv for now + ); + +} + +static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value)); +} + +static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; + + return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; + + if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end))) + { + return 0; + } + + switch(cqi_ri_info_rel9->report_type) + { + case NFAPI_CSI_REPORT_TYPE_PERIODIC: + { + if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end))) + { + return 0; + } + } + break; + case NFAPI_CSI_REPORT_TYPE_APERIODIC: + { + if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0) + return 0; + + uint8_t i; + for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) + { + if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0) + return 0; + + uint8_t j; + for(j = 0; j < 8; ++j) + { + if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0) + return 0; + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); + } + break; + }; + + return 1; +} + +static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; + + switch(cqi_ri_info_rel13->report_type) + { + case NFAPI_CSI_REPORT_TYPE_PERIODIC: + { + if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0) + return 0; + } + break; + case NFAPI_CSI_REPORT_TYPE_APERIODIC: + { + // No parameters + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type ); + } + break; + }; + + return 1; +} + +static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value)); + +} + +static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; + + return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) && + push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value); +} + +static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; + + return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) && + push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) && + push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; + + return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && + push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value)); +} + +static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; + + return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) && + push16(ue_info_rel8->rnti, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; + + return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && + push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; + + return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) && + push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) && + push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && + push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value)); +} + +static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; + + return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) && + push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) && + push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; + + return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) && + push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; + + return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) && + push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) && + push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; + + return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; + + return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && + push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) && + push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) && + push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) && + push8(harq_info_rel13->n_srs, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value)); + +} + +static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; + + return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) && + push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; + + return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) && + push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; + + return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) && + push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) && + push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) && + push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) && + push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) && + push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value)); + +} + +static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; + return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end); +} +static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; + + return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) && + push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value)); +} + +static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; + + return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->size, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; + return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end); +} + +static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; + + return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; + + return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; + + return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) && + push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) && + pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value)); +} +static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; + + return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) && + push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) && + push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end)); + +} + + + +static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv; + + if(!(push16(value->pdu_size, ppWritePackedMsg, end) && + push16(value->pdu_type, ppWritePackedMsg, end) )) + return 0; + + + // first match the pdu type, then call the respective function + switch(value->pdu_type) + { + case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: + { + if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: + { + if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: + { + if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: + { + if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type ); + } + break; + } + + return 1; +} + +static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv; + + if(!push8(value->n_ue, ppWritePackedMsg, end)) + return 0; + for(int i=0; i<value->n_ue;i++) + { + if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end)) + return 0; + } + return 1; +} + +static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; + + if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) && + push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) && + push8(value->srs_present, ppWritePackedMsg, end))) + return 0; + + uint16_t i = 0; + for(i = 0; i < value->number_of_pdus; ++i) + { + nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); + + if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: + { + if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end)) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && + pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) && + pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && + pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) && + pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_SRS_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value))) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + + } + return 1; +} + + +static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; + + if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && + push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) && + push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) && + push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) && + push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) && + push8(pNfapiMsg->n_group, ppWritePackedMsg, end) )) + return 0; + + for(int i=0; i<pNfapiMsg->n_pdus; i++) + { + if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end)) + return 0; + } + + for(int i=0; i<pNfapiMsg->n_group; i++) + { + if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end)) + return 0; + + } + + return 1; +} + + +static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ; +} + +static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; + + return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && + push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && + push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) && + push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) && + push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; + + return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) && + push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; + + return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) && + push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) && + push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) && + push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; + + return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && + push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; + + return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) && + push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; + + return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) && + push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) && + pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end)); + +} + +static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; + + return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && + push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end)); +} + + +static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; + + if(!(push16(value->sfnsf, ppWritePackedMsg, end) && + push8(value->number_of_dci, ppWritePackedMsg, end) && + push8(value->number_of_hi, ppWritePackedMsg, end))) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); + + if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_HI_DCI0_HI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value))) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + + } + + return 1; +} + +static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv; + + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && + + push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && + + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && + + pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)); + + return 0; + } + + return (push16(value->PDUType, ppWritePackedMsg, end) && + push16(value->PDUSize, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) && + + push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) && + pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) && + + push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end)); + +} + +static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; + + if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && + push8(pNfapiMsg->numPdus, ppWritePackedMsg, end) + )) + return 0; + + for(int i=0; i<pNfapiMsg->numPdus; i++) + { + if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end)) + return 0; + } + return 1; + + +} + + + +static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +//pack_tx_data_pdu_list_value +static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv; + + if(!(push32(value->num_TLV, ppWritePackedMsg, end) && + push16(value->PDU_index, ppWritePackedMsg, end) && + push16(value->PDU_length, ppWritePackedMsg, end) + )) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_tlvs = value->num_TLV; + for(; i < total_number_of_tlvs; ++i) + { + + if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) && + push16(value->TLVs[i].tag, ppWritePackedMsg, end))) + return 0; + + switch(value->TLVs[i].tag) + { + case 0: + { + if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end)) + return 0; + break; + + } + + case 1: + { + if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end)) + return 0; + break; + + } + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag ); + break; + } + + } + } + return 1; +} + +static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv; + + if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(; i < total_number_of_pdus; ++i) + { + nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]); + + if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) && + push16(pdu->pdu_index, ppWritePackedMsg, end))) + return 0; + + uint8_t j; + for(j = 0; j < pdu->num_segments; ++j) + { + // Use -1 as it is unbounded + // DJP - does not handle -1 + // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0) + int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end); + + if (pdu->segments[j].segment_length == 3) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, + pdu->segments[j].segment_data[0], + pdu->segments[j].segment_data[1], + pdu->segments[j].segment_data[2] + ); + } + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret); + + if (push_ret == 0) + { + return 0; + } + } + } + + return 1; +} + +static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; + + if (!( + push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && + push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end) + )) + return 0; + + for(int i=0; i<pNfapiMsg->Number_of_PDUs; i++) + { + if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end)) + return 0; + } + + return 1; +} + +static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; + + int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); + int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value); + int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z); + + return x && y && z; +} + +static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv; + if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){ + return 0; + } + + uint8_t j; + uint16_t num = value->number_of_TLVs; + for(j = 0; j < num; ++j){ + if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){ + return 0; + } + } + return 1; +} + +static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; + int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); + int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value); + int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + return x && y && z; +} + +static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + + nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; + + int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end); + int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + return x && z; +} + +static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) ); +} + +static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; + + return ( pull32(ppReadPackedMsg, &value->handle, end) && + pull16(ppReadPackedMsg, &value->rnti, end)); +} + +static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) && + push8(data->value_1, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) && + push8(data->value_1, ppWritePackedMsg, end) && + push8(data->value_2, ppWritePackedMsg, end) && + push8(data->value_3, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) ); +} + +static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) ); +} + +static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv; + + if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) && + push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end))) + return 0; + + uint8_t result = 0; + switch(harq_indication_tdd_rel8->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = 1; + break; + default: + // err.... + break; + } + + return result; + +} + +static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv; + + if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) && + push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end))) + return 0; + + uint8_t idx; + for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + + switch(harq_indication_tdd_rel9->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end); + break; + default: + // err.... + break; + } + + if(result == 0) + return 0; + } + + return 1; +} + +static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv; + + if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) && + push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end))) + return 0; + + uint8_t idx; + for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + switch(harq_indication_tdd_rel13->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end); + break; + default: + // err.... + break; + } + + if(result == 0) + return 0; + } + + return 1; +} + +static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv; + + return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) && + push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv; + + return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) && + push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) && + pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv; + + return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) && + push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) && + pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; + + return ( push8(value->ul_cqi, ppWritePackedMsg, end) && + push8(value->channel, ppWritePackedMsg, end)); + +} + +static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; + + if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_harqs; + for(; i < total_number_of_pdus; ++i) + { + nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) && + pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) && + pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) && + pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) && + pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) && + pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv; + + return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) ); +} + +static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; + + if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_crcs; + for(; i < total_number_of_pdus; ++i) + { + nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + return 1; +} + +static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} +static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; + + return ( push16(value->length, ppWritePackedMsg, end) && + push16(value->offset, ppWritePackedMsg, end) && + push8(value->ul_cqi, ppWritePackedMsg, end) && + push16(value->timing_advance, ppWritePackedMsg, end)); +} +static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; + + return ( push16(value->timing_advance_r9, ppWritePackedMsg, end)); +} + +static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; + + //printf("RX ULSCH BODY\n"); + + if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + // need to calculate the data offset's. + uint16_t i = 0; + uint16_t offset = 2; // taking into account the number_of_pdus + uint16_t total_number_of_pdus = value->number_of_pdus; + //printf("ULSCH:pdus:%d\n", total_number_of_pdus); + + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) + { + //printf("NFAPI_RX_UE_INFORMATION_TAG\n"); + offset += 4 + 6; + } + + if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + //printf("NFAPI_RX_INDICATION_REL8_TAG\n"); + offset += 4 + 7; + } + + if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG) + { + //printf("NFAPI_RX_INDICATION_REL9_TAG\n"); + offset += 4 + 2; + } + } + + // Now update the structure to include the offset + for(i =0; i < total_number_of_pdus; ++i) + { + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + + if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + if(pdu->rx_indication_rel8.offset == 1) + { + pdu->rx_indication_rel8.offset = offset; + offset += pdu->rx_indication_rel8.length; + } + } + } + + // Write out the pdu + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) && + pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value))) + return 0; + } + + // Write out the pdu data + for(i = 0; i < total_number_of_pdus; ++i) + { + uint16_t length = 0; + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + + if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + length = pdu->rx_indication_rel8.length; + } + + if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0) + return 0; + } + return 1; +} + + +static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; + + return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) && + push8(preamble_rel8->preamble, ppWritePackedMsg, end) && + push16(preamble_rel8->timing_advance, ppWritePackedMsg, end)); +} +static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; + + return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) ); +} +static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; + + return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) ); +} + +static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; + + if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_preambles; + for(; i < total_number_of_pdus; ++i) + { + nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) && + pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) && + pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; + + return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) && + pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end)); +} + +static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; + + return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) ); +} + +static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; + + return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) ); + +} + +static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; + + return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ; +} + +static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; + + if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) && + push8(value->number_of_subbands, ppWritePackedMsg, end) && + push8(value->num_atennas, ppWritePackedMsg, end))) + return 0; + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) && + pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end))) + return 0; + } + + return 1; +} + +static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv; + + if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_ues; + for(; i < total_number_of_pdus; ++i) + { + nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) && + pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) && + pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) && + pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) && + pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) && + pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} + +static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; + + if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_srs; + for(; i < total_number_of_pdus; ++i) + { + nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + return 1; +} + +static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} + +static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; + + return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) && + push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) && + push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) && + push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) && + push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end)); +} + +static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; + + return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) && + push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) && + push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) && + push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && + pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && + push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) && + push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end)); +} + +static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; + + if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0) + return 0; + + // need to calculate the data offset's. This very bittle due the hardcoding + // of the sizes. can not use the sizeof as we have an array for the Rel9 + // info + uint16_t i = 0; + uint16_t offset = 2; // taking into account the number_of_cqis + uint16_t total_number_of_pdus = value->number_of_cqis; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + offset += 2; // for the instance length + + if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) + { + offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t) + } + + if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + offset += 4 + 8; + } + + if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported; + } + + if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG) + { + offset += 4 + 2; + } + } + + // Now update the structure to include the offset + for(i =0; i < total_number_of_pdus; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + if(pdu->cqi_indication_rel8.data_offset == 1) + { + pdu->cqi_indication_rel8.data_offset = offset; + offset += pdu->cqi_indication_rel8.length; + } + } + + if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + if(pdu->cqi_indication_rel9.data_offset == 1) + { + pdu->cqi_indication_rel9.data_offset = offset; + offset += pdu->cqi_indication_rel9.length; + } + } + + } + + // Write out the cqi information + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) && + pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) && + pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + + } + + // Write out the cqi raw data + for(i = 0; i < total_number_of_pdus; ++i) + { + uint16_t length = 0; + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + length = pdu->cqi_indication_rel8.length; + } + + if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + length = pdu->cqi_indication_rel9.length; + } + + if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0) + return 0; + } + + return 1; +} + +static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} + +static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->mp_cca, ppWritePackedMsg, end) && + push32(value->n_cca, ppWritePackedMsg, end) && + push32(value->offset, ppWritePackedMsg, end) && + push32(value->lte_txop_sf, ppWritePackedMsg, end) && + push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) && + push32(value->lbt_mode, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->offset, ppWritePackedMsg, end) && + push16(value->sfn_sf_end, ppWritePackedMsg, end) && + push32(value->lbt_mode, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; + + if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); + + if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: + { + if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0) + return 0; + } + break; + case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: + { + if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + } + + return 1; +} + +static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->result, ppWritePackedMsg, end) && + push32(value->lte_txop_symbols, ppWritePackedMsg, end) && + push32(value->initial_partial_sf, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->result, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; + + if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); + + if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: + { + if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0) + return 0; + } + break; + case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: + { + if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + } + + return 1; +} + +static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; + + return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) ); +} + +static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; + + if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_harqs = value->number_of_harqs; + for(; i < total_number_of_harqs; ++i) + { + nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + + +static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv; + + return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) && + push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) && + push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) && + push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end)); +} + + +static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; + + if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected; + for(; i < total_number_of_initial_scs_detected; ++i) + { + nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); + + //uint8_t* instance_length_p = *ppWritePackedMsg; + //if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + // return 0; + + if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + //push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; + + return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; + + return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; + + return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + push32(pNfapiMsg->t2, ppWritePackedMsg, end) && + push32(pNfapiMsg->t3, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; + + return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + push32(pNfapiMsg->t2, ppWritePackedMsg, end) && + push32(pNfapiMsg->t3, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; + + return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) && + push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && + push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; + + return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) && + push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) && + push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && + push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + + + +// Main pack function - public + +int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) +{ + nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; + uint8_t *pWritePackedMessage = pPackedBuf; + uint8_t *pPackedLengthField = &pWritePackedMessage[4]; + uint8_t *end = pPackedBuf + packedBufLen; + + if (pMessageBuf == NULL || pPackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); + return -1; + } + /* + printf("\n P7 MESSAGE SENT: \n"); + for(int i=0; i< packedBufLen; i++){ + printf("%d", *(uint8_t *)(pMessageBuf + i)); + } + printf("\n"); + */ + // process the header + if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && + push16(pMessageHeader->message_id, &pWritePackedMessage, end) && + push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && + push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && + push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && + push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); + return -1; + } + + if (pMessageHeader->message_id != NFAPI_TIMING_INFO) + { + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); + } + // look for the specific message + uint8_t result = 0; + switch (pMessageHeader->message_id) + { + case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: + result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: + result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: + result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: + result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_REQUEST: + result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_HARQ_INDICATION: + result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_CRC_INDICATION: + result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_ULSCH_INDICATION: + //printf("RX ULSCH\n"); + result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RACH_INDICATION: + result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_SRS_INDICATION: + result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_SR_INDICATION: + result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_CQI_INDICATION: + result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_INDICATION: + result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NB_HARQ_INDICATION: + result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NRACH_INDICATION: + result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: + result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: + result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_TIMING_INFO: + result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config); + break; + + default: + { + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->pack_p7_vendor_extension) + { + result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + } + break; + } + + if(result == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); + return -1; + } + + // check for a valid message length + uintptr_t msgHead = (uintptr_t)pPackedBuf; + uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; + uint32_t packedMsgLen = msgEnd - msgHead; + uint16_t packedMsgLen16; + if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); + return -1; + } + else + { + packedMsgLen16 = (uint16_t)packedMsgLen; + } + + // Update the message length in the header + pMessageHeader->message_length = packedMsgLen16; + + if(!push16(packedMsgLen16, &pPackedLengthField, end)) + return -1; + + if(1) + { + //quick test + if(pMessageHeader->message_length != packedMsgLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); + } + } + + return (packedMsgLen); +} + +int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) +{ + nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; + uint8_t *pWritePackedMessage = pPackedBuf; + uint8_t *pPackedLengthField = &pWritePackedMessage[4]; + uint8_t *end = pPackedBuf + packedBufLen; + + if (pMessageBuf == NULL || pPackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); + return -1; + } + /* + printf("\n P7 MESSAGE SENT: \n"); + for(int i=0; i< packedBufLen; i++){ + printf("%d", *(uint8_t *)(pMessageBuf + i)); + } + printf("\n"); + */ + // process the header + if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && + push16(pMessageHeader->message_id, &pWritePackedMessage, end) && + push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && + push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && + push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && + push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); + return -1; + } + + if (pMessageHeader->message_id != NFAPI_TIMING_INFO) + { + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); + } + // look for the specific message + uint8_t result = 0; + switch (pMessageHeader->message_id) + { + case NFAPI_DL_CONFIG_REQUEST: + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__); + result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UL_CONFIG_REQUEST: + result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_TX_REQUEST: + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__); + result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_HI_DCI0_REQUEST: + result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_REQUEST: + result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_HARQ_INDICATION: + result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_CRC_INDICATION: + result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_ULSCH_INDICATION: + //printf("RX ULSCH\n"); + result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RACH_INDICATION: + result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_SRS_INDICATION: + result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_SR_INDICATION: + result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_CQI_INDICATION: + result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_INDICATION: + result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NB_HARQ_INDICATION: + result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NRACH_INDICATION: + result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_DL_NODE_SYNC: + result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UL_NODE_SYNC: + result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_TIMING_INFO: + result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config); + break; + + default: + { + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->pack_p7_vendor_extension) + { + result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + } + break; + } + + if(result == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); + return -1; + } + + // check for a valid message length + uintptr_t msgHead = (uintptr_t)pPackedBuf; + uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; + uint32_t packedMsgLen = msgEnd - msgHead; + uint16_t packedMsgLen16; + if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); + return -1; + } + else + { + packedMsgLen16 = (uint16_t)packedMsgLen; + } + + // Update the message length in the header + pMessageHeader->message_length = packedMsgLen16; + + if(!push16(packedMsgLen16, &pPackedLengthField, end)) + return -1; + + if(1) + { + //quick test + if(pMessageHeader->message_length != packedMsgLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); + } + } + + return (packedMsgLen); +} + +// Unpack routines +// NR: +static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; + + return( + pull16(ppReadPackedMsg, &value->bwp_size, end) && + pull16(ppReadPackedMsg, &value->bwp_start, end) && + + pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &value->cyclic_prefix, end) && + + pull16(ppReadPackedMsg, &value->start_rb, end) && + pull16(ppReadPackedMsg, &value->nr_of_rbs, end) && + + pull8(ppReadPackedMsg, &value->csi_type, end) && + pull8(ppReadPackedMsg, &value->row, end) && + + pull16(ppReadPackedMsg, &value->freq_domain, end) && + pull8(ppReadPackedMsg, &value->symb_l0, end) && + + pull8(ppReadPackedMsg, &value->symb_l1, end) && + pull8(ppReadPackedMsg, &value->cdm_type, end) && + + pull8(ppReadPackedMsg, &value->freq_density, end) && + pull16(ppReadPackedMsg, &value->scramb_id, end) && + + pull8(ppReadPackedMsg, &value->power_control_offset, end) && + pull8(ppReadPackedMsg, &value->power_control_offset_ss, end) + ); + +} + + +static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; + + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) && + pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) && + + pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) && + pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) && + pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) && + pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) && + + pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) && + pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) && + + pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, end)); + + return 0; + } + + // TODO: resolve the packaging of array (currently sending a single element) + return( + pull16(ppReadPackedMsg, &value->BWPSize, end) && + pull16(ppReadPackedMsg, &value->BWPStart, end) && + pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && + pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && + + pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && + pull8(ppReadPackedMsg, &value->DurationSymbols, end) && + pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) && + pull8(ppReadPackedMsg, &value->CceRegMappingType, end) && + + pull8(ppReadPackedMsg, &value->RegBundleSize, end) && + pull8(ppReadPackedMsg, &value->InterleaverSize, end) && + pull8(ppReadPackedMsg, &value->CoreSetType, end) && + pull16(ppReadPackedMsg, &value->ShiftIndex, end) && + + pull8(ppReadPackedMsg, &value->precoderGranularity, end) && + pull16(ppReadPackedMsg, &value->numDlDci, end)); + +} + + +static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; + + // TODO: resolve the packaging of array (currently sending a single element) + return( + pull16(ppReadPackedMsg, &value->pduBitmap, end) && + pull16(ppReadPackedMsg, &value->rnti, end) && + pull16(ppReadPackedMsg, &value->pduIndex, end) && + pull16(ppReadPackedMsg, &value->BWPSize, end) && + + pull16(ppReadPackedMsg, &value->BWPStart, end) && + pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && + pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && + pull8(ppReadPackedMsg, &value->NrOfCodewords, end) && + + pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) && + pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) && + pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) && + pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) && + + pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) && + pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) && + pull16(ppReadPackedMsg, &value->dataScramblingId, end) && + pull8(ppReadPackedMsg, &value->nrOfLayers, end) && + + pull8(ppReadPackedMsg, &value->transmissionScheme, end) && + pull8(ppReadPackedMsg, &value->refPoint, end) && + pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) && + pull8(ppReadPackedMsg, &value->dmrsConfigType, end) && + + pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) && + pull8(ppReadPackedMsg, &value->SCID, end) && + pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) && + pull16(ppReadPackedMsg, &value->dmrsPorts, end) && + + pull8(ppReadPackedMsg, &value->resourceAlloc, end) && + pull16(ppReadPackedMsg, &value->rbStart, end) && + pull16(ppReadPackedMsg, &value->rbSize, end) && + + pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) && + pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && + pull8(ppReadPackedMsg, &value->NrOfSymbols, end) && + pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) && + + pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) && + pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) && + pull8(ppReadPackedMsg, &value->PTRSReOffset, end) + ); + +} + + +static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; + + return( + pull16(ppReadPackedMsg, &value->PhysCellId, end) && + pull8(ppReadPackedMsg, &value->BetaPss, end) && + pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) && + pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) && + pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) && + pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) && + pull32(ppReadPackedMsg, &value->bchPayload, end) + // TODO: pack precoding_and_beamforming too + ); + +} + + +// LTE: +static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) && + pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) && + pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) && + pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end)); + +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end)); +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end)); +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end)); +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) && + pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end)); +} + +static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end) +{ + if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && + pull8(ppReadPackedMsg, &value->number_of_subbands, end) && + pull8(ppReadPackedMsg, &value->num_antennas, end))) + return 0; + + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); + + if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) && + pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end))) + return 0; + + uint8_t antenna_idx = 0; + uint8_t scheduled_ue_idx = 0; + + for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) + { + for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) + { + if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end)) + return 0; + } + } + + } + + + return 1; + +} + + +static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; + + // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been + // added + uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5; + dci_dl_pdu_rel13->tpm_struct_flag = 0; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) && + ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) && + ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1)); + +} + +static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end)); +} + +static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) && + pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) && + pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) && + pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end)); +} + +static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; + + if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) && + pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) && + pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end))) + return 0; + + uint16_t j = 0; + for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j) + { + if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) && + pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end))) + return 0; + } + return 1; +} +static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) ); +} +static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && + pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ; +} +static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end)); +} +static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end)); +} +static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end)); +} + +static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) && + pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) && + pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end)); +} +static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; + + return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) && + pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end)); +} + +static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; + + return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) && + pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) && + pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) && + pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end)); +} + +static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; + + return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) && + pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) && + pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) && + pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end)); +} + +static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; + + if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end))) + return 0; + + + uint16_t idx =0; + for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx) + { + if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end))) + return 0; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n"); + //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??); + } + return 1; +} + +static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) && + pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) && + pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) && + pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end)); +} + +static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; + + return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end)); +} + +static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; + + + return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) && + pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end)); +} + + +static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; + + return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) && + pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) && + pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end)); +} + +static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; + + return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) && + pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end)); +} + +static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; + + return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end)); +} + + +static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg; + + if(!(pull32(ppReadPackedMsg, &value->PDUSize, end) && + pull16(ppReadPackedMsg, &value->PDUType, end) )) + return 0; + + + // first match the pdu type, then call the respective function + switch(value->PDUType) + { + case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: + { + if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + + case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: + { + if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: + { + if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: + { + if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); + } + break; + } + + return 1; +} + + + + +static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) && + pull8(ppReadPackedMsg, &value->number_dci, end) && + pull16(ppReadPackedMsg, &value->number_pdu, end) && + pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) && + pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end))) + return 0; + + if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU); + return 0; + } + + if(value->number_pdu) + { + value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config); + if(value->dl_config_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu); + return 0; + } + } + else + { + value->dl_config_pdu_list = 0; + } + + uint16_t i; + uint16_t total_number_of_pdus = value->number_pdu; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + { + // pdu end of beyond buffer end + return 0; + } + + switch(pdu->pdu_type) + { + case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_BCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_MCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_PCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_PRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + + } + break; + case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + + } + break; + default: + // Need to log an error + break; + } + } + + return 1; +} + + +static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; + + if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) && + pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end) + //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) + )) + return 0; + + int arr[12]; + for(int i=0;i<pNfapiMsg->dl_tti_request_body.nGroup;i++) + { + for(int j=0;j<pNfapiMsg->dl_tti_request_body.nUe[i];j++) + { + arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; + } + if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end))) + return 0; + } + + for(int i=0;i<pNfapiMsg->dl_tti_request_body.nPDUs;i++) + { + if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i])) + return 0; + } + +return 1; +} + + +static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv; + + return( + pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) && + pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) && + pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) && + pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) && + pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) && + pull16(ppReadPackedMsg, &prach_pdu->num_cs, end) + // TODO: ignoring beamforming tlv for now + ); +} + + +static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv; + + return( + pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) && + pull32(ppReadPackedMsg, &pucch_pdu->handle, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) && + pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) && + pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) && + pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) && + pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) && + pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) && + pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) && + pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) && + pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) && + pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) && + pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) && + pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) && + pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) && + pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) && + pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) && + pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) && + pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) && + pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) && + pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) && + pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) && + pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) && + pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) && + pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end) + // TODO: ignoring beamforming tlv for now + ); +} + + +static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv; + + if (!( + pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) && + pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) && + pull32(ppReadPackedMsg, &pusch_pdu->handle, end) && + pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) && + pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) && + pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) && + pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) && + pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) && + pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) && + pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) && + pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) && + pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) && + pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) && + pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) && + pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) && + pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) && + pull8(ppReadPackedMsg, &pusch_pdu->scid, end) && + pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) && + pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && + pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) && + pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) && + pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && + pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) && + pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) && + pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) && + pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) && + pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) && + pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) && + pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) && + pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end) + // TODO: ignoring beamforming tlv for now + )) + return 0; + + + //Pack Optional Data only included if indicated in pduBitmap + switch(pusch_pdu->pdu_bit_map){ + case PUSCH_PDU_BITMAP_PUSCH_DATA: + { + // pack optional TLVs + return( + pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) && + pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) && + pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) && + pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_UCI: + { + return( + pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) && + pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) && + pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_PTRS: + { + return( + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) && ++ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) && ++ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_DFTS_OFDM: + { + return( + pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) && + pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) && + pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) && + pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end) + ); + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); + } + } + + return 1; +} + + +static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv; + + return( + pull16(ppReadPackedMsg, &srs_pdu->rnti, end) && + pull32(ppReadPackedMsg, &srs_pdu->handle, end) && + pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) && + pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) && + pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) && + pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) && + pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) && + pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) && + pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) && + pull8(ppReadPackedMsg, &srs_pdu->config_index, end) && + pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) && + pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) && + pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) && + pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) && + pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) && + pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) && + pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) && + pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) && + pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) && + pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) && + pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) && + pull16(ppReadPackedMsg, &srs_pdu->t_offset, end) + // TODO: ignoring beamforming tlv for now + ); +} + + +static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg; + + if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) )) + return 0; + + + // first natch the pdu type, then call the respective function + switch(pNfapiMsg->pdu_type) + { + + case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: + { + if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: + { + if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: + { + if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: + { + if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type ); + } + break; + + + } + + return 1; +} + + +static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg; + + if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end)) + return 0; + for (int i = 0; i < pNfapiMsg->n_ue; i++) + { + if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) ) + return 0; + } + return 1; +} + + +static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; + + if (!( + pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) )) + return 0; + + for(int i=0; i< pNfapiMsg->n_pdus; i++) + { + if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i])) + return 0; + } + + for(int i=0; i< pNfapiMsg->n_group; i++) + { + if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i])) + return 0; + } + + return 1; +} + + + +static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value}, + }; + + return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + + + + nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; + + return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end )); +} + +static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) && + pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) & + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end)); +} +static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; + + return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end)); +} +static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end)); +} +static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end)); +} + +static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end))) + return 0; + + switch(cqi_ri_info_rel9->report_type) + { + case NFAPI_CSI_REPORT_TYPE_PERIODIC: + { + if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end))) + return 0; + } + break; + case NFAPI_CSI_REPORT_TYPE_APERIODIC: + { + if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0) + return 0; + + uint8_t i; + for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) + { + if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0) + return 0; + + uint8_t j; + for(j = 0; j < 8; ++j) + { + if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0) + return 0; + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); + return 0; + } + break; + }; + return 1; +} + +// NOTE : This function is a little unconventional as we uese the side to +// determine the report type +static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; + if(cqi_ri_info_rel13->tl.length == 0) + { + cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC; + } + else + { + cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC; + if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0) + return 0; + } + return 1; +} +static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) && + pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end)); +} +static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) && + pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) && + pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end)); +} + +static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; + + return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end)); +} + +static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; + + return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) && + pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end)); +} +static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) && + pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end)); +} +static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) && + pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) && + pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) && + pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end)); +} + +static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) && + pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end)); +} +static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) && + pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end)); +} +static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) && + pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end)); +} + +static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end)); +} + +static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) && + pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) && + pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) && + pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; + + return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) && + pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) && + pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) && + pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; + + return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end)); +} + + +static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; + + return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) && + pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) && + pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) && + pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end)); +} + +static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; + return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end); +} + +static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end)); +} + +static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; + + return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end)); +} + +static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) && + pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end))) + return 0; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, + { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value}, + }; + + return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0); +} + +static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) && + pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) && + pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end)); +} + + +static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value}, + + #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value}, + + #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value}, + + #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value}, + + #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \ + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, + + #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value}, + + #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value}, + + #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value}, + + #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \ + { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value}, + + #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value}, + + #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value}, + + + nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) && + pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) && + pull8(ppReadPackedMsg, &value->srs_present, end))) + return 0; + + if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU); + return 0; + } + + if(value->number_of_pdus > 0) + { + value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config); + + if(value->ul_config_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->ul_config_pdu_list = 0; + } + + + uint16_t i; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + { + // pdu end is past buffer end + return 0; + } + + switch(pdu->pdu_type) + { + case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + + case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu) + UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information) + UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu) + UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information) + UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu) + UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information) + UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information) + UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_SRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + } + } + return 1; +} + + +static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; + + return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) && + pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end)); +} + +static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end)); +} + +static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) && + pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) && + pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) && + pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end)); +} + +static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) && + pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end)); +} + +static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end)); +} + +static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) && + pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) && + pull8(ppReadPackedMsg, &value->resource_block_assignment, end) && + pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) && + pull8(ppReadPackedMsg, &value->start_symbol, end) && + pull8(ppReadPackedMsg, &value->ecce_index, end) && + pull8(ppReadPackedMsg, &value->aggreagation_level, end) && + pull8(ppReadPackedMsg, &value->rnti_type, end) && + pull16(ppReadPackedMsg, &value->rnti, end) && + pull8(ppReadPackedMsg, &value->ce_mode, end) && + pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) && + pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) && + pull16(ppReadPackedMsg, &value->transmission_power, end) && + pull8(ppReadPackedMsg, &value->dci_format, end) && + pull8(ppReadPackedMsg, &value->resource_block_start, end) && + pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) && + pull8(ppReadPackedMsg, &value->mcs, end) && + pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) && + pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) && + pull8(ppReadPackedMsg, &value->new_data_indication, end) && + pull8(ppReadPackedMsg, &value->harq_process, end) && + pull8(ppReadPackedMsg, &value->redudency_version, end) && + pull8(ppReadPackedMsg, &value->tpc, end) && + pull8(ppReadPackedMsg, &value->csi_request, end) && + pull8(ppReadPackedMsg, &value->ul_inex, end) && + pull8(ppReadPackedMsg, &value->dai_presence_flag, end) && + pull8(ppReadPackedMsg, &value->dl_assignment_index, end) && + pull8(ppReadPackedMsg, &value->srs_request, end) && + pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) && + pull32(ppReadPackedMsg, &value->tcp_bitmap, end) && + pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) && + pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) && + pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end)); +} + +static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->ncce_index, end) && + pull8(ppReadPackedMsg, &value->aggregation_level, end) && + pull8(ppReadPackedMsg, &value->start_symbol, end) && + pull16(ppReadPackedMsg, &value->rnti, end) && + pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) && + pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) && + pull8(ppReadPackedMsg, &value->subcarrier_indication, end) && + pull8(ppReadPackedMsg, &value->resource_assignment, end) && + pull8(ppReadPackedMsg, &value->scheduling_delay, end) && + pull8(ppReadPackedMsg, &value->mcs, end) && + pull8(ppReadPackedMsg, &value->redudancy_version, end) && + pull8(ppReadPackedMsg, &value->repetition_number, end) && + pull8(ppReadPackedMsg, &value->new_data_indicator, end) && + pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end)); +} + +static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; + + if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) && + pull8(ppReadPackedMsg, &value->number_of_dci, end) && + pull8(ppReadPackedMsg, &value->number_of_hi, end))) + return 0; + + uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci; + + if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU); + return 0; + } + + if(totalNumPdus > 0) + { + value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config); + if(value->hi_dci0_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus); + return 0; + } + } + else + { + value->hi_dci0_pdu_list = 0; + } + + uint8_t i; + for(i = 0; i < totalNumPdus; ++i) + { + nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + { + // pdu end if past buffer end + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end); + return 0; + } + + switch(pdu->pdu_type) + { + case NFAPI_HI_DCI0_HI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value}, + { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, + { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, + { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, + { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, + { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + } + + return 1; +} +//unpack_ul_dci_pdu_list_value + +static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg; + + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) && + + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) && + + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) && + + pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end)); + + return 0; + } + + return (pull16(ppReadPackedMsg, &value->PDUType, end) && + pull16(ppReadPackedMsg, &value->PDUSize, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) && + + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) && + pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) && + + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) && + + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end)); + +} + +static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ +nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; + + if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end) + )) + return 0; + for(int i=0; i< pNfapiMsg->numPdus; i++) + { + if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i])) + return 0; + } + + return 1; + +} + +static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); + +} +static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg; + + if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end) + )) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV; + for(; i < total_number_of_tlvs; ++i) + { + + if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end))) + return 0; + + switch(pNfapiMsg->TLVs[i].tag){ + case 0: + { + if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end)) + return 0; + break; + + } + + case 1: + { + if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end)) + return 0; + break; + + } + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag ); + break; + } + + } + } + + + return 1; +} + +static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; + + if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end))) + return 0; + + for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++) + { + if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i])) + return 0; + } + + return 1; +} + +static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + uint8_t proceed = 1; + nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; + + if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) + return 0; + + while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) + { + nfapi_tl_t generic_tl; + if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_TX_REQUEST_BODY_TAG: + { + pNfapiMsg->tx_request_body.tl = generic_tl; + + if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0) + return 0; + + if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU); + return 0; + } + + if(pNfapiMsg->tx_request_body.number_of_pdus > 0) + { + pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config); + if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus); + return 0; + } + } + else + { + pNfapiMsg->tx_request_body.tx_pdu_list = 0; + } + + + uint16_t i; + uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus; + for(i = 0; i < totalNumPdus; ++i) + { + nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]); + if (pdu) { + uint16_t length = 0; + uint16_t index = 0; + + if(!(pull16(ppReadPackedMsg, &length, end) && + pull16(ppReadPackedMsg, &index, end))) + return 0; + + pdu->pdu_length = length; + pdu->pdu_index = index; + + + // TODO : May need to rethink this bit + pdu->num_segments = 1; + pdu->segments[0].segment_length = pdu->pdu_length; + pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config); + + if(pdu->segments[0].segment_data) + { + if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end)) + return 0; + if (pdu->segments[0].segment_length == 3) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, + pdu->segments[0].segment_data[0], + pdu->segments[0].segment_data[1], + pdu->segments[0].segment_data[2] + ); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index); + } + } else { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n"); + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag ); + } + break; + }; + } + + return 1; +} + +static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + uint8_t proceed = 1; + nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; + + if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) + return 0; + + while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) + { + nfapi_tl_t generic_tl; + if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_UE_RELEASE_BODY_TAG: + { + pNfapiMsg->ue_release_request_body.tl = generic_tl; + if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0) + return 0; + + if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI); + return 0; + } else { + uint8_t j; + uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs; + for(j = 0; j < num; ++j){ + if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){ + return 0; + } + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag ); + } + break; + }; + } + + return 1; +} + +static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->value_0, end) && + pull8(ppReadPackedMsg, &value->value_1, end)); +} + +static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->value_0, end) && + pull8(ppReadPackedMsg, &value->value_1, end) && + pull8(ppReadPackedMsg, &value->value_2, end) && + pull8(ppReadPackedMsg, &value->value_3, end)); +} +static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv; + return ( pull8(ppReadPackedMsg, &value->value_0, end)); +} +static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv; + return (pull8(ppReadPackedMsg, &value->value_0, end)); +} + +static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->mode, end) && + pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) + return 0; + + uint8_t result = 0; + switch(value->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = 1; + break; + default: + // TODO add error message + return 0; + break; + } + return result; +} + +static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->mode, end) && + pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) + return 0; + + if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) + { + // TODO : add error message + return 0; + } + + uint16_t idx = 0; + for(idx = 0; idx < value->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + switch(value->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); + break; + default: + // TODO add error message + return 0; + break; + } + + if(result == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->mode, end) && + pull16(ppReadPackedMsg, &value->number_of_ack_nack, end))) + return 0; + + if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) + { + // TODO : add error message + return 0; + } + + uint16_t idx = 0; + for(idx = 0; idx < value->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + switch(value->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end); + break; + default: + // TODO add error message + return 0; + break; + } + + if(result == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv; + return (pull8(ppReadPackedMsg, &value->harq_tb1, end) && + pull8(ppReadPackedMsg, &value->harq_tb2, end)); +} + +static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->mode, end) && + pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) && + pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end)); +} + +static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->mode, end) && + pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) && + pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end)); +} + +static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->ul_cqi, end) && + pull8(ppReadPackedMsg, &value->channel, end)); +} + + + +static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; + uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(harqBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) + return 0; + + if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); + return 0; + } + + value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config); + if(value->harq_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); + return 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_harqs; ++i) + { + nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value}, + { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value}, + { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value}, + { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value}, + { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value}, + { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value}, + { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) + return 0; + + } + + return 1; +} + +static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv; + return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) ); +} + +static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; + uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(crcBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0) + return 0; + + if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU); + return 0; + } + + if(value->number_of_crcs > 0) + { + value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config); + if(value->crc_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs); + return 0; + } + } + else + { + value->crc_pdu_list = 0; + } + + + uint8_t i = 0; + for(i = 0; i < value->number_of_crcs; ++i) + { + nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value }, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0) + return 0; + } + + return 1; +} + +static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &value->length, end) && + pull16(ppReadPackedMsg, &value->offset, end) && + pull8(ppReadPackedMsg, &value->ul_cqi, end) && + pull16(ppReadPackedMsg, &value->timing_advance, end)); +} +static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; + return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end)); +} + +static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; + + // the rxBodyEnd points to the end of the cqi PDU's + uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length; + uint8_t* rxPduEnd = rxBodyEnd; + + uint8_t* numberOfPdusAddress = *ppReadPackedMsg; + + if(rxBodyEnd > end) + { + // pdu end is past buffer end + return 0; + } + + if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) + return 0; + + if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU); + return 0; + } + + if(value->number_of_pdus > 0) + { + value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config); + if(value->rx_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->rx_pdu_list = 0; + } + + uint8_t i = 0; + nfapi_rx_indication_pdu_t* pdu = 0; + while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd) + { + nfapi_tl_t generic_tl; + if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_RX_UE_INFORMATION_TAG: + { + pdu = &(value->rx_pdu_list[i++]); + pdu->rx_ue_information.tl = generic_tl; + if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) + return 0; + } + break; + case NFAPI_RX_INDICATION_REL8_TAG: + { + if(pdu != 0) + { + pdu->rx_indication_rel8.tl = generic_tl; + if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) + return 0; + + if(pdu->rx_indication_rel8.offset > 0) + { + // Need to check that the data is within the tlv + if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd) + { + // If this the first pdu set the rxPduEnd + if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd) + { + rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset; + + if(rxPduEnd > end) + { + // pdu end is past buffer end + return 0; + } + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n"); + } + } + } + } + break; + case NFAPI_RX_INDICATION_REL9_TAG: + { + if(pdu != 0) + { + pdu->rx_indication_rel9.tl = generic_tl; + if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) + return 0; + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag ); + } + break; + } + } + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_pdus; ++idx) + { + if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length; + value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config); + if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0) + { + return 0; + } + } + } + + return 1; +} + +static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) && + pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end)); +} + +static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; + return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end); +} + +static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; + return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end); +} + +static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; + uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(rachBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0) + return 0; + + if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU); + return 0; + } + + if(value->number_of_preambles > 0) + { + value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config); + if(value->preamble_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles); + return 0; + } + } + else + { + value->preamble_list = 0; + } + + + uint8_t i = 0; + for(i = 0; i < value->number_of_preambles; ++i) + { + nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value }, + { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value }, + { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value }, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; + + if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) && + pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) && + pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) && + pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) && + pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end))) + return 0; + return 1; +} + +static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; + return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end)); +} + +static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; + return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end)); +} + +static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; + return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end)); +} + +static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && + pull8(ppReadPackedMsg, &value->number_of_subbands, end) && + pull8(ppReadPackedMsg, &value->num_atennas, end))) + return 0; + + if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS) + { + // todo : add error + return 0; + } + + if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS) + { + // todo : add error + return 0; + } + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) && + pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end))) + return 0; + } + + return 1; +} + + +static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv; + uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(srsBodyEnd > end) + return 0; + + if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0) + return 0; + + if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU); + return 0; + } + + if(value->number_of_ues > 0) + { + value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config); + if(value->srs_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues); + return 0; + } + } + else + { + value->srs_pdu_list = 0; + } + + + + uint8_t i = 0; + for(i = 0; i < value->number_of_ues; ++i) + { + nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); + + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value}, + { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value}, + { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value}, + { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value}, + { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value}, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; + uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(srBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0) + return 0; + + if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU); + return 0; + } + + if(value->number_of_srs > 0) + { + value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config); + if(value->sr_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs); + return 0; + } + } + else + { + value->sr_pdu_list = 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_srs; ++i) + { + nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value }, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0) + return 0; + } + + return 1; + +} + +static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} +static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end)); + +} + +static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; + + if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end))) + return 0; + + if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n"); + return 0; + } + + if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end))) + return 0; + + return 1; +} + +static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; + + // the cqiBodyEnd points to the end of the cqi PDU's + uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length; + + //uint8_t* cqiPduEnd = cqiBodyEnd; + //uint8_t* numberOfPdusAddress = *ppReadPackedMsg; + + if(cqiBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0) + return 0; + + if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU); + return -1; + } + + if(value->number_of_cqis > 0) + { + value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config); + if(value->cqi_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); + return 0; + } + } + else + { + value->cqi_pdu_list = 0; + } + + if(value->number_of_cqis > 0) + { + value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config); + if(value->cqi_raw_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); + return 0; + } + } + else + { + value->cqi_raw_pdu_list = 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_cqis; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t)); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd) + { + nfapi_tl_t generic_tl; + if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_RX_UE_INFORMATION_TAG: + pdu->rx_ue_information.tl = generic_tl; + if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) + return 0; + break; + case NFAPI_CQI_INDICATION_REL8_TAG: + pdu->cqi_indication_rel8.tl = generic_tl; + if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0) + return 0; + + break; + case NFAPI_CQI_INDICATION_REL9_TAG: + pdu->cqi_indication_rel9.tl = generic_tl; + if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0) + return 0; + + break; + case NFAPI_UL_CQI_INFORMATION_TAG: + pdu->ul_cqi_information.tl = generic_tl; + if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0) + return 0; + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag ); + } + break; + + }; + } + } + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_cqis; ++idx) + { + if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0) + return 0; + } + else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0) + return 0; + } + } + + + return 1; + +} + +static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} +static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->mp_cca, end) && + pull32(ppReadPackedMsg, &value->n_cca, end) && + pull32(ppReadPackedMsg, &value->offset, end) && + pull32(ppReadPackedMsg, &value->lte_txop_sf, end) && + pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) && + pull32(ppReadPackedMsg, &value->lbt_mode, end)); +} + +static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->offset, end) && + pull16(ppReadPackedMsg, &value->sfn_sf_end, end) && + pull32(ppReadPackedMsg, &value->lbt_mode, end)); +} + + +static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; + + if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) + return 0; + + if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU); + return 0; + } + + if(value->number_of_pdus) + { + value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config); + if(value->lbt_dl_config_req_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->lbt_dl_config_req_pdu_list = 0; + } + + + uint16_t i; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type); + return 0; + } + } + + return 1; +} +static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->result, end) && + pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) && + pull32(ppReadPackedMsg, &value->initial_partial_sf, end)); + +} +static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->result, end)); +} + +static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; + + if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) + return 0; + + if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU); + return 0; + } + + if(value->number_of_pdus > 0) + { + value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config); + if(value->lbt_indication_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->lbt_indication_pdu_list = 0; + } + + uint16_t i; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type); + return 0; + } + } + + return 1; +} +static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; + return (pull8(ppReadPackedMsg, &value->harq_tb1, end)); +} + + +static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; + uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(nbharqBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) + return 0; + + if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); + return 0; + } + + value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config); + if(value->nb_harq_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); + return 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_harqs; ++i) + { + nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value}, + { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) + return 0; + + } + + return 1; +} + +static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv; + + return (pull16(ppReadPackedMsg, &value->rnti, end) && + pull8(ppReadPackedMsg, &value->initial_sc, end) && + pull16(ppReadPackedMsg, &value->timing_advance, end) && + pull8(ppReadPackedMsg, &value->nrach_ce_level, end)); +} + +static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; + if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){ + return 0; + } + else{ + NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code); + } + return 1; +} + +static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; + uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(nrachBodyEnd > end) + return 0; + + if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0) + return 0; + + if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU); + return 0; + } + + value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config); + if(value->nrach_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected); + return 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_initial_scs_detected; ++i) + { + nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); + + uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value}, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0) + return 0; + + } + + return 1; +} + +static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + + +// unpack length check + +static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) +{ + int retLen = 0; + + switch (msgId) + { + case NFAPI_DL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t)) + retLen = sizeof(nfapi_dl_config_request_t); + break; + + case NFAPI_UL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t)) + retLen = sizeof(nfapi_ul_config_request_t); + break; + + case NFAPI_SUBFRAME_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) + retLen = sizeof(nfapi_subframe_indication_t); + break; + + case NFAPI_HI_DCI0_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t)) + retLen = sizeof(nfapi_hi_dci0_request_t); + break; + + case NFAPI_TX_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_tx_request_t)) + retLen = sizeof(nfapi_tx_request_t); + break; + + case NFAPI_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) + retLen = sizeof(nfapi_harq_indication_t); + break; + + case NFAPI_CRC_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) + retLen = sizeof(nfapi_crc_indication_t); + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) + retLen = sizeof(nfapi_rx_indication_t); + break; + + case NFAPI_RACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) + retLen = sizeof(nfapi_rach_indication_t); + break; + + case NFAPI_SRS_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) + retLen = sizeof(nfapi_srs_indication_t); + break; + + case NFAPI_RX_SR_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) + retLen = sizeof(nfapi_sr_indication_t); + break; + + case NFAPI_RX_CQI_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) + retLen = sizeof(nfapi_cqi_indication_t); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) + retLen = sizeof(nfapi_lbt_dl_config_request_t); + break; + + case NFAPI_LBT_DL_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) + retLen = sizeof(nfapi_lbt_dl_indication_t); + break; + + case NFAPI_NB_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) + retLen = sizeof(nfapi_nb_harq_indication_t); + break; + + case NFAPI_NRACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) + retLen = sizeof(nfapi_nrach_indication_t); + break; + + case NFAPI_DL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t)) + retLen = sizeof(nfapi_dl_node_sync_t); + break; + + case NFAPI_UL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t)) + retLen = sizeof(nfapi_ul_node_sync_t); + break; + + case NFAPI_TIMING_INFO: + if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) + retLen = sizeof(nfapi_timing_info_t); + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) + retLen = sizeof(nfapi_ue_release_request_t); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) + retLen = sizeof(nfapi_ue_release_response_t); + break; + + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); + break; + } + + return retLen; +} + +static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) +{ + int retLen = 0; + + switch (msgId) + { + case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t)) + retLen = sizeof(nfapi_nr_dl_tti_request_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t)) + retLen = sizeof(nfapi_nr_ul_tti_request_t); + break; + + case NFAPI_SUBFRAME_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) + retLen = sizeof(nfapi_subframe_indication_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t)) + retLen = sizeof(nfapi_nr_ul_dci_request_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t)) + retLen = sizeof(nfapi_nr_tx_data_request_t); + break; + + case NFAPI_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) + retLen = sizeof(nfapi_harq_indication_t); + break; + + case NFAPI_CRC_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) + retLen = sizeof(nfapi_crc_indication_t); + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) + retLen = sizeof(nfapi_rx_indication_t); + break; + + case NFAPI_RACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) + retLen = sizeof(nfapi_rach_indication_t); + break; + + case NFAPI_SRS_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) + retLen = sizeof(nfapi_srs_indication_t); + break; + + case NFAPI_RX_SR_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) + retLen = sizeof(nfapi_sr_indication_t); + break; + + case NFAPI_RX_CQI_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) + retLen = sizeof(nfapi_cqi_indication_t); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) + retLen = sizeof(nfapi_lbt_dl_config_request_t); + break; + + case NFAPI_LBT_DL_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) + retLen = sizeof(nfapi_lbt_dl_indication_t); + break; + + case NFAPI_NB_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) + retLen = sizeof(nfapi_nb_harq_indication_t); + break; + + case NFAPI_NRACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) + retLen = sizeof(nfapi_nrach_indication_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t)) + retLen = sizeof(nfapi_nr_dl_node_sync_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t)) + retLen = sizeof(nfapi_nr_ul_node_sync_t); + break; + + case NFAPI_TIMING_INFO: + if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) + retLen = sizeof(nfapi_timing_info_t); + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) + retLen = sizeof(nfapi_ue_release_request_t); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) + retLen = sizeof(nfapi_ue_release_response_t); + break; + + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); + break; + } + + return retLen; +} + + + +// Main unpack functions - public + +int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) +{ + nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf; + uint8_t *pReadPackedMessage = pMessageBuf; + uint8_t *end = pMessageBuf + messageBufLen; + + if (pMessageBuf == NULL || pUnpackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n"); + return -1; + } + + if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); + return -1; + } + + // process the header + if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && + pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && + pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && + pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) + return -1; + + return 0; +} + +int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) +{ + int result = 0; + nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; + uint8_t *pReadPackedMessage = pMessageBuf; + uint8_t *end = pMessageBuf + messageBufLen; + + if (pMessageBuf == NULL || pUnpackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); + return -1; + } + + if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); + return -1; + } + /* + uint8_t *ptr = pMessageBuf; + printf("\n Read P7 message unpack: "); + while(ptr < end){ + printf(" %d ", *ptr); + ptr++; + } + printf("\n"); +*/ + // clean the supplied buffer for - tag value blanking + (void)memset(pUnpackedBuf, 0, unpackedBufLen); + + // process the header + if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && + pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && + pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && + pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); + return -1; + } + + if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); + return -1; + } + + /* + if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); + return -1; + } + */ + + // look for the specific message + switch (pMessageHeader->message_id) + { + case NFAPI_DL_CONFIG_REQUEST: + if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UL_CONFIG_REQUEST: + if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_TX_REQUEST: + if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen)) + result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_HI_DCI0_REQUEST: + if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen)) + result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) + result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_HARQ_INDICATION: + if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) + result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_CRC_INDICATION: + if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) + result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) + result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RACH_INDICATION: + if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) + result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_SRS_INDICATION: + if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) + result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_SR_INDICATION: + if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) + result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_CQI_INDICATION: + if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) + result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_INDICATION: + if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) + result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NB_HARQ_INDICATION: + if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) + result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NRACH_INDICATION: + if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) + result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_DL_NODE_SYNC: + if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen)) + result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UL_NODE_SYNC: + if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen)) + result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_TIMING_INFO: + if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) + result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) + result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + default: + + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->unpack_p7_vendor_extension) + { + result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + break; + } + + if(result == 0) + return -1; + else + return 0; +} + +int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) +{ + int result = 0; + nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; + uint8_t *pReadPackedMessage = pMessageBuf; + uint8_t *end = pMessageBuf + messageBufLen; + + if (pMessageBuf == NULL || pUnpackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); + return -1; + } + + if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); + return -1; + } + /* + uint8_t *ptr = pMessageBuf; + printf("\n Read P7 message unpack: "); + while(ptr < end){ + printf(" %d ", *ptr); + ptr++; + } + printf("\n"); +*/ + // clean the supplied buffer for - tag value blanking + (void)memset(pUnpackedBuf, 0, unpackedBufLen); + + // process the header + if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && + pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && + pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && + pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); + return -1; + } + + if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); + return -1; + } + + /* + if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); + return -1; + } + */ + + // look for the specific message + switch (pMessageHeader->message_id) + { + case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen)) + result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen)) + result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen)) + result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen)) + result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) + result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_HARQ_INDICATION: + if (check_nr_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) + result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_CRC_INDICATION: + if (check_nr_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) + result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (check_nr_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) + result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RACH_INDICATION: + if (check_nr_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) + result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_SRS_INDICATION: + if (check_nr_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) + result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_SR_INDICATION: + if (check_nr_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) + result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_CQI_INDICATION: + if (check_nr_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) + result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (check_nr_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_INDICATION: + if (check_nr_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) + result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NB_HARQ_INDICATION: + if (check_nr_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) + result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NRACH_INDICATION: + if (check_nr_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) + result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen)) + result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen)) + result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_TIMING_INFO: + if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) + result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) + result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + default: + + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->unpack_p7_vendor_extension) + { + result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + break; + } + + if(result == 0) + return -1; + else + return 0; +} + + diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp index 1c2f0bef8078a072d7abd9eab6de65cbe3b5568d..4fe5065ceac54c687c1fa73e159b87f3061fc549 100644 --- a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp +++ b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp @@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) { if(instance->tick == 1000) { if(instance->tx_byte_count > 0) { - printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count); + printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count); instance->tx_byte_count = 0; } @@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) { millisec = now_ts.tv_nsec / 1e6; if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) { - printf("*** missing millisec %d %d\n", last_millisec, millisec); + printf("*** missing millisec %u %u\n", last_millisec, millisec); catchup = millisec - last_millisec - 1; } diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c index 2a7b789650428ff12c2418ccb3c3ce0fa3ba4d74..fffd04ea3c8c2c25087164223e1ab1e56d227d4c 100644 --- a/openair1/PHY/CODING/3gpplte_sse.c +++ b/openair1/PHY/CODING/3gpplte_sse.c @@ -44,8 +44,6 @@ //#define DEBUG_TURBO_ENCODER 1 //#define CALLGRIND 1 -unsigned short threegpplte_interleaver_output; -unsigned long long threegpplte_interleaver_tmp; #if defined(__x86_64__) || defined(__i386__) struct treillis { diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index e1ca906b55baead972e59753fdc04816879a131a..bc1c0dac5639ed39c634516b3cebc81c8c162801 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -798,11 +798,11 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, n is the size in bits of the coded block, with the tail */ int n2; llr_t y8[3*(n+16)] __attribute__((aligned(16))); - llr_t systematic0[n+16] __attribute__ ((aligned(16))); - llr_t systematic1[n+16] __attribute__ ((aligned(16))); - llr_t systematic2[n+16] __attribute__ ((aligned(16))); - llr_t yparity1[n+16] __attribute__ ((aligned(16))); - llr_t yparity2[n+16] __attribute__ ((aligned(16))); + llr_t systematic0[n+32] __attribute__ ((aligned(16))); + llr_t systematic1[n+32] __attribute__ ((aligned(16))); + llr_t systematic2[n+32] __attribute__ ((aligned(16))); + llr_t yparity1[n+32] __attribute__ ((aligned(16))); + llr_t yparity2[n+32] __attribute__ ((aligned(16))); llr_t ext[n+128] __attribute__((aligned(16))); llr_t ext2[n+128] __attribute__((aligned(16))); llr_t alpha[(n+16)*8] __attribute__ ((aligned(16))); @@ -811,7 +811,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, llr_t m10[n+16] __attribute__ ((aligned(16))); // int *pi2_p,*pi4_p,*pi5_p,*pi6_p; int *pi4_p,*pi5_p,*pi6_p; - llr_t *s,*s1,*s2,*yp1,*yp2,*yp; + llr_t *s1,*s2,*yp1,*yp2,*yp; unsigned int i,j,iind;//,pi; unsigned char iteration_cnt=0; unsigned int crc,oldcrc,crc_len; @@ -927,7 +927,6 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, yp128 = (int8x16_t *)y8; #endif - s = systematic0; s1 = systematic1; s2 = systematic2; yp1 = yparity1; @@ -938,7 +937,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, for (i=0; i<16 ; i++ ) for (j=0; j<n2; j+=16) { int k=i+j; - s[k]=*yp++; + systematic0[k]=*yp++; yp1[k]=*yp++; yp2[k]=*yp++; } @@ -948,8 +947,8 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, if (n2>n) { /* - s[n]=0;s[n+1]=0;s[n+2]=0;s[n+3]=0; - s[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0; + systematic0[n]=0;systematic0[n+1]=0;systematic0[n+2]=0;systematic0[n+3]=0; + systematic0[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0; s1[n]=0;s1[n+1]=0;s1[n+2]=0;s1[n+3]=0; s1[n+4]=0;s1[n+5]=0;s1[n+6]=0;s1[n+7]=0; s2[n]=0;s2[n+1]=0;s2[n+2]=0;s2[n+3]=0; @@ -961,26 +960,26 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, // Termination for (i=n2; i<n2+3; i++) { - s[i]= *yp; - s1[i] = s[i] ; - s2[i] = s[i]; + systematic0[i]= *yp; + s1[i] = systematic0[i] ; + s2[i] = systematic0[i]; yp++; yp1[i] = *yp; yp++; #ifdef DEBUG_LOGMAP - printf("Term 1 (%u): %d %d\n",i,s[i],yp1[i]); + printf("Term 1 (%u): %d %d\n",i,systematic0[i],yp1[i]); #endif //DEBUG_LOGMAP } for (i=n2+16; i<n2+19; i++) { - s[i]= *yp; - s1[i] = s[i] ; - s2[i] = s[i]; + systematic0[i]= *yp; + s1[i] = systematic0[i] ; + s2[i] = systematic0[i]; yp++; yp2[i-16] = *yp; yp++; #ifdef DEBUG_LOGMAP - printf("Term 2 (%u): %d %d\n",i-16,s[i],yp2[i-16]); + printf("Term 2 (%u): %d %d\n",i-16,systematic0[i],yp2[i-16]); #endif //DEBUG_LOGMAP } diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index b42ac6e4c8fe21f93cb76f1c2ed396283c6bb368..f6769251cdb5343f4f8dc4c1898cb723a229ba7c 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -116,7 +116,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]; unsigned char *test_input[MAX_NUM_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; //short *c; //padded codeword @@ -144,7 +143,7 @@ int test_ldpc(short No_iteration, t_nrLDPC_procBuf nrLDPC_procBuf; t_nrLDPC_procBuf* p_nrLDPC_procBuf = &nrLDPC_procBuf; - t_nrLDPC_time_stats decoder_profiler; + t_nrLDPC_time_stats decoder_profiler = {0}; t_nrLDPC_time_stats* p_decoder_profiler =&decoder_profiler ; int32_t n_iter = 0; @@ -614,7 +613,6 @@ int main(int argc, char *argv[]) exit(1); break; } - cpu_freq_GHz = get_cpu_freq_GHz(); //printf("the decoder supports BG2, Kb=10, Z=128 & 256\n"); //printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n"); printf("block length %d: \n", block_length); @@ -704,25 +702,25 @@ int main(int argc, char *argv[]) printf("SNR %f, Std iterations: %f\n",SNR, dec_iter->n_iter_std); printf("SNR %f, Max iterations: %d\n",SNR, dec_iter->n_iter_max); printf("\n"); - printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz); - printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2))); - printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/cpu_freq_GHz); + printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz()); + printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2))); + printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/get_cpu_freq_GHz()); printf("\n"); - printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz); - printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2))); - printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/cpu_freq_GHz); + printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz()); + printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2))); + printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/get_cpu_freq_GHz()); fprintf(fd,"%f %f %f %f %f %f %f %f %f %f %f %f %d \n", SNR, (double)decoded_errors[i]/(double)n_trials , (double)errors_bit/(double)n_trials/(double)block_length/(double)n_segments , errors_bit_uncoded/(double)n_trials/(double)n_segments , - (double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz, - sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2)), - (double)time_optim->max/1000.0/cpu_freq_GHz, - (double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz, - sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2)), - (double)time_decoder->max/1000.0/cpu_freq_GHz, + (double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(), + sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)), + (double)time_optim->max/1000.0/get_cpu_freq_GHz(), + (double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(), + sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)), + (double)time_decoder->max/1000.0/get_cpu_freq_GHz(), dec_iter->n_iter_mean, dec_iter->n_iter_std, dec_iter->n_iter_max diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index d9adf3e24f679b37f80b0643eea4c12c76595d66..e43ba507ab1078f9f7b9a4bae9158220960f2571 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -113,7 +113,6 @@ int main(int argc, char *argv[]) //Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.) time_stats_t timeEncoder,timeDecoder; opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); reset_meas(&timeEncoder); reset_meas(&timeDecoder); randominit(0); @@ -324,9 +323,9 @@ if (logFlag){ #endif //Iteration times are in microseconds. - timeEncoderCumulative+=(timeEncoder.diff/(cpu_freq_GHz*1000.0)); - timeDecoderCumulative+=(timeDecoder.diff/(cpu_freq_GHz*1000.0)); - if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(cpu_freq_GHz*1000.0)), (timeDecoder.diff/(cpu_freq_GHz*1000.0))); + timeEncoderCumulative+=(timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)); + timeDecoderCumulative+=(timeDecoder.diff/(get_cpu_freq_GHz()*1000.0)); + if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)), (timeDecoder.diff/(get_cpu_freq_GHz()*1000.0))); if (nBitError<0) { blockErrorCumulative++; @@ -348,7 +347,7 @@ if (logFlag){ printf("[ListSize=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n", decoderListSize, SNR, ((double)blockErrorCumulative/iterations), ((double)bitErrorCumulative / (iterations*testLength)), - (double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0)); + (double)timeEncoder.diff/timeEncoder.trials/(get_cpu_freq_GHz()*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(get_cpu_freq_GHz()*1000.0)); //(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations); if (blockErrorCumulative==0 && bitErrorCumulative==0) break; diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c index 02d5dc64e07a025a825b321511a9044f69be831b..f750d249771802fac2806a3d67f051ff0cffae62 100644 --- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c +++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c @@ -13,7 +13,6 @@ int main(int argc, char *argv[]) { time_stats_t timeEncoder,timeDecoder; opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); reset_meas(&timeEncoder); reset_meas(&timeDecoder); randominit(0); @@ -141,8 +140,8 @@ int main(int argc, char *argv[]) SNR, ((double)bitErrorCumulative / (iterations*messageLength)), ((double)blockErrorCumulative/iterations), - ((double)timeEncoder.diff/timeEncoder.trials)/(cpu_freq_GHz), - ((double)timeDecoder.diff/timeDecoder.trials)/(cpu_freq_GHz*1000.0)); + ((double)timeEncoder.diff/timeEncoder.trials)/(get_cpu_freq_GHz()), + ((double)timeDecoder.diff/timeDecoder.trials)/(get_cpu_freq_GHz()*1000.0)); blockErrorCumulative=0; bitErrorCumulative=0; diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c index 785b588b9fa0bcd61751b544daee1f8efc5e0503..3226c97f8759ed856232277efd052527f68678eb 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c @@ -39,7 +39,7 @@ #include "nrLDPC_bnProc.h" #define NR_LDPC_ENABLE_PARITY_CHECK -#define NR_LDPC_PROFILER_DETAIL +//#define NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_DEBUG_MODE #include "nrLDPC_tools/nrLDPC_debug.h" diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 1afe82497a3b0ed6d02477605468fd623f5d25bb..0553bc19bf2d51a58ca8bb392f290473519affaf 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -493,8 +493,8 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm, } ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z; - AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E); - AssertFatal(Foffset <= Ncb,"Foffset %d > Ncb %d\n",Foffset,Ncb); +// AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E); +// AssertFatal(Foffset <= Ncb,"Foffset %d > Ncb %d\n",Foffset,Ncb); #ifdef RM_DEBUG printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, k0 %d, Ncb %d, rvidx %d\n", clear, E, ind, Ncb, rvidx); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index ab363fcae4a91607aa5002923830bd4e75e6fe47..e05045d3ed00199bc2c19581b21072157eea0469 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -142,6 +142,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n"); + gNB->bad_pucch = 0; + for (int slot=0; slot<fp->slots_per_frame; slot++) { pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot); @@ -231,13 +233,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, common_vars->rxdata = (int32_t **)malloc16(Prx*sizeof(int32_t*)); common_vars->txdataF = (int32_t **)malloc16(Ptx*sizeof(int32_t*)); common_vars->rxdataF = (int32_t **)malloc16(Prx*sizeof(int32_t*)); + common_vars->beam_id = (uint8_t **)malloc16(Ptx*sizeof(uint8_t*)); for (i=0;i<Ptx;i++){ common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n", i,common_vars->txdataF[i], fp->samples_per_frame_wCP*sizeof(int32_t)); - + common_vars->beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t)); + memset(common_vars->beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame); } for (i=0;i<Prx;i++){ common_vars->rxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); @@ -464,8 +468,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, gNB->mac_enabled = 1; if (mu==1) { - fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); - fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); + fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); fp->nr_band = 78; // fp->threequarter_fs= 0; } else if (mu==3) { @@ -474,7 +478,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, fp->nr_band = 261; // fp->threequarter_fs= 0; } - + + fp->threequarter_fs = 0; gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band); nr_init_frame_parms(gNB_config, fp); diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 648b820f0780e25025ef3abb5a9b322059218ff3..2bd7d90620b369e48e43596c0c1d074d299f478a 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -125,7 +125,7 @@ int nr_phy_init_RU(RU_t *ru) { int beam_count = 0; if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1 for (p=0;p<ru->nb_log_antennas;p++) { - if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2â¶Â³ corresponds to SSB ssb_index 0 + //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2â¶Â³ corresponds to SSB ssb_index 0 beam_count++; } AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); @@ -133,19 +133,25 @@ int nr_phy_init_RU(RU_t *ru) { int l_ind = 0; for (i=0; i<RC.nb_nr_L1_inst; i++) { for (p=0;p<ru->nb_log_antennas;p++) { - if ((fp->L_ssb >> (63-p)) & 0x01) { + //if ((fp->L_ssb >> (63-p)) & 0x01) { ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); for (j=0; j<ru->nb_tx; j++) { ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); for (re=0; re<fp->ofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; + ru->beam_weights[i][p][j][re] = ru->bw_list[j][l_ind]; //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); l_ind++; } // for j - } // for p - } + //} + } // for p } //for i } + + ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*)); + for(i=0; i< ru->nb_tx; ++i) { + ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t)); + memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame); + } } // !=IF5 ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP ); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 8bcc58160ff01021fd38801909ccb95a5e1639b5..855acc01ff1021d73c10c7b17463ac16d94fb0b9 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -71,33 +71,39 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, pdsch->llr128 = (int16_t **)malloc16_clear( sizeof(int16_t *) ); // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV // FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there - pdsch->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); - pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); + pdsch->rxdataF_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->rho = (int32_t ***)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t **) ); + pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); //pdsch->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); //pdsch->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); - pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); + pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); // the allocated memory size is fixed: - AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" ); + AssertFatal( fp->nb_antennas_rx <= 4, "nb_antennas_rx > 4" );//Extend the max number of UE Rx antennas to 4 + const size_t num = 7*2*fp->N_RB_DL*12; for (int i=0; i<fp->nb_antennas_rx; i++) { - pdsch->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) ); - - for (int j=0; j<4; j++) { //fp->nb_antennas_tx; j++) - const int idx = (j<<1)+i; - const size_t num = 7*2*fp->N_RB_DL*12; - pdsch->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); - pdsch->rxdataF_uespec_pilots[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12); + pdsch->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); + pdsch->rxdataF_uespec_pilots[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12); + pdsch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 ); + pdsch->ptrs_re_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14); + pdsch->dl_ch_ptrs_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num); + pdsch->rho[i] = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS*sizeof(int32_t *) ); + + for (int j=0; j<NR_MAX_NB_LAYERS; j++) { + const int idx = (j*fp->nb_antennas_rx)+i; + for (int k=0; k<NR_MAX_NB_LAYERS; k++) { + pdsch->rho[i][j*NR_MAX_NB_LAYERS+k] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); + } pdsch->rxdataF_comp0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2); pdsch->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); @@ -108,9 +114,6 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, pdsch->dl_ch_mag0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magb0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magr0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); - pdsch->ptrs_re_per_slot[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * 14); - pdsch->ptrs_phase_per_slot[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 ); - pdsch->dl_ch_ptrs_estimates_ext[idx]= (int32_t *)malloc16_clear( sizeof(int32_t) * num); } } } @@ -139,16 +142,14 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig int n_scid; abstraction_flag = 0; - fp->nb_antennas_tx = 1; - fp->nb_antennas_rx=1; // dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; LOG_I(PHY, "Initializing UE vars (abstraction %u) for gNB TXant %u, UE RXant %u\n", abstraction_flag, fp->nb_antennas_tx, fp->nb_antennas_rx); - //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); + //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_gNB_INST); phy_init_nr_top(ue); // many memory allocation sizes are hard coded - AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" ); - AssertFatal(nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" ); + AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" ); + AssertFatal( nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" ); // init phy_vars_ue for (i=0; i<4; i++) { @@ -276,7 +277,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } - //PDCCH DMRS init (eNB offset = 0) + //PDCCH DMRS init (gNB offset = 0) ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0]; AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n"); @@ -291,6 +292,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } + ue->scramblingID_pdcch = fp->Nid_cell; + nr_gold_pdcch(ue,fp->Nid_cell); + //PDSCH DMRS init (eNB offset = 0) ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0]; @@ -310,6 +314,12 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } + // initializing the scrambling IDs for PDSCH DMRS + for (int i=0; i<2; i++) + ue->scramblingID[i]=fp->Nid_cell; + + nr_gold_pdsch(ue,ue->scramblingID); + // DLSCH for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { @@ -329,31 +339,25 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { - ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12); - ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts; - ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t)); - ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t)); - ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear(sizeof(int16_t *)); - ue->pdsch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16_clear(fp->nb_antennas_rx*sizeof(int32_t *)); + ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12); + ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts; + ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) ); + ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) ); + ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) ); } - for (int i=0; i<fp->nb_antennas_rx; i++) { - for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { - ue->pdsch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); - } - } for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { - ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); } for (i=0; i<fp->nb_antennas_rx; i++) for (j=0; j<4; j++) { - const int idx = (j<<1)+i; + const int idx = (j*fp->nb_antennas_rx)+i; const size_t num = 7*2*fp->N_RB_DL*12+4; for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { - ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); } } @@ -361,15 +365,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, for (k=0; k<8; k++) { //harq_pid for (l=0; l<8; l++) { //round for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { - ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); } for (int i=0; i<fp->nb_antennas_rx; i++) for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++) - const int idx = (j<<1)+i; + const int idx = (j*fp->nb_antennas_rx)+i; for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); @@ -383,26 +387,26 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { - ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t)); - ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t)); - ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t)); - ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear(4*2*100*12 ); - ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); + ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); + ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); + ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 ); + ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); // Channel estimates - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *)); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *)); for (i=0; i<fp->nb_antennas_rx; i++) { ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4)); for (j=0; j<4; j++) { - int idx = (j<<1) + i; - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->ofdm_symbol_size*2); + int idx = (j*fp->nb_antennas_rx)+i; + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) ); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 ); // size_t num = 7*2*fp->N_RB_DL*12; size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); @@ -414,24 +418,24 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } // PBCH - pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *)); - pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear(1920); // - prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12))); - prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12))); + pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); // + prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); + prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); for (i=0; i<fp->nb_antennas_rx; i++) { pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) { - int idx = (j<<1)+i; - pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4); - pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size)); - pbch_vars[gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size)); - pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4); + int idx = (j*fp->nb_antennas_rx)+i; + pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); + pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) ); + pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) ); + pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); } } } @@ -507,50 +511,36 @@ void init_N_TA_offset(PHY_VARS_NR_UE *ue){ if (fp->frame_type == FDD) { ue->N_TA_offset = 0; } else { - int N_RB = fp->N_RB_DL; int N_TA_offset = fp->ul_CarrierFreq < 6e9 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2 - double factor = 1; + + double factor = 1.0; switch (fp->numerology_index) { case 0: //15 kHz scs AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n"); - if (N_RB <= 25) factor = .25; // 7.68 Ms/s - else if (N_RB <=50) factor = .5; // 15.36 Ms/s - else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s - else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s - else AssertFatal(1==0, "Too many PRBS for mu=0\n"); + factor = fp->samples_per_subframe / 30720.0; break; case 1: //30 kHz sc AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n"); - if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s - else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s + factor = fp->samples_per_subframe / 30720.0; break; case 2: //60 kHz scs AssertFatal(1==0, "scs_common should not be 60 kHz\n"); break; case 3: //120 kHz scs AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; break; case 4: //240 kHz scs - AssertFatal(1==0, "scs_common should not be 60 kHz\n"); - if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s - else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s - else AssertFatal(1==0, "N_RB %d is too big for curretn FR2 implementation\n", N_RB); + AssertFatal(N_TA_offset == 431, "scs_common 240kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; break; - - if (N_RB == 100) - ue->N_TA_offset = 624; - else if (N_RB == 50) - ue->N_TA_offset = 624/2; - else if (N_RB == 25) - ue->N_TA_offset = 624/4; + default: + AssertFatal(1==0, "Invalid scs_common!\n"); } - if (fp->threequarter_fs == 1) - factor = factor*.75; - ue->N_TA_offset = (int)(N_TA_offset * factor); - LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, N_RB); + LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d, mu %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, fp->N_RB_DL, fp->numerology_index); } } diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index c5904a7da55178d6a9d0794a163e7ccc1190cfff..9aabc5e1e95602180ded57106d8f9aeaaabfe656 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -27,12 +27,9 @@ uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3}; uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16}; -int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp) -{ +int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb) { int mu = fp->numerology_index; - uint8_t half_frame_index = fp->half_frame_bit; - uint8_t i_ssb = fp->ssb_index; int symbol = 0; uint8_t n, n_temp; nr_ssb_type_e type = fp->ssb_type; @@ -69,15 +66,11 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp) AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu); } - if (half_frame_index) - symbol += (5 * fp->symbols_per_slot * fp->slots_per_subframe); - return symbol; } -void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) +void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL) { - switch(mu) { case NR_MU_0: //15kHz scs @@ -99,108 +92,17 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) else AssertFatal(1==0,"NR Operating Band n%d not available for SS block SCS with mu=%d\n", fp->nr_band, mu); } - - switch(bw){ - case 5: - case 15: - case 20: - case 25: - case 30: - case 40: //40 MHz - if (fp->threequarter_fs) { - fp->ofdm_symbol_size = 1536; - fp->first_carrier_offset = 900; //1536 - ( (106*12) / 2 ) - fp->nb_prefix_samples0 = 132; - fp->nb_prefix_samples = 108; - } - else { - fp->ofdm_symbol_size = 2048; - fp->first_carrier_offset = 1412; //2048 - ( (106*12) / 2 ) - fp->nb_prefix_samples0 = 176; - fp->nb_prefix_samples = 144; - } - break; - - case 50: - case 60: - case 70: - - case 80: //80 MHz - if (fp->threequarter_fs) { - fp->ofdm_symbol_size = 3072; - fp->first_carrier_offset = 1770; //3072 - ( (217*12) / 2 ) - fp->nb_prefix_samples0 = 264; - fp->nb_prefix_samples = 216; - } - else { - fp->ofdm_symbol_size = 4096; - fp->first_carrier_offset = 2794; //4096 - ( (217*12) / 2 ) - fp->nb_prefix_samples0 = 352; - fp->nb_prefix_samples = 288; - } - break; - - case 90: - AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for %d MHz band and MU %d\n",bw,mu); - fp->ofdm_symbol_size = 4096; - fp->first_carrier_offset = 2626; //4096 - ( (245*12) / 2 ) - fp->nb_prefix_samples0 = 352; - fp->nb_prefix_samples = 288; - break; - case 100: - AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for %d MHz band and MU %d\n",bw,mu); - fp->ofdm_symbol_size = 4096; - fp->first_carrier_offset = 2458; //4096 - ( (273*12) / 2 ) - fp->nb_prefix_samples0 = 352; - fp->nb_prefix_samples = 288; - break; - default: - AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp); - } break; case NR_MU_2: //60kHz scs fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_2]; - - switch(bw){ //FR1 bands only - case 10: - case 15: - case 20: - case 25: - case 30: - case 40: - case 50: - case 60: - case 70: - case 80: - case 90: - case 100: - default: - AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp); - } break; case NR_MU_3: fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_3]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_3]; fp->ssb_type = nr_ssb_type_D; - switch(bw){ - case 100: - fp->ofdm_symbol_size = 1024; - fp->first_carrier_offset = 628; //1024 - ( (66*12) / 2 ) - fp->nb_prefix_samples0 = 136; - fp->nb_prefix_samples = 72; - break; - case 50: - fp->ofdm_symbol_size = 512; - fp->first_carrier_offset = 320; //1024 - ( (66*12) / 2 ) - fp->nb_prefix_samples0 = 68; - fp->nb_prefix_samples = 36; - break; - default: - AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp); - } break; case NR_MU_4: @@ -209,9 +111,21 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) fp->ssb_type = nr_ssb_type_E; break; - default: - AssertFatal(1==0,"Invalid numerology index %d", mu); + default: + AssertFatal(1==0,"Invalid numerology index %d", mu); } + + if(fp->threequarter_fs) + fp->ofdm_symbol_size = 3 * 128; + else + fp->ofdm_symbol_size = 4 * 128; + + while(fp->ofdm_symbol_size < N_RB_DL * 12) + fp->ofdm_symbol_size <<= 1; + + fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2); + fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9; + fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu)); } uint32_t get_samples_per_slot(int slot, NR_DL_FRAME_PARMS* fp) @@ -280,13 +194,13 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, fp->half_frame_bit = 0; // half frame bit initialized to 0 here fp->numerology_index = mu; - set_scs_parameters(fp, mu, cfg->carrier_config.dl_bandwidth.value); + set_scs_parameters(fp, mu, fp->N_RB_DL); fp->slots_per_frame = 10* fp->slots_per_subframe; - fp->nb_antenna_ports_gNB = cfg->carrier_config.num_tx_ant.value;// It corresponds to pdsch_AntennaPorts + fp->nb_antenna_ports_gNB = 1; // It corresponds to the number of common antenna ports fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB - fp->nb_antennas_tx = 1; // It corresponds to the number of UE Tx antennas + fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe; @@ -334,6 +248,11 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, uint8_t Nid_cell = 0; int Ncp = NORMAL; + if(fp->nb_antennas_rx == 0) + fp->nb_antennas_rx = 1; + if(fp->nb_antennas_tx == 0) + fp->nb_antennas_tx = 1; + // default values until overwritten by RRCConnectionReconfiguration fp->nb_antenna_ports_gNB = nb_ant_ports_gNB; fp->tdd_config = tdd_cfg; @@ -342,8 +261,11 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, LOG_I(PHY, "Initializing frame parms: set nb_antenna_ports_gNB %d, tdd_config, %d, Nid_cell %d\n", fp->nb_antenna_ports_gNB, fp->tdd_config, fp->Nid_cell); + uint64_t dl_bw_khz = (12*config->carrier_config.dl_grid_size[config->ssb_config.scs_common])*(15<<config->ssb_config.scs_common); + LOG_I(PHY,"dl_bw_kHz %lu\n",dl_bw_khz); fp->dl_CarrierFreq = ((dl_bw_khz>>1) + config->carrier_config.dl_frequency)*1000 ; + LOG_I(PHY,"dl_CarrierFreq %lu\n",fp->dl_CarrierFreq); uint64_t ul_bw_khz = (12*config->carrier_config.ul_grid_size[config->ssb_config.scs_common])*(15<<config->ssb_config.scs_common); fp->ul_CarrierFreq = ((ul_bw_khz>>1) + config->carrier_config.uplink_frequency)*1000 ; @@ -358,7 +280,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset); - AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type in config request file for band %d\n", fp->nr_band); + AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type (frame_type %d,cell_config.frame_duplex_type %d) in config request file for band %d\n", fp->frame_type,config->cell_config.frame_duplex_type,fp->nr_band); AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + uplink_frequency_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + uplink_frequency_offset); @@ -373,7 +295,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fp->Ncp = Ncp; - set_scs_parameters(fp,fp->numerology_index,config->carrier_config.dl_bandwidth); + set_scs_parameters(fp, fp->numerology_index, fp->N_RB_DL); fp->slots_per_frame = 10* fp->slots_per_subframe; fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index 9c474264c8387288260a737533293541928c32c7..2db0ccc258f23b8992b40c6b87c1ca7e5c94f6d8 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -392,7 +392,7 @@ void phy_config_update_sib13_request(PHY_Config_t *phy_config); int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); -int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp); +int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb); int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band); int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index 0d765a18b339c6fe92109207cb7067cbd50ea3cc..57b4c286612edda81863082dd167be4e54c14b79 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -37,266 +37,82 @@ // Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs) #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" -int* sync_corr_ue0 = NULL; -int* sync_corr_ue1 = NULL; -int* sync_corr_ue2 = NULL; -int sync_tmp[2048*4] __attribute__((aligned(32))); -short syncF_tmp[2048*2] __attribute__((aligned(32))); - - -int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *common_vars -{ - int i,k; - - sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); - sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); - sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); - - if (sync_corr_ue0) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue0); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue0 not allocated\n"); - return(-1); - } - - if (sync_corr_ue1) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue1); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue1 not allocated\n"); - return(-1); - } - - if (sync_corr_ue2) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue2); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue2 not allocated\n"); - return(-1); - } - - // primary_synch0_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch0_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch0_time) { - // bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time allocated at %p\n", primary_synch0_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time not allocated\n"); - return(-1); - } - - // primary_synch1_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch1_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); +static struct complex16 *primary_synch0_time __attribute__((aligned(32))); +static struct complex16 *primary_synch1_time __attribute__((aligned(32))); +static struct complex16 *primary_synch2_time __attribute__((aligned(32))); - if (primary_synch1_time) { - // bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time allocated at %p\n", primary_synch1_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time not allocated\n"); - return(-1); - } - - // primary_synch2_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch2_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch2_time) { - // bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time allocated at %p\n", primary_synch2_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time not allocated\n"); - return(-1); - } - - - // generate oversampled sync_time sequences - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch0[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch0[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; - } - } - - switch (frame_parms->N_RB_DL) { +static void doIdft(int size, short *in, short *out) { + switch (size) { case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); + idft(IDFT_128,in,out,1); break; + case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); + idft(IDFT_512,in,out,1); break; + case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); + idft(IDFT_1024,in,out,1); break; case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, - 1); /// complex output + idft(IDFT_1536,in,out,1); break; + case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); + idft(IDFT_2048,in,out,1); break; + default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); + LOG_E(PHY,"Unsupported N_RB_DL %d\n",size); + abort(); break; - } - - for (i=0; i<frame_parms->ofdm_symbol_size; i++) - ((int32_t*)primary_synch0_time)[i] = sync_tmp[i]; - - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch1[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch1[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; } } - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; +static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) { + int k=ofdmSize-36; - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - for (i=0; i<frame_parms->ofdm_symbol_size; i++) - ((int32_t*)primary_synch1_time)[i] = sync_tmp[i]; - - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch2[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch2[2*i+1]>>2; + for (int i=0; i<72; i++) { + out[k].r = in[i].r>>1; //we need to shift input to avoid overflow in fft + out[k].i = in[i].i>>1; k++; - if (k >= frame_parms->ofdm_symbol_size) { + if (k >= ofdmSize) { k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; + k-=ofdmSize; } } - - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; } - for (i=0; i<frame_parms->ofdm_symbol_size; i++) - ((int32_t*)primary_synch2_time)[i] = sync_tmp[i]; - +int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars + struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}}; + int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time); + AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch0_time,sz); + AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch1_time,sz); + AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch2_time,sz); + // generate oversampled sync_time sequences + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch0, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch0_time); + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch1, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch1_time); + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time); if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1); } + return (1); } -void lte_sync_time_free(void) -{ - if (sync_corr_ue0) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue0); - free(sync_corr_ue0); - } - - if (sync_corr_ue1) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue1); - free(sync_corr_ue1); - } - - if (sync_corr_ue2) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue2); - free(sync_corr_ue2); - } - +void lte_sync_time_free(void) { if (primary_synch0_time) { LOG_D(PHY,"Freeing primary_sync0_time ...\n"); free(primary_synch0_time); @@ -312,126 +128,81 @@ void lte_sync_time_free(void) free(primary_synch2_time); } - sync_corr_ue0 = NULL; - sync_corr_ue1 = NULL; - sync_corr_ue2 = NULL; primary_synch0_time = NULL; primary_synch1_time = NULL; primary_synch2_time = NULL; } -static inline int abs32(int x) -{ +static inline int abs32(int x) { return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1])); } +static inline double absF(struct complexd x) { + return x.r*x.r+x.i*x.i; +} + +#define complexNull(c) bzero((void*) &(c), sizeof(c)) #define SHIFT 17 int lte_sync_time(int **rxdata, ///rx data in time domain LTE_DL_FRAME_PARMS *frame_parms, - int *eNB_id) -{ + int *eNB_id) { // perform a time domain correlation using the oversampled sync sequence - unsigned int n, ar, s, peak_pos, peak_val, sync_source; int result,result2; - int sync_out[3] = {0,0,0},sync_out2[3] = {0,0,0}; - int tmp[3] = {0,0,0}; + struct complexd sync_out[3]= {{0}}, sync_out2[3]= {{0}}; int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti>>1; - - //LOG_D(PHY,"[SYNC TIME] Calling sync_time.\n"); - AssertFatal(sync_corr_ue0 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - AssertFatal(sync_corr_ue1 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - AssertFatal(sync_corr_ue2 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - peak_val = 0; peak_pos = 0; sync_source = 0; - for (n=0; n<length; n+=4) { - - sync_corr_ue0[n] = 0; - sync_corr_ue0[n+length] = 0; - sync_corr_ue1[n] = 0; - sync_corr_ue1[n+length] = 0; - sync_corr_ue2[n] = 0; - sync_corr_ue2[n+length] = 0; - for (s=0; s<3; s++) { - sync_out[s]=0; - sync_out2[s]=0; + complexNull(sync_out[s]); + complexNull(sync_out2[s]); } // if (n<(length-frame_parms->ofdm_symbol_size-frame_parms->nb_prefix_samples)) { if (n<(length-frame_parms->ofdm_symbol_size)) { - //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - - ((short*)sync_corr_ue0)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue0)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue0)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue0)[(2*(length+n))+1] += ((short*) &result2)[1]; - ((short*)sync_out)[0] += ((short*) &result)[0]; - ((short*)sync_out)[1] += ((short*) &result)[1]; - ((short*)sync_out2)[0] += ((short*) &result2)[0]; - ((short*)sync_out2)[1] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[0].r += ((short *) &result)[0]; + sync_out[0].i += ((short *) &result)[1]; + sync_out2[0].r += ((short *) &result2)[0]; + sync_out2[0].i += ((short *) &result2)[1]; } for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) { - result = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - ((short*)sync_corr_ue1)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue1)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue1)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue1)[(2*(length+n))+1] += ((short*) &result2)[1]; - - ((short*)sync_out)[2] += ((short*) &result)[0]; - ((short*)sync_out)[3] += ((short*) &result)[1]; - ((short*)sync_out2)[2] += ((short*) &result2)[0]; - ((short*)sync_out2)[3] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[1].r += ((short *) &result)[0]; + sync_out[1].i += ((short *) &result)[1]; + sync_out2[1].r += ((short *) &result2)[0]; + sync_out2[1].i += ((short *) &result2)[1]; } for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - ((short*)sync_corr_ue2)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue2)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue2)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue2)[(2*(length+n))+1] += ((short*) &result2)[1]; - ((short*)sync_out)[4] += ((short*) &result)[0]; - ((short*)sync_out)[5] += ((short*) &result)[1]; - ((short*)sync_out2)[4] += ((short*) &result2)[0]; - ((short*)sync_out2)[5] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[2].r += ((short *) &result)[0]; + sync_out[2].i += ((short *) &result)[1]; + sync_out2[2].r += ((short *) &result2)[0]; + sync_out2[2].i += ((short *) &result2)[1]; } - } // calculate the absolute value of sync_corr[n] - sync_corr_ue0[n] = abs32(sync_corr_ue0[n]); - sync_corr_ue0[n+length] = abs32(sync_corr_ue0[n+length]); - sync_corr_ue1[n] = abs32(sync_corr_ue1[n]); - sync_corr_ue1[n+length] = abs32(sync_corr_ue1[n+length]); - sync_corr_ue2[n] = abs32(sync_corr_ue2[n]); - sync_corr_ue2[n+length] = abs32(sync_corr_ue2[n+length]); - for (s=0; s<3; s++) { - tmp[s] = (abs32(sync_out[s])>>1) + (abs32(sync_out2[s])>>1); + double tmp = absF(sync_out[s]) + absF(sync_out2[s]); - if (tmp[s]>peak_val) { - peak_val = tmp[s]; + if (tmp>peak_val) { + peak_val = tmp; peak_pos = n; sync_source = s; /* @@ -443,42 +214,22 @@ int lte_sync_time(int **rxdata, ///rx data in time domain } *eNB_id = sync_source; - - LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2); - - - if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ - static int debug_cnt; - if (debug_cnt == 0) { - LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2); - LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2); - LOG_M("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2); - LOG_M("rxdata0.m","rxd0",rxdata[0],length<<1,1,1); - // exit(-1); - } else { - debug_cnt++; - } -} + LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val/2,dB_fixed(peak_val/2)/2); return(peak_pos); } -int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars -{ +int ru_sync_time_init(RU_t *ru) { // LTE_UE_COMMON *common_vars /* int16_t dmrs[2048]; int16_t *dmrsp[2] = {dmrs,NULL}; */ - int32_t dmrs[ru->frame_parms->ofdm_symbol_size*14] __attribute__((aligned(32))); //int32_t *dmrsp[2] = {&dmrs[(3-ru->frame_parms->Ncp)*ru->frame_parms->ofdm_symbol_size],NULL}; int32_t *dmrsp[2] = {&dmrs[0],NULL}; - generate_ul_ref_sigs(); - - ru->dmrssync = (int16_t*)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t)); - ru->dmrs_corr = (uint64_t*)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t)); - + ru->dmrssync = (int16_t *)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t)); + ru->dmrs_corr = (uint64_t *)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t)); generate_drs_pusch(NULL, NULL, ru->frame_parms, @@ -491,35 +242,39 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars 0); switch (ru->frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, - 1); /// complex output - break; - case 100: - idft(IDFT_2048,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - default: - AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL); - break; + case 6: + idft(IDFT_128,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 25: + idft(IDFT_512,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 50: + idft(IDFT_1024,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 75: + idft(IDFT_1536,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, + 1); /// complex output + break; + + case 100: + idft(IDFT_2048,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + default: + AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL); + break; } return(0); @@ -527,10 +282,11 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars void ru_sync_time_free(RU_t *ru) { - AssertFatal(ru->dmrssync!=NULL,"ru->dmrssync is NULL\n"); free(ru->dmrssync); - if (ru->dmrs_corr) free(ru->dmrs_corr); + + if (ru->dmrs_corr) + free(ru->dmrs_corr); } //#define DEBUG_PHY @@ -539,10 +295,8 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain LTE_DL_FRAME_PARMS *frame_parms, uint32_t length, uint32_t *peak_val_out, - uint32_t *sync_corr_eNB) -{ + uint32_t *sync_corr_eNB) { // perform a time domain correlation using the oversampled sync sequence - unsigned int n, ar, peak_val, peak_pos; uint64_t mean_val; int result; @@ -556,21 +310,21 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain } switch (eNB_id) { - case 0: - primary_synch_time = (short*)primary_synch0_time; - break; + case 0: + primary_synch_time = (short *)primary_synch0_time; + break; - case 1: - primary_synch_time = (short*)primary_synch1_time; - break; + case 1: + primary_synch_time = (short *)primary_synch1_time; + break; - case 2: - primary_synch_time = (short*)primary_synch2_time; - break; + case 2: + primary_synch_time = (short *)primary_synch2_time; + break; - default: - LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n"); - return (-1); + default: + LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n"); + return (-1); } peak_val = 0; @@ -578,21 +332,16 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain mean_val = 0; for (n=0; n<length; n+=4) { - sync_corr_eNB[n] = 0; if (n<(length-frame_parms->ofdm_symbol_size-frame_parms->nb_prefix_samples)) { - //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result = dot_product((short *)primary_synch_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); //((short*)sync_corr)[2*n] += ((short*) &result)[0]; //((short*)sync_corr)[2*n+1] += ((short*) &result)[1]; sync_corr_eNB[n] += abs32(result); - } - } /* @@ -610,7 +359,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain } mean_val/=length; - *peak_val_out = peak_val; if (peak_val <= (40*(uint32_t)mean_val)) { @@ -620,88 +368,91 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain LOG_I(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %"PRIu64"\n",peak_pos,peak_val,mean_val); return(peak_pos); } - } -static inline int64_t abs64(int64_t x) -{ - return (((int64_t)((int32_t*)&x)[0])*((int64_t)((int32_t*)&x)[0]) + ((int64_t) -((int32_t*)&x)[1])*((int64_t)((int32_t*)&x)[1])); +static inline int64_t abs64(int64_t x) { + return (((int64_t)((int32_t *)&x)[0])*((int64_t)((int32_t *)&x)[0]) + ((int64_t) + ((int32_t *)&x)[1])*((int64_t)((int32_t *)&x)[1])); } int ru_sync_time(RU_t *ru, int64_t *lev, - int64_t *avg) -{ + int64_t *avg) { LTE_DL_FRAME_PARMS *frame_parms = ru->frame_parms; RU_CALIBRATION *calibration = &ru->calibration; - // perform a time domain correlation using the oversampled sync sequence - int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti; - // circular copy of beginning to end of rxdata buffer. Note: buffer should be big enough upon calling this function - for (int ar=0;ar<ru->nb_rx;ar++) memcpy((void*)&ru->common.rxdata[ar][2*length], - (void*)&ru->common.rxdata[ar][0], - frame_parms->ofdm_symbol_size); - + for (int ar=0; ar<ru->nb_rx; ar++) + memcpy((void *)&ru->common.rxdata[ar][2*length], + (void *)&ru->common.rxdata[ar][0], + frame_parms->ofdm_symbol_size); + int32_t maxlev0=0; int maxpos0=0; int64_t avg0=0; int64_t result; int64_t dmrs_corr; - int maxval=0; - for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) { + + for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) { maxval = max(maxval,ru->dmrssync[i]); maxval = max(maxval,-ru->dmrssync[i]); } if (ru->state == RU_CHECK_SYNC) { - for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) { - maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]); - maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]); - } + for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) { + maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]); + maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]); + } } int shift = log2_approx(maxval); for (int n=0; n<length; n+=4) { - dmrs_corr = 0; //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; for (int ar=0; ar<ru->nb_rx; ar++) { - result = dot_product64(ru->dmrssync, - (int16_t*) &ru->common.rxdata[ar][n], - frame_parms->ofdm_symbol_size, - shift); - - if (ru->state == RU_CHECK_SYNC) { - result = dot_product64((int16_t*) &calibration->drs_ch_estimates_time[ar], - (int16_t*) &ru->common.rxdata[ar][n], + (int16_t *) &ru->common.rxdata[ar][n], frame_parms->ofdm_symbol_size, shift); + + if (ru->state == RU_CHECK_SYNC) { + result = dot_product64((int16_t *) &calibration->drs_ch_estimates_time[ar], + (int16_t *) &ru->common.rxdata[ar][n], + frame_parms->ofdm_symbol_size, + shift); } + dmrs_corr += abs64(result); } - if (ru->dmrs_corr != NULL) ru->dmrs_corr[n] = dmrs_corr; + + if (ru->dmrs_corr != NULL) + ru->dmrs_corr[n] = dmrs_corr; // tmpi holds <synchi,rx0>+<synci,rx1>+...+<synchi,rx_{nbrx-1}> + if (dmrs_corr>maxlev0) { + maxlev0 = dmrs_corr; + maxpos0 = n; + } - if (dmrs_corr>maxlev0) { maxlev0 = dmrs_corr; maxpos0 = n; } avg0 += dmrs_corr; } - avg0/=(length/4); + avg0/=(length/4); int dmrsoffset = frame_parms->samples_per_tti + (3*frame_parms->ofdm_symbol_size)+(3*frame_parms->nb_prefix_samples) + frame_parms->nb_prefix_samples0; - - if ((int64_t)maxlev0 > (10*avg0)) {*lev = maxlev0; *avg=avg0; return((length+maxpos0-dmrsoffset)%length);} + + if ((int64_t)maxlev0 > (10*avg0)) { + *lev = maxlev0; + *avg=avg0; + return((length+maxpos0-dmrsoffset)%length); + } return(-1); } diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c index c5e48d83643a7782ff43e49dc12ffd827c258ef5..596760541b2a7087d75c173cbd33727852f5d330 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold.c @@ -56,7 +56,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14] (((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) @@ -103,7 +103,7 @@ void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_ //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 // printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) @@ -143,7 +143,7 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_ //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 //printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); //skip first 50 double words (1600 bits) diff --git a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c index b057f6a40343719a5b85c575889563d15d1842de..78f0fd93fe3e9904a51fb871e099b8ce2c1d65ab 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c @@ -59,7 +59,7 @@ void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_tabl //n = 0 // printf("cinit (sfn %d, l %d) => %d\n",sfn,l,x2); // Initializing the Sequence - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) // printf("n=0 : x1 %x, x2 %x\n",x1,x2); @@ -90,7 +90,7 @@ void lte_gold_mbsfn_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold for (sfn=0; sfn<10; sfn++) { x2 = (Nid_mbsfn) + (((1+(Nid_mbsfn<<1))*(1 + (7*(1+sfn))))<<9); //cinit - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); for (n=1; n<50; n++) { diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index d48164e07d605a16aa27e3c81415c85879585f67..b03f59fb784c0f6a49d50710f972ab6ad51c193f 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -121,7 +121,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, for (n=0; n<(1+(G>>5)); n++) { #ifdef DEBUG_SCRAMBLING - for (int k=0; k<32; k++) printf("scrambling %d : %d xor %d = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1)); + for (int k=0; k<32; k++) printf("scrambling %d : %x xor %x = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1)); #endif e[0] = (e[0]) ^ (s&1); diff --git a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c index b249052cbf26c477276f251a7c502cd0b3b4c0cb..a23f8db4f28f0a3c861e65281904287f7c2f8634 100644 --- a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c +++ b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c @@ -41,7 +41,7 @@ extern inline uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t res { // Init value for x1: x1(0) = 1, x1(n) = 0, n=1,2,...,30 // x1(31) = [x1(3) + x1(0)]mod2 = 1 - *x1 = 1 + (1<<31); + *x1 = 1 + (1U<<31); // Init value for x2: cinit = sum_{i=0}^30 x2*2^i // x2(31) = [x2(3) + x2(2) + x2(1) + x2(0)]mod2 // = (*x2>>3) ^ (*x2>>2) + (*x2>>1) + *x2 diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 92fe77720115b933095a05521fe8677021e6ef19..476d7028b11d77b54639573f3f040b67af05caea 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -374,7 +374,7 @@ static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2, int n; if (reset) { - *x1 = 1+ (1<<31); + *x1 = 1+ (1U<<31); *x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31); // skip first 50 double words (1600 bits) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c index e6960273c7300a707c44437f14bf4b146c2725fd..9c0edb467ca1a75efc66160c1f54521a3d4d09d7 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c @@ -170,6 +170,7 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms, Msc_RS = msrsb * 6; k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC; + AssertFatal(msrsb,"divide by 0"); nb = (4*n_RRC/msrsb)%Nb; for (b=0; b<=Bsrs; b++) { diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index b1f419b1724b8462489ba9d25789685265ddf52b..4405c46abf828a1b811a2369bd470cb20e3e8322 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -145,7 +145,8 @@ int nr_beam_precoding(int32_t **txdataF, int slot, int symbol, int aa, - int nb_antenna_ports) + int nb_antenna_ports, + int offset) { @@ -155,14 +156,14 @@ int nr_beam_precoding(int32_t **txdataF, memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); for (p=0; p<nb_antenna_ports; p++) { - if ((frame_parms->L_ssb >> (63-p)) & 0x01) { - multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size], + //if ((frame_parms->L_ssb >> (63-p)) & 0x01) { + multadd_cpx_vector((int16_t*)&txdataF[p][(symbol*frame_parms->ofdm_symbol_size)+offset], (int16_t*)beam_weights[p][aa], (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, frame_parms->ofdm_symbol_size, 15); - } + //} } return 0; } diff --git a/openair1/PHY/MODULATION/modulation_UE.h b/openair1/PHY/MODULATION/modulation_UE.h index 72a1334fe99be0e88f67a26480897e74bc8bbbfa..20fdaa7ad84f0fef7433432c7ac0c847f9fd1f99 100644 --- a/openair1/PHY/MODULATION/modulation_UE.h +++ b/openair1/PHY/MODULATION/modulation_UE.h @@ -51,16 +51,13 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, int nr_slot_fep(PHY_VARS_NR_UE *phy_vars_ue, UE_nr_rxtx_proc_t *proc, unsigned char l, - unsigned char Ns, - int sample_offset, - int no_prefix); + unsigned char Ns); int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, unsigned char symbol, unsigned char Ns, - int sample_offset, - int no_prefix); + int sample_offset); int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue, unsigned char l, diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index f12dcfc01bee9eddd3a76be29125925cf440ec42..e32f6bf575add7a80ad80e60b9938bbccb770471 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -22,6 +22,101 @@ #include "nr_modulation.h" #include "PHY/NR_REFSIG/nr_mod_table.h" +//Table 6.3.1.5-1 Precoding Matrix W 1 layer 2 antenna ports 'n' = -1 and 'o' = -j +char nr_W_1l_2p[6][2][1] = { + {{'1'}, {'0'}},//pmi 0 + {{'0'}, {'1'}}, + {{'1'}, {'1'}}, + {{'1'}, {'n'}}, + {{'1'}, {'j'}}, + {{'1'}, {'o'}}//pmi 5 +}; + +//Table 6.3.1.5-3 Precoding Matrix W 1 layer 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_1l_4p[28][4][1] = { + {{'1'}, {'0'}, {'0'}, {'0'}},//pmi 0 + {{'0'}, {'1'}, {'0'}, {'0'}}, + {{'0'}, {'0'}, {'1'}, {'0'}}, + {{'0'}, {'0'}, {'0'}, {'1'}}, + {{'1'}, {'0'}, {'1'}, {'0'}}, + {{'1'}, {'0'}, {'n'}, {'0'}}, + {{'1'}, {'0'}, {'j'}, {'0'}}, + {{'1'}, {'0'}, {'o'}, {'0'}},//pmi 7 + {{'0'}, {'1'}, {'0'}, {'1'}},//pmi 8 + {{'0'}, {'1'}, {'0'}, {'n'}}, + {{'0'}, {'1'}, {'0'}, {'j'}}, + {{'0'}, {'1'}, {'0'}, {'o'}}, + {{'1'}, {'1'}, {'1'}, {'1'}}, + {{'1'}, {'1'}, {'j'}, {'j'}}, + {{'1'}, {'1'}, {'n'}, {'n'}}, + {{'1'}, {'1'}, {'o'}, {'o'}}, + {{'1'}, {'j'}, {'1'}, {'j'}},//pmi 16 + {{'1'}, {'j'}, {'j'}, {'n'}}, + {{'1'}, {'j'}, {'n'}, {'o'}}, + {{'1'}, {'j'}, {'o'}, {'1'}}, + {{'1'}, {'n'}, {'1'}, {'n'}}, + {{'1'}, {'n'}, {'j'}, {'o'}}, + {{'1'}, {'n'}, {'n'}, {'1'}}, + {{'1'}, {'n'}, {'o'}, {'j'}},//pmi 23 + {{'1'}, {'o'}, {'1'}, {'o'}},//pmi 24 + {{'1'}, {'o'}, {'j'}, {'1'}}, + {{'1'}, {'o'}, {'n'}, {'j'}}, + {{'1'}, {'o'}, {'o'}, {'n'}}//pmi 27 +}; + +//Table 6.3.1.5-4 Precoding Matrix W 2 antenna ports layers 2 'n' = -1 and 'o' = -j +char nr_W_2l_2p[3][2][2] = { + {{'1', '0'}, {'0', '1'}},//pmi 0 + {{'1', '1'}, {'1', 'n'}}, + {{'1', '1'}, {'j', 'o'}} //pmi 2 +}; + +//Table 6.3.1.5-5 Precoding Matrix W 2 layers 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_2l_4p[22][4][2] = { + {{'1', '0'}, {'0', '1'}, {'0', '0'}, {'0', '0'}},//pmi 0 + {{'1', '0'}, {'0', '0'}, {'0', '1'}, {'0', '0'}}, + {{'1', '0'}, {'0', '0'}, {'0', '0'}, {'0', '1'}}, + {{'0', '0'}, {'1', '0'}, {'0', '1'}, {'0', '0'}},//pmi 3 + {{'0', '0'}, {'1', '0'}, {'0', '0'}, {'0', '1'}},//pmi 4 + {{'0', '0'}, {'0', '0'}, {'1', '0'}, {'0', '1'}}, + {{'1', '0'}, {'0', '1'}, {'1', '0'}, {'0', 'o'}}, + {{'1', '0'}, {'0', '1'}, {'1', '0'}, {'0', 'j'}}, + {{'1', '0'}, {'0', '1'}, {'o', '0'}, {'0', '1'}},//pmi 8 + {{'1', '0'}, {'0', '1'}, {'o', '0'}, {'0', 'n'}}, + {{'1', '0'}, {'0', '1'}, {'n', '0'}, {'0', 'o'}}, + {{'1', '0'}, {'0', '1'}, {'n', '0'}, {'0', 'j'}},//pmi 11 + {{'1', '0'}, {'0', '1'}, {'j', '0'}, {'0', '1'}},//pmi 12 + {{'1', '0'}, {'0', '1'}, {'j', '0'}, {'0', 'n'}}, + {{'1', '1'}, {'1', '1'}, {'1', 'n'}, {'1', 'n'}}, + {{'1', '1'}, {'1', '1'}, {'j', 'o'}, {'j', 'o'}},//pmi 15 + {{'1', '1'}, {'j', 'j'}, {'1', 'n'}, {'j', 'o'}},//pmi 16 + {{'1', '1'}, {'j', 'j'}, {'j', 'o'}, {'n', '1'}}, + {{'1', '1'}, {'n', 'n'}, {'1', 'n'}, {'n', '1'}}, + {{'1', '1'}, {'n', 'n'}, {'j', 'o'}, {'o', 'j'}},//pmi 19 + {{'1', '1'}, {'o', 'o'}, {'1', 'n'}, {'o', 'j'}}, + {{'1', '1'}, {'o', 'o'}, {'j', 'o'}, {'1', 'n'}}//pmi 21 +}; + +//Table 6.3.1.5-6 Precoding Matrix W 3 layers 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_3l_4p[7][4][3] = { + {{'1', '0', '0'}, {'0', '1', '0'}, {'0', '0', '1'},{'0', '0', '0'}},//pmi 0 + {{'1', '0', '0'}, {'0', '1', '0'}, {'1', '0', '0'},{'0', '0', '1'}}, + {{'1', '0', '0'}, {'0', '1', '0'}, {'n', '0', '0'},{'0', '0', '1'}}, + {{'1', '1', '1'}, {'1', 'n', '1'}, {'1', '1', 'n'},{'1', 'n', 'n'}},//pmi 3 + {{'1', '1', '1'}, {'1', 'n', '1'}, {'j', 'j', 'o'},{'j', 'o', 'o'}},//pmi 4 + {{'1', '1', '1'}, {'n', '1', 'n'}, {'1', '1', 'n'},{'n', '1', '1'}}, + {{'1', '1', '1'}, {'n', '1', 'n'}, {'j', 'j', 'o'},{'o', 'j', 'j'}} +}; + +//Table 6.3.1.5-7 Precoding Matrix W 4 layers 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_4l_4p[5][4][4] = { + {{'1', '0', '0', '0'}, {'0', '1', '0', '0'}, {'0', '0', '1', '0'}, {'0', '0', '0', '1'}},//pmi 0 + {{'1', '1', '0', '0'}, {'0', '0', '1', '1'}, {'1', 'n', '0', '0'}, {'0', '0', '1', 'n'}}, + {{'1', '1', '0', '0'}, {'0', '0', '1', '1'}, {'j', 'o', '0', '0'}, {'0', '0', 'j', 'o'}}, + {{'1', '1', '1', '1'}, {'1', 'n', '1', 'n'}, {'1', '1', 'n', 'n'}, {'1', 'n', 'n', '1'}},//pmi 3 + {{'1', '1', '1', '1'}, {'1', 'n', '1', 'n'}, {'j', 'j', 'o', 'o'}, {'j', 'o', 'o', 'j'}}//pmi 4 +}; + void nr_modulation(uint32_t *in, uint32_t length, uint16_t mod_order, @@ -37,7 +132,7 @@ void nr_modulation(uint32_t *in, uint32_t i,j; uint32_t bit_cnt; uint64_t x,x1,x2; - + #if defined(__SSE2__) __m128i *nr_mod_table128; __m128i *out128; @@ -56,7 +151,7 @@ void nr_modulation(uint32_t *in, // the bits that are left out i = i*8/2; nr_mod_table32 = (int32_t*) nr_qpsk_mod_table; - while (i<length/2){ + while (i<length/2) { idx = ((in_bytes[(i*2)/8]>>((i*2)&0x7)) & mask); out32[i] = nr_mod_table32[idx]; i++; @@ -78,7 +173,7 @@ void nr_modulation(uint32_t *in, out64[i] = nr_16qam_byte_mod_table[in_bytes[i]]; // the bits that are left out i = i*8/4; - while (i<length/4){ + while (i<length/4) { idx = ((in_bytes[(i*4)/8]>>((i*4)&0x7)) & mask); out32[i] = nr_16qam_mod_table[idx]; i++; @@ -88,7 +183,7 @@ void nr_modulation(uint32_t *in, case 6: j = 0; for (i=0; i<length/192; i++) { - x = in64[i*3]; + x = in64[i*3]; x1 = x&4095; out64[j++] = nr_64qam_mod_table[x1]; x1 = (x>>12)&4095; @@ -140,7 +235,7 @@ void nr_modulation(uint32_t *in, bit_cnt += 24; } return; - + case 8: nr_mod_table32 = (int32_t*) nr_256qam_mod_table; for (i=0; i<length/8; i++) @@ -151,20 +246,20 @@ void nr_modulation(uint32_t *in, break; } AssertFatal(false,"Invalid or unsupported modulation order %d\n",mod_order); - } void nr_layer_mapping(int16_t **mod_symbs, - uint8_t n_layers, - uint16_t n_symbs, - int16_t **tx_layers) { + uint8_t n_layers, + uint16_t n_symbs, + int16_t **tx_layers) +{ LOG_D(PHY,"Doing layer mapping for %d layers, %d symbols\n",n_layers,n_symbs); switch (n_layers) { case 1: memcpy((void*)tx_layers[0], (void*)mod_symbs[0], (n_symbs<<1)*sizeof(int16_t)); - break; + break; case 2: case 3: @@ -174,7 +269,7 @@ void nr_layer_mapping(int16_t **mod_symbs, tx_layers[l][i<<1] = mod_symbs[0][(n_layers*i+l)<<1]; tx_layers[l][(i<<1)+1] = mod_symbs[0][((n_layers*i+l)<<1)+1]; } - break; + break; case 5: for (int i=0; i<n_symbs>>1; i++) @@ -186,8 +281,8 @@ void nr_layer_mapping(int16_t **mod_symbs, for (int l=2; l<5; l++) { tx_layers[l][i<<1] = mod_symbs[1][(3*i+l)<<1]; tx_layers[l][(i<<1)+1] = mod_symbs[1][((3*i+l)<<1)+1]; - } - break; + } + break; case 6: for (int q=0; q<2; q++) @@ -196,7 +291,7 @@ void nr_layer_mapping(int16_t **mod_symbs, tx_layers[l][i<<1] = mod_symbs[q][(3*i+l)<<1]; tx_layers[l][(i<<1)+1] = mod_symbs[q][((3*i+l)<<1)+1]; } - break; + break; case 7: for (int i=0; i<n_symbs/3; i++) @@ -209,7 +304,7 @@ void nr_layer_mapping(int16_t **mod_symbs, tx_layers[l][i<<1] = mod_symbs[0][((i<<2)+l)<<1]; tx_layers[l][(i<<1)+1] = mod_symbs[0][(((i<<2)+l)<<1)+1]; } - break; + break; case 8: for (int q=0; q<2; q++) @@ -218,42 +313,42 @@ void nr_layer_mapping(int16_t **mod_symbs, tx_layers[l][i<<1] = mod_symbs[q][((i<<2)+l)<<1]; tx_layers[l][(i<<1)+1] = mod_symbs[q][(((i<<2)+l)<<1)+1]; } - break; + break; - default: - AssertFatal(0, "Invalid number of layers %d\n", n_layers); + default: + AssertFatal(0, "Invalid number of layers %d\n", n_layers); } } void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, - uint8_t n_layers, - uint16_t n_symbs, - int16_t **tx_layers) { - + uint8_t n_layers, + uint16_t n_symbs, + int16_t **tx_layers) +{ int16_t *mod_symbs; switch (n_layers) { case 1: mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - for (int i=0; i<n_symbs; i++){ + for (int i=0; i<n_symbs; i++) { tx_layers[0][i<<1] = (mod_symbs[i<<1]*AMP)>>15; tx_layers[0][(i<<1)+1] = (mod_symbs[(i<<1)+1]*AMP)>>15; } - break; + break; case 2: case 3: case 4: mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - for (int i=0; i<n_symbs/n_layers; i++){ + for (int i=0; i<n_symbs/n_layers; i++) { for (int l=0; l<n_layers; l++) { tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15; tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15; } } - break; + break; case 5: mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; @@ -271,11 +366,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; } - break; + break; case 6: - for (int q=0; q<2; q++){ - + for (int q=0; q<2; q++) { mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; for (int i=0; i<n_symbs/3; i++) @@ -284,7 +378,7 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; } } - break; + break; case 7: mod_symbs = (int16_t *)ulsch_ue[1]->d_mod; @@ -302,11 +396,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15; tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; } - break; + break; case 8: - for (int q=0; q<2; q++){ - + for (int q=0; q<2; q++) { mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; for (int i=0; i<n_symbs>>2; i++) @@ -315,10 +408,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; } } - break; + break; - default: - AssertFatal(0, "Invalid number of layers %d\n", n_layers); + default: + AssertFatal(0, "Invalid number of layers %d\n", n_layers); } } @@ -651,3 +744,43 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { } } } + +int nr_layer_precoder(int16_t **datatx_F_precoding, char *prec_matrix, uint8_t n_layers, int32_t re_offset) +{ + int32_t precodatatx_F = 0; + + for (int al = 0; al<n_layers; al++) { + int16_t antenna_re = datatx_F_precoding[al][re_offset<<1]; + int16_t antenna_im = datatx_F_precoding[al][(re_offset<<1) +1]; + + switch (prec_matrix[al]) { + case '0': //multiply by zero + break; + + case '1': //multiply by 1 + ((int16_t *) &precodatatx_F)[0] += antenna_re; + ((int16_t *) &precodatatx_F)[1] += antenna_im; + break; + + case 'n': // multiply by -1 + ((int16_t *) &precodatatx_F)[0] -= antenna_re; + ((int16_t *) &precodatatx_F)[1] -= antenna_im; + break; + + case 'j': // + ((int16_t *) &precodatatx_F)[0] -= antenna_im; + ((int16_t *) &precodatatx_F)[1] += antenna_re; + break; + + case 'o': // -j + ((int16_t *) &precodatatx_F)[0] += antenna_im; + ((int16_t *) &precodatatx_F)[1] -= antenna_re; + break; + } + } + + return precodatatx_F; + // normalize + /* ((int16_t *)precodatatx_F)[0] = (int16_t)((((int16_t *)precodatatx_F)[0]*ONE_OVER_SQRT2_Q15)>>15); + ((int16_t *)precodatatx_F)[1] = (int16_t)((((int16_t *)precodatatx_F)[1]*ONE_OVER_SQRT2_Q15)>>15);*/ +} diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index c6c9718f7eed58a70a5ac24b44d209d6591974d5..547d20952fb4d7e0b5e959535c00088d026af87c 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -28,7 +28,13 @@ #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #define DMRS_MOD_ORDER 2 - +/*Precoding matices: W[pmi][antenna_port][layer]*/ +extern char nr_W_1l_2p[6][2][1]; +extern char nr_W_2l_2p[3][2][2]; +extern char nr_W_1l_4p[28][4][1]; +extern char nr_W_2l_4p[22][4][2]; +extern char nr_W_3l_4p[7][4][3]; +extern char nr_W_4l_4p[5][4][4]; /*! \brief Perform NR modulation. TS 38.211 V15.4.0 subclause 5.1 @param[in] in, Pointer to input bits @param[in] length, size of input bits @@ -74,7 +80,6 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, \param symbol symbol within slot (0..12/14) \param Ns Slot number (0..19) \param sample_offset offset within rxdata (points to beginning of subframe) -\param no_prefix if 1 prefix is removed by HW */ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, @@ -82,8 +87,7 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, int32_t *rxdataF, unsigned char symbol, unsigned char Ns, - int sample_offset, - int no_prefix); + int sample_offset); /*! \brief This function implements the dft transform precoding in PUSCH @@ -100,7 +104,8 @@ int nr_beam_precoding(int32_t **txdataF, int slot, int symbol, int aa, - int nb_antenna_ports + int nb_antenna_ports, + int offset ); void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, @@ -118,4 +123,14 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, int first_symbol, int nsymb, int length); + +/*! \brief Perform NR precoding. TS 38.211 V15.4.0 subclause 6.3.1.5 + @param[in] datatx_F_precoding, Pointer to n_layers*re data array + @param[in] prec_matrix, Pointer to precoding matrix + @param[in] n_layers, number of DLSCH layers +*/ +int nr_layer_precoder(int16_t **datatx_F_precoding, + char *prec_matrix, + uint8_t n_layers, + int32_t re_offset); #endif diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 7b5ddb230acff349e168b413b62acc91ef2d96e7..39c730bfac3a5b8c973e9e9643e40acbaf61cee0 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -29,362 +29,230 @@ //#define DEBUG_FEP -#define SOFFSET 0 - /*#ifdef LOG_I #undef LOG_I #define LOG_I(A,B...) printf(A) #endif*/ -int nr_slot_fep(PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, - unsigned char symbol, - unsigned char Ns, - int sample_offset, - int no_prefix) +dft_size_idx_t get_dft_size_idx(uint16_t ofdm_symbol_size) { - NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - NR_UE_COMMON *common_vars = &ue->common_vars; - unsigned char aa; - unsigned int nb_prefix_samples; - unsigned int nb_prefix_samples0; - unsigned int abs_symbol; - if (ue->is_synchronized) { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); - } - else { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - } - //unsigned int subframe_offset;//,subframe_offset_F; - unsigned int slot_offset; - //int i; - unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10; - unsigned int rx_offset; - - - dft_size_idx_t dftsize; - int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs - - switch (frame_parms->ofdm_symbol_size) { + switch (ofdm_symbol_size) { case 128: - dftsize = DFT_128; - break; + return DFT_128; case 256: - dftsize = DFT_256; - break; + return DFT_256; case 512: - dftsize = DFT_512; - break; + return DFT_512; case 1024: - dftsize = DFT_1024; - break; + return DFT_1024; case 1536: - dftsize = DFT_1536; - break; + return DFT_1536; case 2048: - dftsize = DFT_2048; - break; + return DFT_2048; case 3072: - dftsize = DFT_3072; - break; + return DFT_3072; case 4096: - dftsize = DFT_4096; - break; + return DFT_4096; + + case 6144: + return DFT_6144; case 8192: - dftsize = DFT_8192; - break; + return DFT_8192; default: printf("unsupported ofdm symbol size \n"); assert(0); } - if (no_prefix) { - slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot) * (Ns); - } else { - slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); - } + return DFT_SIZE_IDXTABLESIZE; +} - /*if (l<0 || l>=7-frame_parms->Ncp) { - printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp); - return(-1); - }*/ +int nr_slot_fep(PHY_VARS_NR_UE *ue, + UE_nr_rxtx_proc_t *proc, + unsigned char symbol, + unsigned char Ns) +{ + NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + NR_UE_COMMON *common_vars = &ue->common_vars; - if (Ns<0 || Ns>(frame_parms->slots_per_frame-1)) { - printf("slot_fep: Ns must be between 0 and %d\n",frame_parms->slots_per_frame-1); - return(-1); + AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1); + AssertFatal(Ns < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame-1); + + unsigned int nb_prefix_samples; + unsigned int nb_prefix_samples0; + if (ue->is_synchronized) { + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples0; + } else { + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples; } - for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { - memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int)); + dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size); + // This is for misalignment issues + int32_t tmp_dft_in[8192] __attribute__ ((aligned (32))); - rx_offset = sample_offset + slot_offset - SOFFSET; - // Align with 256 bit - // rx_offset = rx_offset&0xfffffff8; + unsigned int rx_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); + unsigned int abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; + for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++) + rx_offset += (idx_symb%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; + rx_offset += frame_parms->ofdm_symbol_size * symbol; + + // use OFDM symbol from within 1/8th of the CP to avoid ISI + rx_offset -= nb_prefix_samples / 8; #ifdef DEBUG_FEP - // if (ue->frame <100) - /*LOG_I(PHY,*/printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n", - Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples); + // if (ue->frame <100) + printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u\n", + Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset); #endif - abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; - - for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb < abs_symbol; idx_symb++) - rx_offset += (idx_symb%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; - - rx_offset += frame_parms->ofdm_symbol_size * symbol; - - if (abs_symbol%(0x7<<frame_parms->numerology_index)) { - - rx_offset += nb_prefix_samples; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((short*) &common_vars->rxdata[aa][frame_length_samples], - (short*) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); - - if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][rx_offset % frame_length_samples], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly -#if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); -#endif + for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) { + memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); -#if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); -#endif - } - } else { + int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset]; + + // if input to dft is not 256-bit aligned + if ((rx_offset & 7) != 0) { + memcpy((void *)&tmp_dft_in[0], + (void *)&common_vars->rxdata[aa][rx_offset], + frame_parms->ofdm_symbol_size * sizeof(int32_t)); + + rxdata_ptr = (int16_t *)tmp_dft_in; + } - rx_offset += nb_prefix_samples0; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((void *) &common_vars->rxdata[aa][frame_length_samples], - (void *) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); #if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); + start_meas(&ue->rx_dft_stats); #endif - if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly - - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } + dft(dftsize, + rxdata_ptr, + (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + 1); + #if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); + stop_meas(&ue->rx_dft_stats); #endif - - } + int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; + int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol+symb_offset]; + ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; #ifdef DEBUG_FEP // if (ue->frame <100) - printf("slot_fep: symbol %d rx_offset %u\n", symbol, rx_offset); + printf("slot_fep: slot %d, symbol %d rx_offset %u, rotation symbol %d %d.%d\n", Ns,symbol, rx_offset, + symbol+symb_offset,((int16_t*)&rot2)[0],((int16_t*)&rot2)[1]); #endif - - int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; - int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset]; - ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; + rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], (int16_t*)&rot2, (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], frame_parms->ofdm_symbol_size, 15); - } - #ifdef DEBUG_FEP printf("slot_fep: done\n"); #endif - return(0); + + return 0; } int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, unsigned char symbol, unsigned char Ns, - int sample_offset, - int no_prefix) + int sample_offset) { NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; NR_UE_COMMON *common_vars = &ue->common_vars; - unsigned char aa; + + AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1); + AssertFatal(Ns < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame-1); + unsigned int nb_prefix_samples; unsigned int nb_prefix_samples0; - unsigned int abs_symbol; if (ue->is_synchronized) { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples0; } else { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples); + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples; } - //unsigned int subframe_offset;//,subframe_offset_F; - unsigned int slot_offset; - //int i; - unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10; - unsigned int rx_offset; - - - dft_size_idx_t dftsize; - int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs - - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsize = DFT_128; - break; - - case 256: - dftsize = DFT_256; - break; - - case 512: - dftsize = DFT_512; - break; + unsigned int frame_length_samples = frame_parms->samples_per_frame; - case 1024: - dftsize = DFT_1024; - break; + dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size); + // This is for misalignment issues + int32_t tmp_dft_in[8192] __attribute__ ((aligned (32))); - case 1536: - dftsize = DFT_1536; - break; - - case 2048: - dftsize = DFT_2048; - break; + unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); + unsigned int rx_offset = sample_offset + slot_offset; + unsigned int abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; + for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++) + rx_offset += (abs_symbol%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; + rx_offset += frame_parms->ofdm_symbol_size * symbol; - case 3072: - dftsize = DFT_3072; - break; +#ifdef DEBUG_FEP + // if (ue->frame <100) + printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n", + Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples); +#endif - case 4096: - dftsize = DFT_4096; - break; + for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) { + memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); - case 8192: - dftsize = DFT_8192; - break; + int16_t *rxdata_ptr; + rx_offset%=frame_length_samples*2; - default: - printf("unsupported ofdm symbol size \n"); - assert(0); - } - - if (no_prefix) { - slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot) * (Ns); - } else { - slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); - } + if (rx_offset+frame_parms->ofdm_symbol_size > frame_length_samples*2 ) { + // rxdata is 2 frames len + // we have to wrap on the end - /*if (l<0 || l>=7-frame_parms->Ncp) { - printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp); - return(-1); - }*/ + memcpy((void *)&tmp_dft_in[0], + (void *)&common_vars->rxdata[aa][rx_offset], + (frame_length_samples*2 - rx_offset) * sizeof(int32_t)); + memcpy((void *)&tmp_dft_in[frame_length_samples*2 - rx_offset], + (void *)&common_vars->rxdata[aa][0], + (frame_parms->ofdm_symbol_size - (frame_length_samples*2 - rx_offset)) * sizeof(int32_t)); + rxdata_ptr = (int16_t *)tmp_dft_in; - if (Ns<0 || Ns>(frame_parms->slots_per_frame-1)) { - printf("slot_fep: Ns must be between 0 and %d\n",frame_parms->slots_per_frame-1); - return(-1); - } + } else if ((rx_offset & 7) != 0) { - for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { - memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int)); + // if input to dft is not 256-bit aligned + memcpy((void *)&tmp_dft_in[0], + (void *)&common_vars->rxdata[aa][rx_offset], + frame_parms->ofdm_symbol_size * sizeof(int32_t)); + rxdata_ptr = (int16_t *)tmp_dft_in; - rx_offset = sample_offset + slot_offset - SOFFSET; - // Align with 256 bit - // rx_offset = rx_offset&0xfffffff8; - -#ifdef DEBUG_FEP - // if (ue->frame <100) - /*LOG_I(PHY,*/printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n", - Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples); -#endif + } else { - abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; - - for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb < abs_symbol; idx_symb++) - rx_offset += (abs_symbol%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; - - rx_offset += frame_parms->ofdm_symbol_size * symbol; - - if (abs_symbol%(0x7<<frame_parms->numerology_index)) { - - rx_offset += nb_prefix_samples; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((short*) &common_vars->rxdata[aa][frame_length_samples], - (short*) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); - - if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][rx_offset], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly -#if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); -#endif + // use dft input from RX buffer directly + rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset]; + } - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][rx_offset], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); #if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); + start_meas(&ue->rx_dft_stats); #endif - } - } else { - rx_offset += nb_prefix_samples0; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((void *) &common_vars->rxdata[aa][frame_length_samples], - (void *) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); -#if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); -#endif + dft(dftsize, + rxdata_ptr, + (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + 1); - if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][rx_offset], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][rx_offset], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } #if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); + stop_meas(&ue->rx_dft_stats); #endif - - } - int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; @@ -400,14 +268,13 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], frame_parms->ofdm_symbol_size, 15); - } - #ifdef DEBUG_FEP printf("slot_fep: done\n"); #endif - return(0); + + return 0; } @@ -416,89 +283,60 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, int32_t *rxdataF, unsigned char symbol, unsigned char Ns, - int sample_offset, - int no_prefix) + int sample_offset) { - int32_t slot_offset, rxdata_offset; - - unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); + unsigned int nb_prefix_samples = frame_parms->nb_prefix_samples; + unsigned int nb_prefix_samples0 = frame_parms->nb_prefix_samples0; - int tmp_dft_in[8192] __attribute__ ((aligned (32))); + dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size); + // This is for misalignment issues + int32_t tmp_dft_in[8192] __attribute__ ((aligned (32))); - dft_size_idx_t dftsize; + unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsize = DFT_128; - break; + // offset of first OFDM symbol + int32_t rxdata_offset = slot_offset + nb_prefix_samples0; + // offset of n-th OFDM symbol + rxdata_offset += symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples); + // use OFDM symbol from within 1/8th of the CP to avoid ISI + rxdata_offset -= nb_prefix_samples / 8; - case 256: - dftsize = DFT_256; - break; + int16_t *rxdata_ptr; - case 512: - dftsize = DFT_512; - break; + if(sample_offset > rxdata_offset) { - case 1024: - dftsize = DFT_1024; - break; + memcpy((void *)&tmp_dft_in[0], + (void *)&rxdata[frame_parms->samples_per_frame - sample_offset + rxdata_offset], + (sample_offset - rxdata_offset) * sizeof(int32_t)); + memcpy((void *)&tmp_dft_in[sample_offset - rxdata_offset], + (void *)&rxdata[0], + (frame_parms->ofdm_symbol_size - sample_offset + rxdata_offset) * sizeof(int32_t)); + rxdata_ptr = (int16_t *)tmp_dft_in; - case 1536: - dftsize = DFT_1536; - break; + } else if (((rxdata_offset - sample_offset) & 7) != 0) { - case 2048: - dftsize = DFT_2048; - break; + // if input to dft is not 256-bit aligned + memcpy((void *)&tmp_dft_in[0], + (void *)&rxdata[rxdata_offset - sample_offset], + (frame_parms->ofdm_symbol_size) * sizeof(int32_t)); + rxdata_ptr = (int16_t *)tmp_dft_in; - case 4096: - dftsize = DFT_4096; - break; + } else { - case 8192: - dftsize = DFT_8192; - break; + // use dft input from RX buffer directly + rxdata_ptr = (int16_t *)&rxdata[rxdata_offset - sample_offset]; - default: - dftsize = DFT_512; - break; } - - slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); - if(symbol == 0) - rxdata_offset = slot_offset + nb_prefix_samples0 - SOFFSET; - else - rxdata_offset = slot_offset + nb_prefix_samples0 + (symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples)) - SOFFSET; - - if(sample_offset>rxdata_offset) { - memcpy1((void *)tmp_dft_in, - (void *) &rxdata[frame_parms->samples_per_frame-sample_offset+rxdata_offset], - (sample_offset-rxdata_offset)*sizeof(int)); - - memcpy1((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); - memcpy((void *)tmp_dft_in, - (void *) &rxdata[rxdata_offset-sample_offset], - (frame_parms->ofdm_symbol_size)*sizeof(int)); - dft(dftsize,(int16_t *)&tmp_dft_in, - (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); - } + dft(dftsize, + rxdata_ptr, + (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], + 1); // clear DC carrier from OFDM symbols rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0; - return(0); + return 0; } void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index ec55eabf313378d49dc68a57d70c3e55e4dae520..116a943880f6444b01a4e7c838ef34810f4e9a98 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -20,12 +20,12 @@ */ /*! \file PHY/NR_ESTIMATION/nr_measurements_gNB.c -* \brief TA estimation for TA updates -* \author Ahmed Hussein +* \brief gNB measurement routines +* \author Ahmed Hussein, G. Casati, K. Saaifan * \date 2019 * \version 0.1 * \company Fraunhofer IIS -* \email: ahmed.hussein@iis.fraunhofer.de +* \email: ahmed.hussein@iis.fraunhofer.de, guido.casati@iis.fraunhofer.de, khodr.saaifan@iis.fraunhofer.de * \note * \warning */ @@ -35,24 +35,24 @@ #include "PHY/phy_extern.h" #include "nr_ul_estimation.h" +extern openair0_config_t openair0_cfg[MAX_CARDS]; + int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id) { - int temp, i, aa, max_pos = 0, max_val = 0; - short Re, Im; - uint8_t cyclic_shift = 0; + int i, aa, max_pos = 0, max_val = 0; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_gNB_PUSCH *gNB_pusch_vars = gNB->pusch_vars[UE_id]; int32_t **ul_ch_estimates_time = gNB_pusch_vars->ul_ch_estimates_time; - int sync_pos = (frame_parms->ofdm_symbol_size - cyclic_shift*frame_parms->ofdm_symbol_size/12) % (frame_parms->ofdm_symbol_size); + int sync_pos = frame_parms->nb_prefix_samples / 8; for (i = 0; i < frame_parms->ofdm_symbol_size; i++) { - temp = 0; + int temp = 0; for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { - Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)]; - Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)]; + short Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)]; + short Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)]; temp += (Re*Re/2) + (Im*Im/2); } @@ -70,36 +70,138 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id) } -void gNB_I0_measurements(PHY_VARS_gNB *gNB) { +void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) { + + + int min_I0=1000,max_I0=0; + int amin=0,amax=0; + for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) { + if (i==(gNB->frame_parms.N_RB_UL>>1) - 1) i+=2; + + if (gNB->measurements.n0_subband_power_tot_dB[i]<min_I0) {min_I0 = gNB->measurements.n0_subband_power_tot_dB[i]; amin=i;} + + if (gNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = gNB->measurements.n0_subband_power_tot_dB[i]; amax=i;} + } + + for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) { + fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB); + if (i%25 == 24) fprintf(fd,"\n"); + } + + fprintf(fd,"\nmax_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, gNB->measurements.n0_subband_power_avg_dB); + + fprintf(fd,"PRACH I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10); + + +} + + + +void gNB_I0_measurements(PHY_VARS_gNB *gNB,int first_symb,int num_symb) { NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_gNB_COMMON *common_vars = &gNB->common_vars; PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements; + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + double rx_gain = openair0_cfg[0].rx_gain[0]; + double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; uint32_t *rb_mask = gNB->rb_mask_ul; - int symbol = gNB->ulmask_symb; - int rb, offset, nb_rb; - uint32_t n0_power_tot, n0_subband_power_temp=0; + int rb, offset, offset0, nb_rb, len; + uint32_t n0_subband_power_temp = 0; int32_t *ul_ch; + int32_t n0_power_tot; + int64_t n0_power_tot2; + + nb_rb = 0; + n0_power_tot2=0; + for (rb=0; rb<frame_parms->N_RB_UL; rb++) { + n0_power_tot=0; + offset0 = (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; + if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe + nb_rb++; + for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + measurements->n0_subband_power[aarx][rb]=0; + for (int s=first_symb;s<(first_symb+num_symb);s++) { + + offset = offset0 + (s*frame_parms->ofdm_symbol_size); + ul_ch = &common_vars->rxdataF[aarx][offset]; + len = 12; + if (((frame_parms->N_RB_UL&1) == 1) && + (rb==(frame_parms->N_RB_UL>>1))) { + len=6; + } + AssertFatal(ul_ch, "RX signal buffer (freq) problem\n"); + measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len); + } // symbol + measurements->n0_subband_power[aarx][rb]/=num_symb; + measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]); + n0_power_tot += measurements->n0_subband_power[aarx][rb]; + } //antenna + n0_power_tot/=frame_parms->nb_antennas_rx; + n0_power_tot2 += n0_power_tot; + measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot); + measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - gNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL); + } + } //rb + + if (nb_rb>0) measurements->n0_subband_power_avg_dB = dB_fixed(n0_power_tot2/nb_rb); - if (symbol>-1) { - n0_power_tot = 0; - for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - nb_rb = 0; - for (rb=0; rb<frame_parms->N_RB_UL; rb++) { - if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe - nb_rb++; - offset = (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; - offset += (symbol*frame_parms->ofdm_symbol_size); - ul_ch = &common_vars->rxdataF[aarx][offset]; - //TODO what about DC? - n0_subband_power_temp += signal_energy_nodc(ul_ch,12); - } +} + + +// Scope: This function computes the UL SNR from the UL channel estimates +// +// Todo: +// - averaging IIR filter for RX power and noise +void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol){ + + int rx_power_tot[NUMBER_OF_NR_ULSCH_MAX]; + int rx_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_RX]; + unsigned short rx_power_avg_dB[NUMBER_OF_NR_ULSCH_MAX]; + unsigned short rx_power_tot_dB[NUMBER_OF_NR_ULSCH_MAX]; + + double rx_gain = openair0_cfg[0].rx_gain[0]; + double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; + PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + int ch_offset = fp->ofdm_symbol_size * symbol; + int N_RB_UL = gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu.rb_size; + + rx_power_tot[ulsch_id] = 0; + + for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){ + + rx_power[ulsch_id][aarx] = 0; + + for (int aatx = 0; aatx < fp->nb_antennas_tx; aatx++){ + + meas->rx_spatial_power[ulsch_id][aatx][aarx] = (signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB)); + + if (meas->rx_spatial_power[ulsch_id][aatx][aarx] < 0) { + meas->rx_spatial_power[ulsch_id][aatx][aarx] = 0; } - measurements->n0_power[aarx] = n0_subband_power_temp/nb_rb; - measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]); - n0_power_tot += measurements->n0_power[aarx]; + + meas->rx_spatial_power_dB[ulsch_id][aatx][aarx] = (unsigned short) dB_fixed(meas->rx_spatial_power[ulsch_id][aatx][aarx]); + rx_power[ulsch_id][aarx] += meas->rx_spatial_power[ulsch_id][aatx][aarx]; + } - measurements->n0_power_tot_dB = dB_fixed(n0_power_tot); + + rx_power_tot[ulsch_id] += rx_power[ulsch_id][aarx]; + } -} + rx_power_tot_dB[ulsch_id] = (unsigned short) dB_fixed(rx_power_tot[ulsch_id]); + rx_power_avg_dB[ulsch_id] = rx_power_tot_dB[ulsch_id]; + + meas->wideband_cqi_tot[ulsch_id] = dB_fixed2(rx_power_tot[ulsch_id], meas->n0_power_tot); + meas->rx_rssi_dBm[ulsch_id] = rx_power_avg_dB[ulsch_id] + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size); + + LOG_D(PHY, "[ULSCH %d] RSSI %d dBm/RE, RSSI (digital) %d dB (N_RB_UL %d), WBand CQI tot %d dB, N0 Power tot %d\n", + ulsch_id, + meas->rx_rssi_dBm[ulsch_id], + rx_power_avg_dB[ulsch_id], + N_RB_UL, + meas->wideband_cqi_tot[ulsch_id], + meas->n0_power_tot); + +} diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 10ac23bef0b769d870352ae8ba5d7b964a0df10c..5e1528c92252a6c932d27981f51e9484dadb8852 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -61,6 +61,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, debug_ch_est = fopen("debug_ch_est.txt","w"); #endif + //uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1]; + uint8_t nushift; int **ul_ch_estimates = gNB->pusch_vars[ul_id]->ul_ch_estimates; int **rxdataF = gNB->common_vars.rxdataF; @@ -73,12 +75,12 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, symbol_offset = gNB->frame_parms.ofdm_symbol_size*symbol; k = bwp_start_subcarrier; - int re_offset = k; + int re_offset; uint16_t nb_rb_pusch = pusch_pdu->rb_size; #ifdef DEBUG_CH - LOG_D(PHY, "In %s: ch_offset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n", + LOG_I(PHY, "In %s: ch_offset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n", __FUNCTION__, ch_offset, symbol_offset, @@ -128,7 +130,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, //------------------generate DMRS------------------// if (pusch_pdu->transform_precoding == transform_precoder_disabled) { - nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, pusch_pdu->rb_start*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type); + nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, (pusch_pdu->bwp_start + pusch_pdu->rb_start)*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type); } else { // if transform precoding or SC-FDMA is enabled in Uplink @@ -170,6 +172,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+nushift)]; ul_ch = (int16_t *)&ul_ch_estimates[aarx][ch_offset]; + re_offset = k; memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size)); diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h index a463e21839a70ba6515c8347cce3df5589047d39..7ecaa97f6ad475bf7276ec05f0d3d822f518b98a 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h @@ -47,10 +47,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, unsigned short bwp_start_subcarrier, nfapi_nr_pusch_pdu_t *pusch_pdu); -void gNB_I0_measurements(PHY_VARS_gNB *gNB); +void gNB_I0_measurements(PHY_VARS_gNB *gNB,int first_symb,int num_symb); -int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id); +void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol); +int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id); void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, NR_DL_FRAME_PARMS *frame_parms, diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index 03a37e2b279f63b8c658105db6dcab94e3c7d41b..2e270318f822301e822ffd358870c63961c60593 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -150,7 +150,7 @@ void pseudo_random_sequence_optimised(unsigned int size, uint32_t *c, uint32_t c unsigned int n,x1,x2; /* init of m-sequences */ - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2 = cinit; x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c index b0f9e6d03c55562555bfb1048b86e5c132758fa4..9ed2bd949f8b68c774d3f30536799b3f8a26e7b5 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -21,6 +21,18 @@ #include "nr_refsig.h" #include "nr_mod_table.h" +short nr_qpsk_mod_table[8]; + +int32_t nr_16qam_mod_table[16]; +#if defined(__SSE2__) +__m128i nr_qpsk_byte_mod_table[2048]; +#endif + +int64_t nr_16qam_byte_mod_table[1024]; + +int64_t nr_64qam_mod_table[4096]; + +int32_t nr_256qam_mod_table[512]; void nr_generate_modulation_table() { float sqrt2 = 0.70711; diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index eefa6270ab58d553a461b418c9758386ab6f6621..623b86edfbb5dde7a5d7c1b392da6f971e47d4be 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -52,22 +52,15 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) } void nr_gold_pdcch(PHY_VARS_NR_UE* ue, - unsigned short n_idDMRS, - unsigned short length_dmrs) + unsigned short nid) { unsigned char ns,l; unsigned int n,x1,x2,x2tmp0; - unsigned int nid; uint8_t reset; - if (n_idDMRS) - nid = n_idDMRS; - else - nid = ue->frame_parms.Nid_cell; - for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { - for (l=0; l<length_dmrs; l++) { + for (l=0; l<ue->frame_parms.symbols_per_slot; l++) { reset = 1; x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; @@ -82,11 +75,10 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, } void nr_gold_pdsch(PHY_VARS_NR_UE* ue, - unsigned char ns, unsigned short *n_idDMRS) { unsigned char l; - unsigned int n,x1,x2,x2tmp0; + unsigned int n,x1,x2,x2tmp0,ns; int nscid; unsigned int nid; uint8_t reset; @@ -95,23 +87,21 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, //unsigned short lbar = 0; for (nscid=0; nscid<2; nscid++) { - if (n_idDMRS) - nid = n_idDMRS[nscid]; - else - nid = ue->frame_parms.Nid_cell; + for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { - //printf("gold pdsch nid %d lbar %d\n",nid,lbar); + nid = n_idDMRS[nscid]; - for (l=0; l<ue->frame_parms.symbols_per_slot; l++) { + for (l=0; l<ue->frame_parms.symbols_per_slot; l++) { - reset = 1; - x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; - x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit - LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); + reset = 1; + x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; + x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit + LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); - for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { - ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset); - reset = 0; + for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { + ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset); + reset = 0; + } } } } diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index aa8b99f584b6d2554c1fbbd6563c1a64db5b9470..2c6964fe96e65d7d933e36ce05bf824408648a29 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -29,16 +29,16 @@ #define NR_MOD_TABLE_QAM64_OFFSET 23 #define NR_MOD_TABLE_QAM256_OFFSET 87 -short nr_qpsk_mod_table[8]; +extern short nr_qpsk_mod_table[8]; -int32_t nr_16qam_mod_table[16]; +extern int32_t nr_16qam_mod_table[16]; #if defined(__SSE2__) -__m128i nr_qpsk_byte_mod_table[2048]; +extern __m128i nr_qpsk_byte_mod_table[2048]; #endif -int64_t nr_16qam_byte_mod_table[1024]; +extern int64_t nr_16qam_byte_mod_table[1024]; -int64_t nr_64qam_mod_table[4096]; +extern int64_t nr_64qam_mod_table[4096]; -int32_t nr_256qam_mod_table[512]; +extern int32_t nr_256qam_mod_table[512]; #endif diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index 19b9736bcbeab0f10a5df838659df74ca911d939..b32d48a2e9f95e126e6dd3d77b2b8c9517a7fd76 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -120,8 +120,7 @@ EXTERN int64_t *pss_corr_ue[NUMBER_PSS_SEQUENCE] ; /* profiling structure */ -EXTERN double cpuf; -time_stats_t generic_time[TIME_LAST]; +EXTERN time_stats_t generic_time[TIME_LAST]; #ifndef DEFINE_HEADER_ONLY diff --git a/openair1/PHY/NR_REFSIG/refsig_defs_ue.h b/openair1/PHY/NR_REFSIG/refsig_defs_ue.h index 83b43c54a0820bb087caa088a58172cfd8433685..54279a8ad5faf85ace67cc4d4a477db15ce151af 100644 --- a/openair1/PHY/NR_REFSIG/refsig_defs_ue.h +++ b/openair1/PHY/NR_REFSIG/refsig_defs_ue.h @@ -57,11 +57,9 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, void nr_gold_pbch(PHY_VARS_NR_UE* ue); void nr_gold_pdcch(PHY_VARS_NR_UE* ue, - unsigned short n_idDMRS, - unsigned short length_dmrs); + unsigned short n_idDMRS); void nr_gold_pdsch(PHY_VARS_NR_UE* ue, - unsigned char ns, unsigned short *n_idDMRS); void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h index 44d30da8f30540cf3866984077ec92cf7f6aba18..43ec0c03dc65bd2eee15e5f4dbfe7c7933d7da41 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h @@ -58,7 +58,7 @@ #define INDEX_SB_LESS_32 (4) /* index of dftsizes array for which subcarrier number is less than 36 */ -const uint16_t ul_allocated_re[SRS_SB_CONF] /* number of uplink allocated resource elements */ +EXTERN const uint16_t ul_allocated_re[SRS_SB_CONF] /* number of uplink allocated resource elements */ /* this table is derivated from TS 38.211 Table 6.4.1.4.3-1: SRS bandwidth configuration which gives m_SRS_b then all possible values of sequence length is */ /* M_sc_b_SRS = m_SRS_b * N_SC_RB/K_TC with K_TC = 2 or K_TC = 4 as specified in TS 38.211 6.4.1.4.3 */ #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H @@ -82,7 +82,7 @@ m_SRS_b 224 116, 240 256 264 272 144 152 160 168 176 184 ; /* table of largest prime number lower than uplink allocated resource elements "ul_allocated_re" */ -const uint16_t ref_ul_primes[SRS_SB_CONF] +EXTERN const uint16_t ref_ul_primes[SRS_SB_CONF] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 6, 12, 18, 24, 30, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228, 240, */ @@ -101,10 +101,10 @@ const uint16_t ref_ul_primes[SRS_SB_CONF] ; /* Low-PAPR base sequence; see TS 38.211 clause 5.2.2 */ -int16_t *rv_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][SRS_SB_CONF]; +EXTERN int16_t *rv_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][SRS_SB_CONF]; /* 38.211 table Table 5.2.2.2-1: Definition of phi(n) for M_ZC = 6 */ -const char phi_M_ZC_6[6*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_6[6*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 */ @@ -142,7 +142,7 @@ const char phi_M_ZC_6[6*U_GROUP_NUMBER] #endif ; /* Table 5.2.2.2-2: Definition of phi ( n ) for M ZC = 12 */ -const char phi_M_ZC_12[12*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_12[12*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 */ @@ -181,7 +181,7 @@ const char phi_M_ZC_12[12*U_GROUP_NUMBER] ; /* Table 5.2.2.2-3: Definition of phi (n ) for M_ZC = 18 */ -const char phi_M_ZC_18[18*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_18[18*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 */ @@ -220,7 +220,7 @@ const char phi_M_ZC_18[18*U_GROUP_NUMBER] ; /* Table 5.2.2.2-4: Definition of phi (n ) for M_ZC = 24 */ -const char phi_M_ZC_24[24*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_24[24*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 */ @@ -260,10 +260,10 @@ const char phi_M_ZC_24[24*U_GROUP_NUMBER] /************** FUNCTION ******************************************/ -int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling, unsigned int if_dmrs_seq); +EXTERN int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling, unsigned int if_dmrs_seq); -int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling); +EXTERN int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling); /*! \brief This function generate the sounding reference symbol (SRS) for the uplink. @param tables of srs @@ -278,7 +278,7 @@ void free_ul_reference_signal_sequences(void); #define MAX_INDEX_DMRS_UL_ALLOCATED_REs 53 -const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +EXTERN const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] /* Number of possible DMRS REs based on PRBs allocated for PUSCH. Array has values until 273 RBs (100Mhz BW) Number of PUSCH RBs allocated should be able to be expressed as 2topowerofn*3topowerofn*5tothepowerofn According to 3GPP spec 38.211 section 6.3.1.4 @@ -307,7 +307,7 @@ const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] /* Table of largest prime number N_ZC < possible DMRS REs M_ZC, this array has values until 100Mhz According to 3GPP spec 38.211 section 5.2.2.1 Table used in calculating DMRS low papr type1 sequence for transform precoding */ -const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +EXTERN const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /*DMRS REs 6, 12, 18, 24, 30, 36, 48, 54, 60, 72, 90, 96, */ @@ -331,8 +331,8 @@ const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] ; /// PUSCH DMRS for transform precoding -int16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; -int16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +EXTERN int16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +EXTERN int16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; int16_t get_index_for_dmrs_lowpapr_seq(int16_t num_dmrs_res); void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling); void free_gnb_lowpapr_sequences(void); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 469415908f6d4b58b2eecf04d6c160a9953199ff..cf38aaa4bfb8170806eea6551b52575029b4fd7a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -30,7 +30,7 @@ * \warning */ -#include <LAYER2/NR_MAC_gNB/nr_mac_gNB.h> + #include "nr_dci.h" #include "nr_dlsch.h" #include "nr_sch_dmrs.h" @@ -85,10 +85,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, // compute rb_offset and n_prb based on frequency allocation nr_fill_cce_list(gNB,0,pdcch_pdu_rel15); get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); - cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; - if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; - } + cset_start_sc = frame_parms.first_carrier_offset + (pdcch_pdu_rel15->BWPStart + rb_offset) * NR_NB_SC_PER_RB; for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) { /*The coreset is initialised @@ -97,6 +94,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, * in time: by its first slot and its first symbol*/ const nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[d]; + LOG_D(PHY,"DCI pdu %d, rnti %x, aggregation %d CCE %d Scrambling_Id %x ScramblingRNTI %x PayloadSizeBits %d\n",d,dci_pdu->RNTI,dci_pdu->AggregationLevel,dci_pdu->CceIndex,dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits); cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex; cset_nsymb = pdcch_pdu_rel15->DurationSymbols; dci_idx = 0; @@ -228,6 +226,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, printf("PDCCH: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1], ((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]); #endif + dci_idx++; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c index 3814c782952a7d6dbe8ac2007fb039b2d360fb61..4775851a653563e9c6ca6cdf20e3e93692b4d6c0 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c @@ -256,10 +256,8 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, dlsch->rnti = pdcch_pdu_rel15->dci_pdu[i].RNTI; // nr_fill_cce_list(gNB,0); - /* - LOG_D(PHY, "DCI PDU: [0]->0x%lx \t [1]->0x%lx \n",dci_pdu[0], dci_pdu[1]); - LOG_D(PHY, "DCI type %d payload (size %d) generated on candidate %d\n", dci_alloc->pdcch_params.dci_format, dci_alloc->size, cand_idx); - */ + + } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 66fc987f6db298b8ecefc6a36c758ff52d5f975b..d06c4bbb1c00cfdea085534f090ab87b78789c15 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -82,11 +82,12 @@ void nr_pdsch_codeword_scrambling_optim(uint8_t *in, s=lte_gold_generic(&x1, &x2, 1); + #if defined(__AVX2__) for (int i=0; i<((size>>5)+((size&0x1f) > 0 ? 1 : 0)); i++) { in32=_mm256_movemask_epi8(_mm256_slli_epi16(((__m256i*)in)[i],7)); out[i]=(in32^s); - // printf("in[%d] %x => %x\n",i,in32,out[i]); + //printf("in[%d] %x => %x\n",i,in32,out[i]); s=lte_gold_generic(&x1, &x2, 0); } #elif defined(__SSE4__) @@ -141,6 +142,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; int16_t **mod_symbs = (int16_t**)dlsch->mod_symbs; int16_t **tx_layers = (int16_t**)dlsch->txdataF; + int16_t **txdataF_precoding = (int16_t**)dlsch->txdataF_precoding; int8_t Wf[2], Wt[2], l0, l_prime, l_overline, delta; uint8_t dmrs_Type = rel15->dmrsConfigType; int nb_re_dmrs; @@ -151,7 +153,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, else { nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData; } - n_dmrs = (rel15->rbSize+rel15->rbStart)*nb_re_dmrs; + n_dmrs = (rel15->BWPStart+rel15->rbStart+rel15->rbSize)*nb_re_dmrs; uint16_t dmrs_symbol_map = rel15->dlDmrsSymbPos;//single DMRS: 010000100 Double DMRS 110001100 uint8_t dmrs_len = get_num_dmrs(rel15->dlDmrsSymbPos); @@ -160,6 +162,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint32_t encoded_length = nb_re*Qm; int16_t mod_dmrs[14][n_dmrs<<1] __attribute__ ((aligned(16))); + /* PTRS */ uint16_t beta_ptrs = 1; uint8_t ptrs_symbol = 0; @@ -264,10 +267,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, } #endif - /// Antenna port mapping - //to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007 - /// DMRS QPSK modulation + // TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { if (rel15->dlDmrsSymbPos & (1 << l)) { nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated @@ -290,7 +291,9 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; - + + int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP; + #ifdef DEBUG_DLSCH_MAPPING printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %d,nb_layers %d)\n", start_sc, rel15->StartSymbolIndex, rel15->rbSize, nb_re,rel15->nrOfLayers); @@ -311,20 +314,31 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, 1+dmrs_Type,ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol); #endif - uint16_t m=0, dmrs_idx=0, k=0; - - int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP; + uint16_t m=0, dmrs_idx=0; // Loop Over OFDM symbols: for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { /// DMRS QPSK modulation uint8_t k_prime=0; uint16_t n=0; - if ((dmrs_symbol_map & (1 << l))){ //DMRS time occasion - if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) // another if condition to be included to check pdsch config type (reference of k) - dmrs_idx = rel15->rbStart*6; - else - dmrs_idx = rel15->rbStart*4; + + if ((dmrs_symbol_map & (1 << l))){ // DMRS time occasion + // The reference point for is subcarrier 0 of the lowest-numbered resource block in CORESET 0 if the corresponding + // PDCCH is associated with CORESET 0 and Type0-PDCCH common search space and is addressed to SI-RNTI + // 3GPP TS 38.211 V15.8.0 Section 7.4.1.1.2 Mapping to physical resources + if (rel15->rnti==SI_RNTI) { + if (dmrs_Type==NFAPI_NR_DMRS_TYPE1) { + dmrs_idx = rel15->rbStart*6; + } else { + dmrs_idx = rel15->rbStart*4; + } + } else { + if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) { + dmrs_idx = (rel15->rbStart+rel15->BWPStart)*6; + } else { + dmrs_idx = (rel15->rbStart+rel15->BWPStart)*4; + } + } } // Update l_prime in the case of double DMRS config @@ -347,7 +361,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, nr_modulation(pdsch_dmrs[l][0], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs); } } - k = start_sc; + uint16_t k = start_sc; // Loop Over SCs: for (int i=0; i<rel15->rbSize*NR_NB_SC_PER_RB; i++) { /* check if cuurent RE is PTRS RE*/ @@ -367,12 +381,12 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, /* Map DMRS Symbol */ if ( ( dmrs_symbol_map & (1 << l) ) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) { - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][dmrs_idx<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", - dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); + dmrs_idx, l, k, k_prime, n, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); #endif dmrs_idx++; k_prime++; @@ -381,8 +395,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, } /* Map PTRS Symbol */ else if(is_ptrs_re){ - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; #ifdef DEBUG_DLSCH_MAPPING printf("ptrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], @@ -391,17 +405,20 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ptrs_idx++; } /* Map DATA Symbol */ - else { - if( (!(dmrs_symbol_map & (1 << l))) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,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; + else if( (!(dmrs_symbol_map & (1 << l))) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; + txdataF_precoding[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 - printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); + printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", + m, l, k, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); #endif - m++; - } + m++; + } + /* mute RE */ + else { + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = 0; } if (++k >= frame_parms->ofdm_symbol_size) k -= frame_parms->ofdm_symbol_size; @@ -409,9 +426,108 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, } // symbol loop }// layer loop + ///Layer Precoding and Antenna port mapping + // tx_layers 1-8 are mapped on antenna ports 1000-1007 + // The precoding info is supported by nfapi such as num_prgs, prg_size, prgs_list and pm_idx + // The same precoding matrix is applied on prg_size RBs, Thus + // pmi = prgs_list[rbidx/prg_size].pm_idx, rbidx =0,...,rbSize-1 + // The Precoding matrix: + // The Codebook Type I and Type II are not supported yet. + // We adopt the precoding matrices of PUSCH for 4 layers. + for (int ap=0; ap<frame_parms->nb_antennas_tx; ap++) { + + for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { + uint16_t k = start_sc; + + for (int rb=0; rb<rel15->rbSize; rb++) { + //get pmi info + uint8_t pmi; + if (rel15->precodingAndBeamforming.prg_size > 0) + pmi = rel15->precodingAndBeamforming.prgs_list[(int)rb/rel15->precodingAndBeamforming.prg_size].pm_idx; + else + pmi = 0;//no precoding + + if (pmi == 0) {//unitary Precoding + if(ap<rel15->nrOfLayers) + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + txdataF_offset+ k)], + NR_NB_SC_PER_RB*sizeof(int32_t)); + else + memset((void*)&txdataF[ap][rel15->StartSymbolIndex*frame_parms->ofdm_symbol_size + txdataF_offset +k], + 0, + NR_NB_SC_PER_RB*sizeof(int32_t)); + k += NR_NB_SC_PER_RB; + if (k >= frame_parms->ofdm_symbol_size) { + k -= frame_parms->ofdm_symbol_size; + } + } + else { + //get the precoding matrix weights: + char *W_prec; + switch (frame_parms->nb_antennas_tx) { + case 1://1 antenna port + W_prec = nr_W_1l_2p[pmi][ap]; + break; + case 2://2 antenna ports + if (rel15->nrOfLayers == 1)//1 layer + W_prec = nr_W_1l_2p[pmi][ap]; + else//2 layers + W_prec = nr_W_2l_2p[pmi][ap]; + break; + case 4://4 antenna ports + if (rel15->nrOfLayers == 1)//1 layer + W_prec = nr_W_1l_4p[pmi][ap]; + else if (rel15->nrOfLayers == 2)//2 layers + W_prec = nr_W_2l_4p[pmi][ap]; + else if (rel15->nrOfLayers == 3)//3 layers + W_prec = nr_W_3l_4p[pmi][ap]; + else//4 layers + W_prec = nr_W_4l_4p[pmi][ap]; + break; + default: + LOG_D(PHY,"Precoding 1,2, or 4 antenna ports are currently supported\n"); + W_prec = nr_W_1l_2p[pmi][ap]; + break; + } + for (int i=0; i<NR_NB_SC_PER_RB; i++) { + int32_t re_offset = l*frame_parms->ofdm_symbol_size + k; + int32_t precodatatx_F = nr_layer_precoder(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset+txdataF_offset); + ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[0]; + ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[1]; +#ifdef DEBUG_DLSCH_MAPPING + printf("antenna %d\t l %d \t k %d \t txdataF: %d %d\n", + ap, l, k, ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)], + ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)]); +#endif + if (++k >= frame_parms->ofdm_symbol_size) { + k -= frame_parms->ofdm_symbol_size; + } + } + } + } //RB loop + } // symbol loop + }// port loop dlsch->slot_tx[slot]=0; + + // TODO: handle precoding + // this maps the layers onto antenna ports + + // handle beamforming ID + // each antenna port is assigned a beam_index + // since PHY can only handle BF on slot basis we set the whole slot + + // first check if this slot has not already been allocated to another beam + if (gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot]==255) { + for (int j=0;j<frame_parms->symbols_per_slot;j++) + gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot+j] = rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx; + } + else { + LOG_D(PHY,"beam index for PDSCH allocation already taken\n"); + } }// dlsch loop + + return 0; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index e6544bbe0c2a0115028d2fe1a9011cafd328dd74..2ae914ce53ec64069dd5ecc6d5e079aef27c824f 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -61,10 +61,8 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) if (N_RB != 273) { a_segments = a_segments*N_RB; a_segments = a_segments/273 +1; - } - - - + } + #ifdef DEBUG_DLSCH_FREE LOG_D(PHY,"Freeing dlsch %p\n",dlsch); #endif @@ -110,8 +108,6 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) harq->d[r] = NULL; } } - free16(harq, sizeof(NR_DL_gNB_HARQ_t)); - harq = NULL; } } @@ -133,7 +129,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, if (N_RB != 273) { a_segments = a_segments*N_RB; a_segments = a_segments/273 +1; - } + } uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment @@ -145,31 +141,30 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, dlsch->Mdlharq = Mdlharq; dlsch->Mlimit = 4; dlsch->Nsoft = Nsoft; - + for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) { - dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64 * sizeof(int32_t *)); + dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(64*sizeof(int32_t*)); - for (aa = 0; aa < 64; aa++) { - dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t)); - for (re = 0; re < OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { + for (aa=0; aa<64; aa++) { + dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; } } - dlsch->txdataF[layer] = - (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH / NR_MAX_NB_LAYERS) - * sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH + dlsch->txdataF[layer] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH/NR_MAX_NB_LAYERS)*sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH + dlsch->txdataF_precoding[layer] = (int32_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int32_t)); } - for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++) - dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH * sizeof(int32_t)); + for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) + dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t)); - dlsch->calib_dl_ch_estimates = (int32_t **)malloc16(64 * sizeof(int32_t *)); - for (aa = 0; aa < 64; aa++) { - dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t)); + dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(64*sizeof(int32_t*)); + for (aa=0; aa<64; aa++) { + dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); } - for (i = 0; i < 20; i++) { + for (i=0; i<20; i++) { dlsch->harq_ids[0][i] = 0; dlsch->harq_ids[1][i] = 0; } @@ -268,7 +263,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, float Coderate = 0.0; uint8_t Nl = 4; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN); A = rel15->TBSize[0]<<3; @@ -294,7 +288,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, } G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers); - LOG_D(PHY,"dlsch coding A %d G %d mod_order %d\n", A,G, mod_order); + LOG_D(PHY,"dlsch coding A %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d mod_order %d)\n", A,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,mod_order); if (A > 3824) { // Add 24-bit crc (polynomial A) to payload @@ -304,7 +298,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, a[2+(A>>3)] = ((uint8_t*)&crc)[0]; //printf("CRC %x (A %d)\n",crc,A); //printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]); - + harq->B = A+24; // harq->b = a; @@ -323,7 +317,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, a[1+(A>>3)] = ((uint8_t*)&crc)[0]; //printf("CRC %x (A %d)\n",crc,A); //printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]); - + harq->B = A+16; // harq->b = a; @@ -339,17 +333,17 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, Coderate = (float) R /(float) 1024; else // to scale for mcs 20 and 26 in table 5.1.3.1-2 which are decimal and input 2* in nr_tbs_tools Coderate = (float) R /(float) 2048; - + if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25) harq->BG = 2; else harq->BG = 1; - + start_meas(dlsch_segmentation_stats); Kb = nr_segmentation(harq->b, harq->c, harq->B, &harq->C, &harq->K, Zc, &harq->F, harq->BG); stop_meas(dlsch_segmentation_stats); F = harq->F; - + Kr = harq->K; #ifdef DEBUG_DLSCH_CODING uint16_t Kr_bytes; @@ -357,7 +351,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, #endif //printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,harq->K,Kr,BG,harq->C); - + for (r=0; r<harq->C; r++) { //d_tmp[r] = &harq->d[r][0]; //channel_input[r] = &harq->d[r][0]; @@ -369,7 +363,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, LOG_D(PHY,"%d ", harq->c[r][cnt]); } LOG_D(PHY,"\n"); - + #endif //ldpc_encoder_orig((unsigned char*)harq->c[r],harq->d[r],*Zc,Kb,Kr,BG,0); //ldpc_encoder_optim((unsigned char*)harq->c[r],(unsigned char*)&harq->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL); @@ -380,23 +374,22 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, impp.tinput = tinput; impp.tparity = tparity; impp.toutput = toutput; - + for(int j=0;j<(harq->C/8+1);j++) { impp.macro_num=j; nrLDPC_encoder(harq->c,harq->d,*Zc,Kb,Kr,harq->BG,&impp); } - #ifdef DEBUG_DLSCH_CODING write_output("enc_input0.m","enc_in0",&harq->c[0][0],Kr_bytes,1,4); write_output("enc_output0.m","enc0",&harq->d[0][0],(3*8*Kr_bytes)+12,1,4); #endif - + F = harq->F; - + Kr = harq->K; for (r=0; r<harq->C; r++) { - + if (F>0) { for (int k=(Kr-F-2*(*Zc)); k<Kr-2*(*Zc); k++) { // writing into positions d[r][k-2Zc] as in clause 5.3.2 step 2) in 38.212 @@ -405,15 +398,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, //printf("r %d filler bits [%d] = %d \n", r,k, harq->d[r][k]); } } - - - + #ifdef DEBUG_DLSCH_CODING LOG_D(PHY,"rvidx in encoding = %d\n", rel15->rvIndex[0]); #endif - + E = nr_get_E(G, harq->C, mod_order, rel15->nrOfLayers, r); - + //#ifdef DEBUG_DLSCH_CODING LOG_D(PHY,"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d)...\n", r, @@ -423,13 +414,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, F, Kr-F-2*(*Zc), mod_order,nb_rb); - + // for tbslbrm calculation according to 5.4.2.1 of 38.212 if (rel15->nrOfLayers < Nl) Nl = rel15->nrOfLayers; - + Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl); - + start_meas(dlsch_rate_matching_stats); nr_rate_matching_ldpc(Ilbrm, Tbslbrm, diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index bd1278b2eb192e82bba8f817e17716effaed7101..0bc04e30473db8f0350f9a89dcfda4fb0059cc97 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -241,7 +241,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ///Payload generation memset((void *)pbch, 0, sizeof(NR_gNB_PBCH)); pbch->pbch_a=0; - uint8_t ssb_index = frame_parms->ssb_index; + uint8_t ssb_index = ssb_pdu->ssb_pdu_rel15.SsbBlockIndex; uint8_t *pbch_pdu = (uint8_t*)&ssb_pdu->ssb_pdu_rel15.bchPayload; uint8_t Lmax = frame_parms->Lmax; for (int i=0; i<NR_PBCH_PDU_BITS; i++) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index b5a3c061e9f4abbacd35d07186819a59209e106d..34c647810d7ef73712ee08c53374158ea9d90cae 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -301,205 +301,300 @@ void rx_nr_prach_ru(RU_t *ru, // do DFT if (mu==1) { - if (fp->N_RB_UL <= 100) - AssertFatal(1==0,"N_RB_UL %d not support for NR PRACH yet\n",fp->N_RB_UL); - else if (fp->N_RB_UL < 137) { - if (fp->threequarter_fs==0) { - //40 MHz @ 61.44 Ms/s - //50 MHz @ 61.44 Ms/s - prach2 = prach[aa] + (Ncp<<2); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 to bring to 61.44 Ms/s - if (prach_sequence_length == 0) { - if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=49152; - dft(DFT_49152,prach2,rxsigF[aa],1); + switch(fp->samples_per_subframe) { + case 15360: + // 10, 15 MHz @ 15.36 Ms/s + prach2 = prach[aa] + (1*Ncp); // Ncp is for 30.72 Ms/s, so divide by 2 to bring to 15.36 Ms/s and multiply by 2 for I/Q + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=12288; + dft(DFT_12288,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_12288,prach2+24576,rxsigF[aa]+24576,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_12288,prach2+(24576*2),rxsigF[aa]+(24576*2),1); + dft(DFT_12288,prach2+(24576*3),rxsigF[aa]+(24576*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=3072; + for (int i=0;i<4;i++) dft(DFT_3072,prach2+(i*3072*2),rxsigF[aa]+(i*3072*2),1); + reps=4; + } + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=16; // 8 samples @ 15.36 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=512; + dft(DFT_512,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_512,prach2+1024,rxsigF[aa]+1024,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_512,prach2+1024*2,rxsigF[aa]+1024*2,1); + dft(DFT_512,prach2+1024*3,rxsigF[aa]+1024*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_512,prach2+1024*4,rxsigF[aa]+1024*4,1); + dft(DFT_512,prach2+1024*5,rxsigF[aa]+1024*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_512,prach2+(1024*i),rxsigF[aa]+(1024*i),1); + reps+=6; + } } - if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_49152,prach2+98304,rxsigF[aa]+98304,1); - reps++; - } - if (prachFormat == 2) { - dft(DFT_49152,prach2+(98304*2),rxsigF[aa]+(98304*2),1); - dft(DFT_49152,prach2+(98304*3),rxsigF[aa]+(98304*3),1); - reps+=2; - } - 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; - } - }// 839 sequence - else { - if (prachStartSymbol == 0) - prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) - - dftlen=2048; - dft(DFT_2048,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); - reps++; - } - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - 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 == 6/*A3*/ || prachFormat == 8/*B4*/) { - 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 == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1); - reps+=6; - } - } - } else { // threequarter sampling - // 40 MHz @ 46.08 Ms/s - prach2 = prach[aa] + (3*Ncp); // 46.08 is 1.5 * 30.72, times 2 for I/Q - 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); - reps++; - } - if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_36864,prach2+73728,rxsigF[aa]+73728,1); - reps++; - } - if (prachFormat == 2) { - dft(DFT_36864,prach2+(73728*2),rxsigF[aa]+(73728*2),1); - dft(DFT_36864,prach2+(73728*3),rxsigF[aa]+(73728*3),1); - reps+=2; - } - if (prachFormat == 3) { - dftlen=9216; - for (int i=0;i<4;i++) dft(DFT_9216,prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1); - reps=4; - } - } else { - if (prachStartSymbol == 0) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only) - dftlen=1536; - dft(DFT_1536,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1); - dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1); - dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); - reps+=6; - } - } // short format - } // 3/4 sampling - } // <=50 MHz BW - else if (fp->N_RB_UL <= 273) { - if (fp->threequarter_fs==0) { - prach2 = prach[aa] + (Ncp<<3); - //80,90,100 MHz @ 122.88 Ms/s - - if (prach_sequence_length == 0) { - if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=98304; - dft(DFT_98304,prach2,rxsigF[aa],1); + break; + + case 30720: + // 20, 25, 30 MHz @ 30.72 Ms/s + prach2 = prach[aa] + (2*Ncp); // Ncp is for 30.72 Ms/s, so just multiply by 2 for I/Q + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=24576; + dft(DFT_24576,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_24576,prach2+49152,rxsigF[aa]+49152,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_24576,prach2+(49152*2),rxsigF[aa]+(49152*2),1); + dft(DFT_24576,prach2+(49152*3),rxsigF[aa]+(49152*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=6144; + for (int i=0;i<4;i++) dft(DFT_6144,prach2+(i*6144*2),rxsigF[aa]+(i*6144*2),1); + reps=4; + } + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=32; // 16 samples @ 30.72 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=1024; + dft(DFT_1024,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_1024,prach2+2048,rxsigF[aa]+2048,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_1024,prach2+2048*2,rxsigF[aa]+2048*2,1); + dft(DFT_1024,prach2+2048*3,rxsigF[aa]+2048*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_1024,prach2+2048*4,rxsigF[aa]+2048*4,1); + dft(DFT_1024,prach2+2048*5,rxsigF[aa]+2048*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_1024,prach2+(2048*i),rxsigF[aa]+(2048*i),1); + reps+=6; + } } - 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*3),rxsigF[aa]+(196608*3),1); - reps+=2; - } - if (prachFormat == 3) { - dftlen=24576; - for (int i=0;i<4;i++) dft(DFT_24576,prach2+(i*2*24576),rxsigF[aa]+(i*2*24576),1); - reps=4; - } - } - else { - if (prachStartSymbol == 0) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) - - dftlen=4096; - dft(DFT_4096,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - 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 == 6/*A3*/ || prachFormat == 8/*B4*/) { - 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 == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1); - reps+=6; - } - } - } else { - AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n"); - prach2 = prach[aa] + (6*Ncp); - // 80 MHz @ 92.16 Ms/s - if (prach_sequence_length == 0) { - if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=73728; - dft(DFT_73728,prach2,rxsigF[aa],1); - reps++; - } - if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_73728,prach2+(2*73728),rxsigF[aa]+(2*73728),1); - reps++; - } - if (prachFormat == 3) { - dftlen=18432; - for (int i=0;i<4;i++) dft(DFT_18432,prach2+(i*2*18432),rxsigF[aa]+(i*2*18432),1); - reps=4; - } - } else { - if (prachStartSymbol == 0) prach2+=96; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) - - dftlen=3072; - dft(DFT_3072,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - 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 == 6/*A3*/ || prachFormat == 8/*B4*/) { - 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 == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1); - reps+=6; - } - } + break; + + case 61440: + // 40, 50, 60 MHz @ 61.44 Ms/s + prach2 = prach[aa] + (4*Ncp); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 to bring to 61.44 Ms/s + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=49152; + dft(DFT_49152,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_49152,prach2+98304,rxsigF[aa]+98304,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_49152,prach2+(98304*2),rxsigF[aa]+(98304*2),1); + dft(DFT_49152,prach2+(98304*3),rxsigF[aa]+(98304*3),1); + reps+=2; + } + 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; + } + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=2048; + dft(DFT_2048,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + 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 == 6/*A3*/ || prachFormat == 8/*B4*/) { + 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 == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1); + reps+=6; + } + } + break; + + case 46080: + // 40 MHz @ 46.08 Ms/s + prach2 = prach[aa] + (3*Ncp); // 46.08 is 1.5 * 30.72, times 2 for I/Q + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=36864; + dft(DFT_36864,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_36864,prach2+73728,rxsigF[aa]+73728,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_36864,prach2+(73728*2),rxsigF[aa]+(73728*2),1); + dft(DFT_36864,prach2+(73728*3),rxsigF[aa]+(73728*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=9216; + for (int i=0;i<4;i++) dft(DFT_9216,prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1); + reps=4; + } + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=1536; + dft(DFT_1536,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1); + dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1); + dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); + reps+=6; + } + } + break; + + case 122880: + // 70, 80, 90, 100 MHz @ 122.88 Ms/s + prach2 = prach[aa] + (8*Ncp); + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + 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*3),rxsigF[aa]+(196608*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=24576; + for (int i=0;i<4;i++) dft(DFT_24576,prach2+(i*2*24576),rxsigF[aa]+(i*2*24576),1); + reps=4; + } + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=4096; + dft(DFT_4096,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1); + reps++; + } + + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + 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 == 6/*A3*/ || prachFormat == 8/*B4*/) { + 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 == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1); + reps+=6; + } + } + break; + + case 92160: + // 80, 90 MHz @ 92.16 Ms/s + prach2 = prach[aa] + (6*Ncp); + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=73728; + dft(DFT_73728,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_73728,prach2+147456,rxsigF[aa]+147456,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_73728,prach2+(147456*2),rxsigF[aa]+(147456*2),1); + dft(DFT_73728,prach2+(147456*3),rxsigF[aa]+(147456*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=18432; + for (int i=0;i<4;i++) dft(DFT_18432,prach2+(i*2*18432),rxsigF[aa]+(i*2*18432),1); + reps=4; + } + } else { + if (prachStartSymbol == 0) prach2+=96; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=3072; + dft(DFT_3072,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); + reps++; + } + + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + 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 == 6/*A3*/ || prachFormat == 8/*B4*/) { + 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 == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1); + reps+=6; + } + } + break; + default: + AssertFatal(1==0,"sample_rate %f MHz not support for NR PRACH yet\n", fp->samples_per_subframe / 1000.0); } } - } else if (mu==3) { if (fp->threequarter_fs) { AssertFatal(1==0,"3/4 sampling not supported for numerology %d\n",mu); @@ -679,13 +774,13 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, else { preamble_shift -= NCS; - + if (preamble_shift < 0) preamble_shift+=N_ZC; } } else { // This is the high-speed case new_dft = 0; - + nr_fill_du(N_ZC,prach_root_sequence_map); // set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this // preamble index and find the corresponding cyclic shift // Check if all shifts for that root have been processed @@ -693,7 +788,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, not_found = 1; new_dft = 1; preamble_index0 -= numshift; - (preamble_offset==0 && numshift==0) ? (preamble_offset) : (preamble_offset++); + //(preamble_offset==0 && numshift==0) ? (preamble_offset) : (preamble_offset++); while (not_found == 1) { // current root depending on rootSequenceIndex diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h index be3ba0098928ffab053e0206fa92fbe32a2a272c..02e594e76a3509ab2488f9639434d2c760d71791 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h @@ -73,6 +73,8 @@ void compute_nr_prach_seq(uint8_t short_sequence, uint8_t rootSequenceIndex, uint32_t X_u[64][839]); +void nr_fill_du(uint16_t N_ZC,uint16_t *prach_root_sequence_map); + void init_nr_prach_tables(int N_ZC); /**@}*/ diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index e5e81109e492d005bf0a4709dfa3fcf66d0d5918..5e6011c43774dfb866219530a7a441563b56c2fc 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -357,6 +357,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, nfapi_nr_pucch_pdu_t* pucch_pdu); void nr_decode_pucch0(PHY_VARS_gNB *gNB, + int frame, int slot, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index 0040f015445ac40edec1723fac14353dfac93abc..f23c4e530f103431b3389c2d40a64423a84d4ff2 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -137,12 +137,26 @@ void nr_ulsch_unscrambling_optim(int16_t* llr, #endif } -void dump_pusch_stats(PHY_VARS_gNB *gNB) { +#define STATSTRLEN 16384 +void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) { - for (int i=0;i<NUMBER_OF_NR_ULSCH_MAX;i++) - if (gNB->ulsch_stats[i].rnti>0) - LOG_I(PHY,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n", - gNB->ulsch_stats[i].rnti, + char output[16384]; + int stroff=0; + + for (int i=0;i<NUMBER_OF_NR_ULSCH_MAX;i++) { + if (gNB->ulsch_stats[i].rnti>0) { + for (int aa=0;aa<gNB->frame_parms.nb_antennas_rx;aa++) + if (aa==0) stroff+=sprintf(output+stroff,"ULSCH RNTI %4x: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d\n", + gNB->ulsch_stats[i].rnti, + aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10, + aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10); + else stroff+=sprintf(output+stroff," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n", + aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10); + + AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n"); + + + stroff+=sprintf(output+stroff," round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n", gNB->ulsch_stats[i].round_trials[0], (double)gNB->ulsch_stats[i].round_trials[1]/gNB->ulsch_stats[i].round_trials[0], gNB->ulsch_stats[i].round_trials[1], @@ -150,11 +164,14 @@ void dump_pusch_stats(PHY_VARS_gNB *gNB) { gNB->ulsch_stats[i].round_trials[2], (double)gNB->ulsch_stats[i].round_trials[3]/gNB->ulsch_stats[i].round_trials[0], gNB->ulsch_stats[i].round_trials[3], + gNB->ulsch_stats[i].DTX, gNB->ulsch_stats[i].current_Qm, gNB->ulsch_stats[i].current_RI, gNB->ulsch_stats[i].total_bytes_rx, gNB->ulsch_stats[i].total_bytes_tx); - + } + } + fprintf(fd,"%s",output); } void clear_pusch_stats(PHY_VARS_gNB *gNB) { @@ -162,3 +179,20 @@ void clear_pusch_stats(PHY_VARS_gNB *gNB) { for (int i=0;i<NUMBER_OF_NR_ULSCH_MAX;i++) memset((void*)&gNB->ulsch_stats[i],0,sizeof(gNB->ulsch_stats[i])); } + +NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch) { + NR_gNB_SCH_STATS_t *stats=NULL; + int first_free=-1; + for (int i=0;i<NUMBER_OF_NR_SCH_STATS_MAX;i++) { + if (gNB->ulsch_stats[i].rnti == 0 && first_free == -1) { + first_free = i; + stats=&gNB->ulsch_stats[i]; + } + if (gNB->ulsch_stats[i].rnti == ulsch->rnti) { + stats=&gNB->ulsch_stats[i]; + break; + } + } + return(stats); +} + diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h index de9b5f48c3bd7d62ad86b9ecff770d19a05b6f79..2ca8e24af1315c05230c7c2df20cb90c0b9b3474 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h @@ -89,6 +89,8 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, uint8_t harq_pid); int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); -void dump_pusch_stats(PHY_VARS_gNB *gNB); +void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB); void clear_pusch_stats(PHY_VARS_gNB *gNB); + +NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index d990176d79d03847f5d729068cd0a917dbe2eb32..3aad4980bc813e05e3f350cf76a26e517382e963 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -320,7 +320,7 @@ void nr_processULSegment(void* arg) { Kr_bytes = Kr>>3; K_bits_F = Kr-ulsch_harq->F; - t_nrLDPC_time_stats procTime; + t_nrLDPC_time_stats procTime = {0}; t_nrLDPC_time_stats* p_procTime = &procTime ; //start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); @@ -449,7 +449,7 @@ void nr_processULSegment(void* arg) { } uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, - uint8_t UE_id, + uint8_t ULSCH_id, short *ulsch_llr, NR_DL_FRAME_PARMS *frame_parms, nfapi_nr_pusch_pdu_t *pusch_pdu, @@ -471,7 +471,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, #endif - NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[UE_id][0]; + NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id][0]; + NR_gNB_PUSCH *pusch = phy_vars_gNB->pusch_vars[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; if (!harq_process) { @@ -557,9 +558,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, if (stats) { stats->rnti = ulsch->rnti; stats->round_trials[harq_process->round]++; - } - if (harq_process->round == 0) { - if (stats) { + for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) { + stats->power[aarx]=dB_fixed_x10(pusch->ulsch_power[aarx]); + stats->noise_power[aarx]=dB_fixed_x10(pusch->ulsch_noise_power[aarx]); + } + if (harq_process->round == 0) { stats->current_Qm = Qm; stats->current_RI = n_layers; stats->total_bytes_tx += harq_process->TBS; @@ -639,7 +642,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, rdata->Tbslbrm = Tbslbrm; rdata->offset = offset; rdata->ulsch = ulsch; - rdata->ulsch_id = UE_id; + rdata->ulsch_id = ULSCH_id; pushTpool(phy_vars_gNB->threadPool,req); phy_vars_gNB->nbDecode++; LOG_D(PHY,"Added a block to decode, in pipe: %d\n",phy_vars_gNB->nbDecode); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 42d6cfad7a3e7ac19c3128fe86317628bc46269c..032b27703090b7fa7012fef01ce03954cfcd70e4 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -326,7 +326,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, #endif uint8_t is_dmrs_re; - start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start * NR_NB_SC_PER_RB))%frame_parms->ofdm_symbol_size; + start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start + pusch_pdu->bwp_start) * NR_NB_SC_PER_RB)%frame_parms->ofdm_symbol_size; nb_re_pusch = NR_NB_SC_PER_RB * pusch_pdu->rb_size; #ifdef __AVX2__ int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7); @@ -345,6 +345,9 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, n = 0; k_prime = 0; + rxF_ext_index = 0; + ul_ch0_ext_index = 0; + ul_ch0_index = 0; if (is_dmrs_symbol == 0) { // @@ -406,7 +409,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, #if defined(__x86_64__)||defined(__i386__) short rb, ch_amp; - unsigned char aatx,aarx; + unsigned char aarx; __m128i *ul_ch128, ch_amp128; // Determine scaling amplitude based the symbol @@ -424,8 +427,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, int off = 0; #endif - for (aatx=0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++) { - for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++) { + for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++) { ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aarx][symbol*(off+(nb_rb*NR_NB_SC_PER_RB))]; @@ -454,7 +456,6 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, } } } - } #endif } @@ -471,6 +472,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, short rb; unsigned char aatx, aarx; + char nb_antennas_ue_tx = 1; __m128i *ul_ch128, avg128U; int16_t x = factor2(len); @@ -482,7 +484,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, int off = 0; #endif - for (aatx = 0; aatx < frame_parms->nb_antennas_tx; aatx++) + for (aatx = 0; aatx < nb_antennas_ue_tx; aatx++) for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { //clear average level avg128U = _mm_setzero_si128(); @@ -623,11 +625,12 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, unsigned short rb; unsigned char aatx,aarx; + char nb_antennas_ue_tx = 1; __m128i *ul_ch128,*ul_ch128_2,*ul_ch_mag128,*ul_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; QAM_amp128b = _mm_setzero_si128(); - for (aatx=0; aatx<frame_parms->nb_antennas_tx; aatx++) { + for (aatx=0; aatx<nb_antennas_ue_tx; aatx++) { if (mod_order == 4) { QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) @@ -1163,6 +1166,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, uint32_t nb_re_pusch, bwp_start_subcarrier; int avgs; int avg[4]; + char nb_antennas_ue_tx = 1; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu; @@ -1174,7 +1178,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, } - bwp_start_subcarrier = (rel15_ul->rb_start*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size; + bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size; dmrs_symbol_flag = ((rel15_ul->ul_dmrs_symb_pos)>>symbol)&0x01; @@ -1213,12 +1217,20 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, bwp_start_subcarrier, rel15_ul); + nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol); + int num_symb = rel15_ul->nr_of_symbols; for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { - gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size], + if (symbol == rel15_ul->start_symbol_index) { + gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]=0; + gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx]=0; + } + gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] += signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size], rel15_ul->rb_size*12); - if (gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]==1) return (1); - } - + for (int rb=0;rb<rel15_ul->rb_size;rb++) { + gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx]+=gNB->measurements.n0_subband_power[aarx][rel15_ul->bwp_start+rel15_ul->rb_start+rb]/rel15_ul->rb_size; + } + + } } stop_meas(&gNB->ulsch_channel_estimation_stats); //---------------------------------------------------------- @@ -1262,7 +1274,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, avgs = 0; - for (aatx=0;aatx<frame_parms->nb_antennas_tx;aatx++) + for (aatx=0;aatx<nb_antennas_ue_tx;aatx++) for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) avgs = cmax(avgs,avg[(aatx<<1)+aarx]); @@ -1280,7 +1292,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[ulsch_id]->ul_ch_mag0, gNB->pusch_vars[ulsch_id]->ul_ch_magb0, gNB->pusch_vars[ulsch_id]->rxdataF_comp, - (frame_parms->nb_antennas_tx>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL, + (nb_antennas_ue_tx>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL, frame_parms, symbol, dmrs_symbol_flag, diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 2d1fdff4be6d0c0803ae1ab9d75cdb4b7500e704..7e2ec05b7ffbcd7f0fc0fcddc3cdb1faf7a33ba7 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -161,6 +161,7 @@ int16_t idft12_im[12][12] = { void nr_decode_pucch0(PHY_VARS_gNB *gNB, + int frame, int slot, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { @@ -173,10 +174,24 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); + AssertFatal(pucch_pdu->bit_len_harq > 0 || pucch_pdu->sr_flag > 0, "Either bit_len_harq (%d) or sr_flag (%d) must be > 0\n", pucch_pdu->bit_len_harq,pucch_pdu->sr_flag); + NR_gNB_UCI_STATS_t *uci_stats=NULL; + NR_gNB_UCI_STATS_t *first_uci_stats=NULL; + for (int i=0;i<NUMBER_OF_NR_UCI_STATS_MAX;i++) + if (gNB->uci_stats[i].rnti == pucch_pdu->rnti) { + uci_stats = &gNB->uci_stats[i]; + break; + } else if (first_uci_stats == NULL && gNB->uci_stats[i].rnti == 0) first_uci_stats = &gNB->uci_stats[i]; + + if (uci_stats == NULL) { uci_stats=first_uci_stats; uci_stats->rnti = pucch_pdu->rnti;} + + AssertFatal(uci_stats!=NULL,"No stat index found\n"); + uci_stats->frame = frame; + if(pucch_pdu->bit_len_harq==0){ mcs=table1_mcs; nr_sequences=1; @@ -190,6 +205,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, nr_sequences=8>>(1-pucch_pdu->sr_flag); } + LOG_D(PHY,"pucch0: nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, O_ACK %d, O_SR %d, mcs %d\n",pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,mcs[0]); + int cs_ind = get_pucch0_cs_lut_index(gNB,pucch_pdu); /* * Implement TS 38.211 Subclause 6.3.2.3.1 Sequence generation @@ -216,178 +233,129 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, * x(l*12+n) = r_u_v_alpha_delta(n) */ // the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1 - uint8_t u=0,v=0;//,delta=0; - // if frequency hopping is disabled by the higher-layer parameter PUCCH-frequency-hopping - // n_hop = 0 - // if frequency hopping is enabled by the higher-layer parameter PUCCH-frequency-hopping - // n_hop = 0 for first hop - // n_hop = 1 for second hop - uint8_t n_hop = 0; // Frequnecy hopping not implemented FIXME!! + uint8_t u[2]={0,0},v[2]={0,0}; // x_n contains the sequence r_u_v_alpha_delta(n) int n,i,l; - nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,n_hop,slot,&u,&v); // calculating u and v value + int prb_offset[2] = {pucch_pdu->bwp_start+pucch_pdu->prb_start, pucch_pdu->bwp_start+pucch_pdu->prb_start}; - uint32_t re_offset=0; - uint8_t l2; + nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,0,slot,&u[0],&v[0]); // calculating u and v value first hop + LOG_D(PHY,"pucch0: u %d, v %d\n",u[0],v[0]); -#ifdef OLD_IMPL - int16_t x_n_re[nr_sequences][24],x_n_im[nr_sequences][24]; - for(i=0;i<nr_sequences;i++){ - // we proceed to calculate alpha according to TS 38.211 Subclause 6.3.2.2.2 - for (l=0; l<pucch_pdu->nr_of_symbols; l++){ - 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]); -#endif - 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 - 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 -#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)))); -#endif - } - } + if (pucch_pdu->freq_hop_flag == 1) { + nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,1,slot,&u[1],&v[1]); // calculating u and v value second hop + LOG_D(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]); + prb_offset[1] = pucch_pdu->bwp_start+pucch_pdu->second_hop_prb; } - /* - * Implementing TS 38.211 Subclause 6.3.2.3.2 Mapping to physical resources - */ - - int16_t r_re[24],r_im[24]; - for (l=0; l<pucch_pdu->nr_of_symbols; l++) { - - l2 = l+pucch_pdu->start_symbol_index; - 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; - - for (n=0; n<12; n++){ + AssertFatal(pucch_pdu->nr_of_symbols < 3,"nr_of_symbols %d not allowed\n",pucch_pdu->nr_of_symbols); + uint32_t re_offset[2]={0,0}; + uint8_t l2; - 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 - re_offset++; - if (re_offset>= frame_parms->ofdm_symbol_size) - re_offset-=frame_parms->ofdm_symbol_size; - } - } - double corr[nr_sequences],corr_re[nr_sequences],corr_im[nr_sequences]; - memset(corr,0,nr_sequences*sizeof(double)); - memset(corr_re,0,nr_sequences*sizeof(double)); - memset(corr_im,0,nr_sequences*sizeof(double)); - for(i=0;i<nr_sequences;i++){ - for(l=0;l<pucch_pdu->nr_of_symbols;l++){ - for(n=0;n<12;n++){ - corr_re[i]+= (double)(r_re[12*l+n])/32767*(double)(x_n_re[i][12*l+n])/32767+(double)(r_im[12*l+n])/32767*(double)(x_n_im[i][12*l+n])/32767; - corr_im[i]+= (double)(r_re[12*l+n])/32767*(double)(x_n_im[i][12*l+n])/32767-(double)(r_im[12*l+n])/32767*(double)(x_n_re[i][12*l+n])/32767; - } - } - corr[i]=corr_re[i]*corr_re[i]+corr_im[i]*corr_im[i]; - } - float max_corr=corr[0]; - uint8_t index=0; - for(i=1;i<nr_sequences;i++){ - if(corr[i]>max_corr){ - index= i; - max_corr=corr[i]; - } - } -#else + const int16_t *x_re[2],*x_im[2]; + x_re[0] = table_5_2_2_2_2_Re[u[0]]; + x_im[0] = table_5_2_2_2_2_Im[u[0]]; + x_re[1] = table_5_2_2_2_2_Re[u[1]]; + x_im[1] = table_5_2_2_2_2_Im[u[1]]; - 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))); - int32_t xrtmag=0; + int16_t xr[2][24] __attribute__((aligned(32))); + int64_t xrtmag=0; uint8_t maxpos=0; - int n2=0; uint8_t index=0; - memset((void*)xr,0,24*sizeof(int16_t)); + memset((void*)xr[0],0,24*sizeof(int16_t)); + memset((void*)xr[1],0,24*sizeof(int16_t)); + int n2; for (l=0; l<pucch_pdu->nr_of_symbols; l++) { - l2 = l+pucch_pdu->start_symbol_index; - re_offset = (12*pucch_pdu->prb_start) + frame_parms->first_carrier_offset; - if (re_offset>= frame_parms->ofdm_symbol_size) - re_offset-=frame_parms->ofdm_symbol_size; + re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset; + if (re_offset[l]>= frame_parms->ofdm_symbol_size) + re_offset[l]-=frame_parms->ofdm_symbol_size; - AssertFatal(re_offset+12 < frame_parms->ofdm_symbol_size,"pucch straddles DC carrier, handle this!\n"); + AssertFatal(re_offset[l]+12 < frame_parms->ofdm_symbol_size,"pucch straddles DC carrier, handle this!\n"); - int16_t *r=(int16_t*)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size+re_offset)]; + int16_t *r=(int16_t*)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; + n2=0; for (n=0;n<12;n++,n2+=2) { - xr[n2] =(int16_t)(((int32_t)x_re[n]*r[n2]+(int32_t)x_im[n]*r[n2+1])>>15); - xr[n2+1]=(int16_t)(((int32_t)x_re[n]*r[n2+1]-(int32_t)x_im[n]*r[n2])>>15); + xr[l][n2] =(int16_t)(((int32_t)x_re[l][n]*r[n2]+(int32_t)x_im[l][n]*r[n2+1])>>15); + xr[l][n2+1]=(int16_t)(((int32_t)x_re[l][n]*r[n2+1]-(int32_t)x_im[l][n]*r[n2])>>15); #ifdef DEBUG_NR_PUCCH_RX - printf("x (%d,%d), r (%d,%d), xr (%d,%d)\n", - x_re[n],x_im[n],r[n2],r[n2+1],xr[n2],xr[n2+1]); + printf("x (%d,%d), r%d.%d (%d,%d), xr (%d,%d)\n", + x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[l][n2],xr[l][n2+1]); #endif } } - int32_t corr_re,corr_im,temp,no_corr=0; - int32_t av_corr=0; + int32_t corr_re[2],corr_im[2],no_corr=0; int seq_index; - + int64_t temp,av_corr=0; for(i=0;i<nr_sequences;i++){ - corr_re=0;corr_im=0; - n2=0; for (l=0;l<pucch_pdu->nr_of_symbols;l++) { - + corr_re[l]=0;corr_im[l]=0; seq_index = (pucch_pdu->initial_cyclic_shift+ mcs[i]+ gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12; +#ifdef DEBUG_NR_PUCCH_RX + printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]); +#endif + n2=0; for (n=0;n<12;n++,n2+=2) { - corr_re+=(xr[n2]*idft12_re[seq_index][n]+xr[n2+1]*idft12_im[seq_index][n])>>15; - corr_im+=(xr[n2]*idft12_im[seq_index][n]-xr[n2+1]*idft12_re[seq_index][n])>>15; + corr_re[l]+=(xr[l][n2]*idft12_re[seq_index][n]+xr[l][n2+1]*idft12_im[seq_index][n])>>15; + corr_im[l]+=(xr[l][n2]*idft12_im[seq_index][n]-xr[l][n2+1]*idft12_re[seq_index][n])>>15; } } #ifdef DEBUG_NR_PUCCH_RX - printf("PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re,corr_im,10*log10(corr_re*corr_re + corr_im*corr_im)); + LOG_I(PHY,"PUCCH IDFT = (%d,%d)=>%f\n",corr_re[0],corr_im[0],10*log10((double)corr_re[0]*corr_re[0] + (double)corr_im[0]*corr_im[0])); + if (l>1) LOG_I(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[1],corr_im[1],10*log10((double)corr_re[1]*corr_re[1] + (double)corr_im[1]*corr_im[1])); #endif - temp=corr_re*corr_re + corr_im*corr_im; + if (pucch_pdu->freq_hop_flag == 0 && l==1) // non-coherent correlation + temp=(int64_t)corr_re[0]*corr_re[0] + (int64_t)corr_im[0]*corr_im[0]; + else if (pucch_pdu->freq_hop_flag == 0 && l==2) { + int64_t corr_re2 = (int64_t)corr_re[0]+corr_re[1]; + int64_t corr_im2 = (int64_t)corr_im[0]+corr_im[1]; + // coherent combining of 2 symbols and then complex modulus for single-frequency case + temp=corr_re2*corr_re2 + corr_im2*corr_im2; + } + else if (pucch_pdu->freq_hop_flag == 1) + // full non-coherent combining of 2 symbols for frequency-hopping case + temp = (int64_t)corr_re[0]*corr_re[0] + (int64_t)corr_im[0]*corr_im[0] + (int64_t)corr_re[1]*corr_re[1] + (int64_t)corr_im[1]*corr_im[1]; + else AssertFatal(1==0,"shouldn't happen\n"); + av_corr+=temp; if (temp>xrtmag) { xrtmag=temp; maxpos=i; + uci_stats->current_pucch0_stat0 = dB_fixed64((int64_t)corr_re[0]*corr_re[0] + (int64_t)corr_im[0]*corr_im[0]); + if (l==2) uci_stats->current_pucch0_stat1 = dB_fixed64((int64_t)corr_re[1]*corr_re[1] + (int64_t)corr_im[1]*corr_im[1]); } } if(nr_sequences>1) - no_corr=(av_corr-xrtmag)/(nr_sequences-1); - av_corr/=nr_sequences; + no_corr=(av_corr-xrtmag)/(nr_sequences-1)/l; + av_corr/=nr_sequences/l; - uint8_t xrtmag_dB = dB_fixed(xrtmag); + uint8_t xrtmag_dB = dB_fixed64(xrtmag); #ifdef DEBUG_NR_PUCCH_RX printf("PUCCH 0 : maxpos %d\n",maxpos); #endif index=maxpos; -#endif + // estimate CQI for MAC (from antenna port 0 only) - int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12)) - (10*gNB->measurements.n0_power_tot_dB); + int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01; + int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset[0]],12)) - (10*max_n0); int cqi; if (SNRtimes10 < -640) cqi=0; else if (SNRtimes10 > 635) cqi=255; else cqi=(640+SNRtimes10)/5; + uci_stats->pucch0_thres = gNB->pucch0_thres + (10*max_n0); bool no_conf=false; if (nr_sequences>1) { - if ((xrtmag_dB<(11+dB_fixed(no_corr))) || (dB_fixed(av_corr)<(13+gNB->measurements.n0_power_tot_dB))) //TODO these are temporary threshold based on measurments with the phone + if (10*xrtmag_dB < uci_stats->pucch0_thres) no_conf=true; } // first bit of bitmap for sr presence and second bit for acknack presence @@ -396,13 +364,18 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->rnti = pucch_pdu->rnti; uci_pdu->ul_cqi = cqi; uci_pdu->timing_advance = 0xffff; // currently not valid - uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12))); + uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset[0]],12))); + + uci_stats->pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]]; + uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_confidence_level = (xrtmag_dB<(13+gNB->measurements.n0_power_tot_dB)) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_stats->pucch0_sr_trials++; if (xrtmag_dB>(gNB->measurements.n0_power_tot_dB)) { uci_pdu->sr->sr_indication = 1; + uci_stats->pucch0_positive_SR++; } else { uci_pdu->sr->sr_indication = 0; } @@ -410,16 +383,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, else if (pucch_pdu->bit_len_harq==1) { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq->num_harq = 1; - uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; + uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = index&0x01; - LOG_D(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d\n", - slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level); + LOG_D(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d n0 %d pucch0_thres %d\n", + slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB,max_n0,uci_stats->pucch0_thres); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; - uci_pdu->sr->sr_confidence_level = (no_conf) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_stats->pucch0_positive_SR++; } + uci_stats->pucch01_trials++; + } else { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); @@ -428,8 +404,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); uci_pdu->harq->harq_list[1].harq_value = index&0x01; uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01; - LOG_D(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d\n", - slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level); + LOG_D(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d, xrt_mag %d\n", + slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; @@ -1604,7 +1580,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, re_offset = (12*pucch_pdu->prb_start) + (12*pucch_pdu->bwp_start) + frame_parms->first_carrier_offset; // estimate CQI for MAC (from antenna port 0 only) int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset],12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB); - int cqi; + int cqi,bit_left; if (SNRtimes10 < -640) cqi=0; else if (SNRtimes10 > 635) cqi=255; else cqi=(640+SNRtimes10)/5; @@ -1628,7 +1604,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->harq.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); + bit_left = pucch_pdu->bit_len_harq-((harq_bytes-1)<<3); + uci_pdu->harq.harq_payload[i] = decodedPayload[0] & ((1<<bit_left)-1); decodedPayload[0] >>= pucch_pdu->bit_len_harq; } @@ -1642,6 +1619,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, // csi if (pucch_pdu->bit_len_csi_part1>0) { uci_pdu->pduBitmap|=4; + uci_pdu->csi_part1.csi_part1_bit_len=pucch_pdu->bit_len_csi_part1; 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); @@ -1651,7 +1629,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->csi_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); + bit_left = pucch_pdu->bit_len_csi_part1-((csi_part1_bytes-1)<<3); + uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<<bit_left)-1); decodedPayload[0] >>= pucch_pdu->bit_len_csi_part1; } @@ -1659,4 +1638,34 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->pduBitmap|=8; } } - + + +void dump_uci_stats(FILE *fd,PHY_VARS_gNB *gNB,int frame) { + + int strpos=0; + char output[16384]; + + for (int i=0;i<NUMBER_OF_NR_UCI_STATS_MAX;i++){ + if (gNB->uci_stats[i].rnti>0) { + NR_gNB_UCI_STATS_t *uci_stats = &gNB->uci_stats[i]; + if (uci_stats->pucch0_sr_trials > 0) + strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d\n", + i,uci_stats->rnti,uci_stats->pucch0_sr_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_sr_thres,dB_fixed(uci_stats->current_pucch0_sr_stat0),dB_fixed(uci_stats->current_pucch0_sr_stat1),uci_stats->pucch0_positive_SR); + if (uci_stats->pucch01_trials > 0) + strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d\n", + i,uci_stats->rnti,uci_stats->pucch01_trials,uci_stats->pucch0_n01,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch01_DTX); + + if (uci_stats->pucch02_trials > 0) + strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d\n", + i,uci_stats->rnti,uci_stats->pucch02_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch02_DTX); + + if (uci_stats->pucch2_trials > 0) + strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d\n", + i,uci_stats->rnti, + uci_stats->pucch2_trials, + uci_stats->pucch2_DTX); + } + } + if (fd) fprintf(fd,"%s",output); + else printf("%s",output); +} 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 6cb0a612e9d6dd229f541aa251c085d1a8181d72..909d0b8954036a72584605e3a996733972b40e4d 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -77,9 +77,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, // generate pilot nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); - int re_offset = ssb_offset; for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { + int re_offset = ssb_offset; pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; @@ -277,9 +277,9 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, // generate pilot nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); - int re_offset = ssb_offset; for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { + int re_offset = ssb_offset; pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; @@ -456,12 +456,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, // do ifft of channel estimate for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) for (p=0; p<ue->frame_parms.nb_antenna_ports_gNB; p++) { - if (ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx]) + if (ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx]) { LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, proc->thread_id, symbol, ch_offset); idft(idftsizeidx, - (int16_t*) &ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx][ch_offset], - (int16_t*) ue->pbch_vars[eNB_offset]->dl_ch_estimates_time[(p<<1)+aarx],1); + (int16_t*) &ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx][ch_offset], + (int16_t*) ue->pbch_vars[eNB_offset]->dl_ch_estimates_time[(p*ue->frame_parms.nb_antennas_rx)+aarx],1); } } } @@ -512,6 +512,13 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, fr = filt16a_r1; + // checking if re-initialization of scrambling IDs is needed (should be done here but scrambling ID for PDCCH is not taken from RRC) +/* if (( != ue->scramblingID_pdcch){ + ue->scramblingID_pdcch=; + nr_gold_pdsch(ue,ue->scramblingID_pdcch); + }*/ + + // generate pilot int pilot[nb_rb_coreset * 3] __attribute__((aligned(16))); nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns][symbol], &pilot[0],2000,nb_rb_coreset); @@ -650,6 +657,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_offset, + bool is_SI, unsigned char Ns, unsigned short p, unsigned char symbol, @@ -672,7 +680,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; if (ue->high_speed_flag == 0) - ch_offset = ue->frame_parms.ofdm_symbol_size ; + ch_offset = ue->frame_parms.ofdm_symbol_size; else ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; @@ -687,14 +695,25 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, #endif // generate pilot for gNB port number 1000+p - uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12 - BWPStart; + uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12; + if (is_SI) { + rb_offset -= BWPStart; + } uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type; int8_t delta = get_delta(p, config_type); - nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][symbol][0], &pilot[0],1000,0,nb_rb_pdsch+rb_offset); + + // checking if re-initialization of scrambling IDs is needed + if ((ue->dmrs_DownlinkConfig.scramblingID0 != ue->scramblingID[0]) || (ue->dmrs_DownlinkConfig.scramblingID1 != ue->scramblingID[1])){ + ue->scramblingID[0]=ue->dmrs_DownlinkConfig.scramblingID0; + ue->scramblingID[1]=ue->dmrs_DownlinkConfig.scramblingID1; + nr_gold_pdsch(ue,ue->scramblingID); + } + + nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][symbol][0], &pilot[0],1000+p,0,nb_rb_pdsch+rb_offset); if (config_type == pdsch_dmrs_type1){ nushift = (p>>1)&1; - ue->frame_parms.nushift = nushift; + if (p<4) ue->frame_parms.nushift = nushift; switch (delta) { case 0://port 0,1 @@ -734,7 +753,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, } } else {//pdsch_dmrs_type2 nushift = delta; - ue->frame_parms.nushift = nushift; + if (p<6) ue->frame_parms.nushift = nushift; switch (delta) { case 0://port 0,1 fl = filt8_l2;//left interpolation Filter should be fml diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 6c461ef4480cce2089ea49724437715211201f18..1466fabe5d5f1a549922e5729d250d2d22075267 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -70,6 +70,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_offset, + bool is_SI, unsigned char Ns, unsigned short p, unsigned char symbol, diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c index 61fc40ad3f5539f5bc83335da6bc4298e01e4c9c..3f52b2928110ee373794b8d800df85b656c4ca76 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c @@ -21,16 +21,17 @@ /*! \file nr_ue_measurements.c * \brief UE measurements routines - * \author R. Knopp, G. Casati + * \author R. Knopp, G. Casati, K. Saaifan * \date 2020 * \version 0.1 * \company Eurecom, Fraunhofer IIS - * \email: knopp@eurecom.fr, guido.casati@iis.fraunhofer.de + * \email: knopp@eurecom.fr, guido.casati@iis.fraunhofer.de, khodr.saaifan@iis.fraunhofer.de * \note * \warning */ #include "executables/softmodem-common.h" +#include "executables/nr-softmodem-common.h" #include "PHY/defs_nr_UE.h" #include "PHY/phy_extern_nr_ue.h" #include "common/utils/LOG/log.h" @@ -45,7 +46,7 @@ //#define DEBUG_MEAS_UE //#define DEBUG_RANK_EST -// Returns the pathloss in dBm for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission +// Returns the pathloss in dB for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission // computation according to clause 7.4 (Physical random access channel) of 3GPP TS 38.213 version 16.3.0 Release 16 // Assumptions: // - PRACH transmission from a UE is not in response to a detection of a PDCCH order by the UE @@ -59,18 +60,17 @@ int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){ if (get_softmodem_params()->do_ra){ long referenceSignalPower = ue->nrUE_config.ssb_config.ss_pbch_power; - double rsrp_dBm = 10*log10(ue->measurements.rsrp[gNB_index]) + 30 - ue->rx_total_gain_dB; - pathloss = (int16_t)(10*log10(pow(10, (double)(referenceSignalPower)/10) - pow(10, (double)(rsrp_dBm)/10))); + pathloss = (int16_t)(referenceSignalPower - ue->measurements.rsrp_dBm[gNB_index]); - LOG_D(MAC, "In %s: pathloss %d dBm, UE RX total gain %d dB, referenceSignalPower %ld dBm (%f mW), RSRP %f dBm (%f mW)\n", + LOG_D(MAC, "In %s: pathloss %d dB, UE RX total gain %d dB, referenceSignalPower %ld dBm/RE (%f mW), RSRP %d dBm (%f mW)\n", __FUNCTION__, pathloss, ue->rx_total_gain_dB, referenceSignalPower, pow(10, referenceSignalPower/10), - rsrp_dBm, - pow(10, rsrp_dBm/10)); + ue->measurements.rsrp_dBm[gNB_index], + pow(10, ue->measurements.rsrp_dBm[gNB_index]/10)); } else { @@ -178,9 +178,9 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, ue->measurements.rx_power_avg_dB[gNB_id] = dB_fixed( ue->measurements.rx_power_avg[gNB_id]); ue->measurements.wideband_cqi_tot[gNB_id] = dB_fixed2(ue->measurements.rx_power_tot[gNB_id], ue->measurements.n0_power_tot); ue->measurements.wideband_cqi_avg[gNB_id] = dB_fixed2(ue->measurements.rx_power_avg[gNB_id], ue->measurements.n0_power_avg); - ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] - ue->rx_total_gain_dB; + ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] + 30 - 10*log10(pow(2, 30)) - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size); - LOG_D(PHY, "[gNB %d] Slot %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n", + LOG_I(PHY, "[gNB %d] Slot %d, RSSI %d dBm/RE, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d \n", gNB_id, slot, ue->measurements.rx_rssi_dBm[gNB_id], @@ -258,15 +258,20 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue, ue->measurements.rsrp_filtered[gNB_id] = ue->measurements.rsrp[gNB_id]; - LOG_D(PHY, "In %s: [UE %d] slot %d SS-RSRP: %3.1f dBm/RE (%d W)\n", + ue->measurements.rsrp_dBm[gNB_id] = 10*log10(ue->measurements.rsrp[gNB_id]) + 30 - 10*log10(pow(2,30)) - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size); + + LOG_D(PHY, "In %s: [UE %d] slot %d SS-RSRP: %d dBm/RE (%d)\n", __FUNCTION__, ue->Mod_id, slot, - 10*log10(ue->measurements.rsrp[gNB_id]) + 30 - ue->rx_total_gain_dB, + ue->measurements.rsrp_dBm[gNB_id], ue->measurements.rsrp[gNB_id]); } +// This function computes the received noise power +// Measurement units: +// - psd_awgn (AWGN power spectral density): dBm/Hz void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t slot){ @@ -279,6 +284,9 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, uint8_t k_length = 8; uint8_t l_sss = ue->symbol_offset + 2; unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier; + double rx_gain = openair0_cfg[0].rx_gain[0]; + double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; + ue->measurements.n0_power_tot = 0; LOG_D(PHY, "In %s doing measurements for ssb_offset %d l_sss %d \n", __FUNCTION__, ssb_offset, l_sss); @@ -322,10 +330,17 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/aarx); #ifdef DEBUG_MEAS_RRC - int nf_usrp = ue->measurements.n0_power_tot_dB + 30 - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - 90 - (-174 + dB_fixed(30000/*scs*/) + dB_fixed(ue->frame_parms.ofdm_symbol_size)); - LOG_D(PHY, "In %s slot %d NF USRP %d dBm\n", __FUNCTION__, nf_usrp); + const int psd_awgn = -174; + const int scs = 15000 * (1 << ue->frame_parms.numerology_index); + const int nf_usrp = ue->measurements.n0_power_tot_dB + 3 + 30 - ((int)rx_gain - (int)rx_gain_offset) - 10 * log10(pow(2, 30)) - (psd_awgn + dB_fixed(scs) + dB_fixed(ue->frame_parms.ofdm_symbol_size)); + LOG_D(PHY, "In [%s][slot:%d] NF USRP %d dB\n", __FUNCTION__, slot, nf_usrp); #endif - LOG_D(PHY, "In %s slot %d Noise Level %d ue->measurements.n0_power_tot_dB %d \n", __FUNCTION__, slot, ue->measurements.n0_power_tot, ue->measurements.n0_power_tot_dB); + LOG_D(PHY, "In [%s][slot:%d] Noise Level %d (digital level %d dB, noise power spectral density %f dBm/RE)\n", + __FUNCTION__, + slot, + ue->measurements.n0_power_tot, + ue->measurements.n0_power_tot_dB, + ue->measurements.n0_power_tot_dB + 30 - 10*log10(pow(2, 30)) - dB_fixed(ue->frame_parms.ofdm_symbol_size) - ((int)rx_gain - (int)rx_gain_offset)); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index abc944bc00953c6c482f907c244926715643f3f3..27bc569517521255ffc5034d0de854219377ae14 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -50,6 +50,16 @@ #include "assertions.h" #include "T.h" +char nr_dci_format_string[8][30] = { + "NR_DL_DCI_FORMAT_1_0", + "NR_DL_DCI_FORMAT_1_1", + "NR_DL_DCI_FORMAT_2_0", + "NR_DL_DCI_FORMAT_2_1", + "NR_DL_DCI_FORMAT_2_2", + "NR_DL_DCI_FORMAT_2_3", + "NR_UL_DCI_FORMAT_0_0", + "NR_UL_DCI_FORMAT_0_1"}; + //#define DEBUG_DCI_DECODING 1 //#define NR_LTE_PDCCH_DCI_SWITCH @@ -402,11 +412,12 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, c_rb = 0; for (int rb=0;rb<coreset_nbr_rb;rb++,c_rb++) { c_rb_by6 = c_rb/6; + // skip zeros in frequency domain bitmap while ((coreset_freq_dom[c_rb_by6>>3] & (1<<(7-(c_rb_by6&7)))) == 0) { - c_rb+=6; - c_rb_by6 = c_rb/6; - } + c_rb+=6; + c_rb_by6 = c_rb/6; + } LOG_DDD("c_rb=%d\n",c_rb); rxF=NULL; @@ -715,6 +726,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, rel15 = &pdcch_vars->pdcch_config[i]; int n_rb,rb_offset; get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset); + LOG_D(PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n", + rel15->coreset.frequency_domain_resource[0],n_rb,rb_offset); for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) { LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); @@ -915,10 +928,10 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, currentPtrDCI); n_rnti = rel15->rnti; - + LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d)\n", proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length); if (crc == n_rnti) { - LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", - proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation); + LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n", + proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation); dci_ind->SFN = proc->frame_rx; dci_ind->slot = proc->nr_slot_rx; dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 429bd9a836857abedbad4d99aec1880ebf60f704..5d98d8dd8f65bb204f393bedb82cfbfc1322a855 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -261,7 +261,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params* p_decParams = &decParams; - t_nrLDPC_time_stats procTime; + t_nrLDPC_time_stats procTime = {0}; t_nrLDPC_time_stats* p_procTime =&procTime ; if (!harq_process) { @@ -587,8 +587,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = no_iteration_ldpc; } else { - LOG_D(PHY,"CRC NOT OK\n\033[0m"); + LOG_D(PHY,"CRC NOT OK\n\033[0m"); /* ret = 1 + dlsch->max_ldpc_iterations; + dump_nrdlsch(phy_vars_ue,0,nr_slot_rx,&E,0,0); + exit(-1);*/ } @@ -678,7 +680,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, memcpy(harq_process->b+offset, harq_process->c[r], - Kr_bytes- - (harq_process->F>>3) -((harq_process->C>1)?3:0)); + Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) @@ -691,8 +693,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, harq_process->F>>3, (void *)(uint64_t)(harq_process->c[r]) ); if (frame%100 == 0){ - LOG_D (PHY, "Printing 10 first payload bytes at frame: %d ", frame); - for (int i = 0; i <10 ; i++){ //Kr_bytes + LOG_D (PHY, "Printing 60 first payload bytes at frame: %d ", frame); + for (int i = 0; i <60 ; i++){ //Kr_bytes LOG_D(PHY, "[%d] : %x ", i, harq_process->b[i]); } } @@ -702,6 +704,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_COMBINE_SEG, VCD_FUNCTION_OUT); dlsch->last_iteration_cnt = ret; + // log_dump(PHY, harq_process->b, 60, LOG_DUMP_CHAR,"nrue pdsch rx frame %d %d: ", frame, nr_slot_rx ); return(ret); } @@ -1122,7 +1125,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ret = 2; } else { - LOG_D(PHY,"CRC NOK\n"); ret = 1+dlsch->max_ldpc_iterations; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 9a312572446043504821cd77c152541d29e77f39..9fe53570a7a0623a764495f48e2af94f8f5ac6e0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -52,7 +52,7 @@ * set as command line argument, see lte-softmodem.c * default value: 0 */ -int16_t nr_dlsch_demod_shift = 0; +int32_t nr_dlsch_demod_shift = 0; //int16_t interf_unaw_shift = 13; //#define DEBUG_HARQ @@ -84,8 +84,8 @@ unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{ */ //unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; - -extern void print_shorts(char *s,int16_t *x); +#define print_ints(s,x) printf("%s %d %d %d %d\n",s,(x)[0],(x)[1],(x)[2],(x)[3]) +#define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) static void nr_dlsch_dual_stream_correlation_core(int **dl_ch_estimates_ext, int **dl_ch_estimates_ext_i, @@ -96,6 +96,16 @@ static void nr_dlsch_dual_stream_correlation_core(int **dl_ch_estimates_ext, int length, int start_point); +uint8_t nr_zero_forcing_rx_2layers(int **rxdataF_comp, + int **dl_ch_mag, + int **dl_ch_magb, + int **dl_ch_estimates_ext, + unsigned short nb_rb, + unsigned char n_rx, + unsigned char mod_order, + int shift, + unsigned char symbol); + static void nr_dlsch_layer_demapping(int16_t **llr_cw, uint8_t Nl, uint8_t mod_order, @@ -113,7 +123,7 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, RX_type_t rx_type, unsigned char harq_pid, unsigned char gNB_id, - unsigned char eNB_id_i, + unsigned char gNB_id_i, unsigned char first_symbol_flag, unsigned char symbol, unsigned short nb_rb, @@ -129,7 +139,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, PDSCH_t type, unsigned char gNB_id, - unsigned char eNB_id_i, //if this == ue->n_connected_gNB, we assume MU interference + unsigned char gNB_id_i, uint32_t frame, uint8_t nr_slot_rx, unsigned char symbol, @@ -145,7 +155,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, PHY_NR_MEASUREMENTS *measurements = &ue->measurements; NR_UE_DLSCH_t **dlsch; - int avg[4]; + int avg[16]; // int avg_0[2]; // int avg_1[2]; @@ -173,7 +183,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //int16_t *pllr_symbol_cw1_deint; //uint16_t bundle_L = 2; uint8_t pilots=0; - uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type; + uint8_t config_type;// We should not use ue->dmrs_DownlinkConfig.pdsch_dmrs_type; uint16_t n_tx=1, n_rx=1; int32_t median[16]; uint32_t len; @@ -331,90 +341,44 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif pilots = ((1<<symbol)&dlsch0_harq->dlDmrsSymbPos)>0 ? 1 : 0; + config_type = dlsch0_harq->dmrsConfigType; - if (frame_parms->nb_antenna_ports_gNB>1 && beamforming_mode==0) { -#ifdef DEBUG_DLSCH_MOD - LOG_I(PHY,"dlsch: using pmi %x (%p)\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0]); -#endif - + if (beamforming_mode==0) {//No beamforming #if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #endif - nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[gNB_id]->pmi_ext, - symbol, - pilots, - start_rb, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->mimo_mode); -#ifdef DEBUG_DLSCH_MOD - printf("dlsch: using pmi %lx, pmi_ext ",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc)); - for (rb=0;rb<nb_rb;rb++) - printf("%d",pdsch_vars[gNB_id]->pmi_ext[rb]); - printf("\n"); -#endif - - if (rx_type >= rx_IC_single_stream) { - if (eNB_id_i < ue->n_connected_gNB) // we are in TM5 - nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[eNB_id_i]->rxdataF_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[eNB_id_i]->pmi_ext, - symbol, - pilots, - start_rb, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->mimo_mode); - else - nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[eNB_id_i]->rxdataF_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[eNB_id_i]->pmi_ext, - symbol, - pilots, - start_rb, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->mimo_mode); - } - } else if (beamforming_mode==0) { //else if nb_antennas_ports_gNB==1 && beamforming_mode == 0 - //printf("start nr dlsch extract nr_slot_rx %d thread id %d \n", nr_slot_rx, proc->thread_id); - nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[gNB_id]->pmi_ext, - symbol, - pilots, - config_type, - start_rb + dlsch0_harq->BWPStart, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->dlDmrsSymbPos); - - } /*else if(beamforming_mode>7) { + if (dlsch0_harq->Nl > 1)//More than or equal 2 layers + nb_rb = nr_dlsch_extract_rbs_multiple(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + pdsch_vars[gNB_id]->dl_ch_estimates, + pdsch_vars[gNB_id]->rxdataF_ext, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + symbol, + pilots, + config_type, + start_rb + dlsch0_harq->BWPStart, + nb_rb_pdsch, + dlsch0_harq->n_dmrs_cdm_groups, + dlsch0_harq->Nl, + frame_parms, + dlsch0_harq->dlDmrsSymbPos); + else// one layer + nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + pdsch_vars[gNB_id]->dl_ch_estimates, + pdsch_vars[gNB_id]->rxdataF_ext, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + symbol, + pilots, + config_type, + start_rb + dlsch0_harq->BWPStart, + nb_rb_pdsch, + dlsch0_harq->n_dmrs_cdm_groups, + frame_parms, + dlsch0_harq->dlDmrsSymbPos); + } + else if(beamforming_mode>7) { LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n"); - }*/ - + } + //printf("nb_rb = %d, gNB_id %d\n",nb_rb,gNB_id); if (nb_rb==0) { LOG_D(PHY,"dlsch_demodulation.c: nb_rb=0\n"); @@ -437,16 +401,18 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #endif - n_tx = frame_parms->nb_antenna_ports_gNB; + n_tx = dlsch0_harq->Nl; n_rx = frame_parms->nb_antennas_rx; nr_dlsch_scale_channel(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - frame_parms, - dlsch, - symbol, - pilots, - len, - nb_rb); + frame_parms, + n_tx, + n_rx, + dlsch, + symbol, + pilots, + len, + nb_rb); #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); @@ -462,42 +428,40 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif if (first_symbol_flag==1) { if (beamforming_mode==0){ - if (dlsch0_harq->mimo_mode<NR_DUALSTREAM) { - nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - frame_parms, - avg, - symbol, - len, - nb_rb); - avgs = 0; - for (aatx=0;aatx<frame_parms->nb_antenna_ports_gNB;aatx++) - for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) - avgs = cmax(avgs,avg[(aatx<<1)+aarx]); - - pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2)+3; - } - else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) - { - nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - median, - n_tx, - n_rx, - 2*len,// subcarriers Re Im - 0); - - for (aatx = 0; aatx < n_tx; ++aatx) - { - for (aarx = 0; aarx < n_rx; ++aarx) - { - avgs = cmax(avgs, median[aatx*n_rx + aarx]); - } - } - - pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1; // this might need to be tuned - - } + nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + frame_parms, + n_tx, + avg, + symbol, + len, + nb_rb); + avgs = 0; + for (aatx=0;aatx<n_tx;aatx++) + for (aarx=0;aarx<n_rx;aarx++) { + //LOG_I(PHY, "nb_rb %d len %d avg_%d_%d Power per SC is %d\n",nb_rb, len,aarx, aatx,avg[aatx*frame_parms->nb_antennas_rx+aarx]); + avgs = cmax(avgs,avg[(aatx*frame_parms->nb_antennas_rx)+aarx]); + //LOG_I(PHY, "avgs Power per SC is %d\n", avgs); + median[(aatx*frame_parms->nb_antennas_rx)+aarx] = avg[(aatx*frame_parms->nb_antennas_rx)+aarx]; + } + pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2)+3; + //LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, pdsch_vars[gNB_id]->log2_maxh); + + if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { + nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + median, + n_tx, + n_rx, + len, + symbol*nb_rb*12); + + for (aatx = 0; aatx < n_tx; aatx++) { + for (aarx = 0; aarx < n_rx; aarx++) { + avgs = cmax(avgs, median[aatx*n_rx + aarx]); + } + } + pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1; + } } - //#ifdef UE_DEBUG_TRACE LOG_D(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n", frame%1024, nr_slot_rx, @@ -506,22 +470,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[gNB_id]->log2_maxh1, avg[0], avgs); - //LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode); - //#endif - - //wait until pdcch is decoded - //proc->channel_level = 1; } - /* - uint32_t wait = 0; - while(proc->channel_level == 0) - { - usleep(1); - wait++; - } - */ - #if T_TRACER if (type == PDSCH) { @@ -546,58 +496,25 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, // Now channel compensation if (dlsch0_harq->mimo_mode<NR_DUALSTREAM) { nr_dlsch_channel_compensation(pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - pdsch_vars[gNB_id]->dl_ch_magr0, - pdsch_vars[gNB_id]->rxdataF_comp0, - (aatx>1) ? pdsch_vars[gNB_id]->rho : NULL, - frame_parms, - symbol, - pilots, - first_symbol_flag, - dlsch0_harq->Qm, - nb_rb, - pdsch_vars[gNB_id]->log2_maxh, - measurements); // log2_maxh+I0_shift - /*if (symbol == 5) { - write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[gNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - } */ - - /*if ((rx_type==rx_IC_single_stream) && - (eNB_id_i<ue->n_connected_gNB)) { - nr_dlsch_channel_compensation(pdsch_vars[eNB_id_i]->rxdataF_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdsch_vars[eNB_id_i]->dl_ch_mag0, - pdsch_vars[eNB_id_i]->dl_ch_magb0, - pdsch_vars[eNB_id_i]->rxdataF_comp0, - (aatx>1) ? pdsch_vars[eNB_id_i]->rho : NULL, - frame_parms, - symbol, - first_symbol_flag, - i_mod, - nb_rb, - pdsch_vars[gNB_id]->log2_maxh, - measurements); // log2_maxh+I0_shift -#ifdef DEBUG_PHY - if (symbol == 5) { - write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[gNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - } -#endif - - dlsch_dual_stream_correlation(frame_parms, - symbol, - nb_rb, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - pdsch_vars[gNB_id]->log2_maxh); - }*/ - } + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + pdsch_vars[gNB_id]->dl_ch_magr0, + pdsch_vars[gNB_id]->rxdataF_comp0, + (n_tx>1) ? pdsch_vars[gNB_id]->rho : NULL, + frame_parms, + n_tx, + symbol, + pilots, + first_symbol_flag, + dlsch0_harq->Qm, + nb_rb, + pdsch_vars[gNB_id]->log2_maxh, + measurements); // log2_maxh+I0_shift + } - else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM){ - nr_dlsch_channel_compensation_core(pdsch_vars[gNB_id]->rxdataF_ext, + else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { + nr_dlsch_channel_compensation_core(pdsch_vars[gNB_id]->rxdataF_ext, pdsch_vars[gNB_id]->dl_ch_estimates_ext, pdsch_vars[gNB_id]->dl_ch_mag0, pdsch_vars[gNB_id]->dl_ch_magb0, @@ -609,40 +526,16 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[gNB_id]->log2_maxh, 2*len, // subcarriers Re Im 0); // we start from the beginning of the vector - /* if (symbol == 5) { - write_output("rxF_comp_d00.m","rxF_c_d00",&pdsch_vars[gNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM - write_output("rxF_comp_d01.m","rxF_c_d01",&pdsch_vars[gNB_id]->rxdataF_comp0[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rxF_comp_d10.m","rxF_c_d10",&pdsch_vars[gNB_id]->rxdataF_comp1[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rxF_comp_d11.m","rxF_c_d11",&pdsch_vars[gNB_id]->rxdataF_comp1[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM - } */ - // compute correlation between signal and interference channels (rho12 and rho21) - nr_dlsch_dual_stream_correlation_core(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - &(pdsch_vars[gNB_id]->dl_ch_estimates_ext[2]), - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - n_tx, - n_rx, - pdsch_vars[gNB_id]->log2_maxh, - 2*len, - 0); - //printf("rho stream1 =%d\n", &pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round] ); - nr_dlsch_dual_stream_correlation_core(&(pdsch_vars[gNB_id]->dl_ch_estimates_ext[2]), - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_rho2_ext, - n_tx, - n_rx, - pdsch_vars[gNB_id]->log2_maxh, - 2*len, - 0); - // printf("rho stream2 =%d\n",&pdsch_vars[gNB_id]->dl_ch_rho2_ext ); - //printf("TM3 log2_maxh : %d\n",pdsch_vars[gNB_id]->log2_maxh); - /* if (symbol == 5) { - write_output("rho0_0.m","rho0_0",&pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM - write_output("rho2_0.m","rho2_0",&pdsch_vars[gNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rho0_1.m.m","rho0_1",&pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rho2_1.m","rho2_1",&pdsch_vars[gNB_id]->dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM - } */ - - } + // compute correlation between signal and interference channels (rho12 and rho21) + nr_dlsch_dual_stream_correlation_core(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + &(pdsch_vars[gNB_id]->dl_ch_estimates_ext[2]), + pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], + n_tx, + n_rx, + pdsch_vars[gNB_id]->log2_maxh, + 2*len, + 0); + } #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); @@ -657,35 +550,50 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #endif - if (frame_parms->nb_antennas_rx > 1) { - if (dlsch0_harq->mimo_mode == NR_DUALSTREAM){ - nr_dlsch_detection_mrc_core(pdsch_vars[gNB_id]->rxdataF_comp0, - NULL, - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - pdsch_vars[gNB_id]->dl_ch_rho2_ext, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - NULL, - NULL, - n_tx, - n_rx, - 2*len, - 0); - /* if (symbol == 5) { - write_output("rho0_mrc.m","rho0_0",&pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM - write_output("rho2_mrc.m","rho2_0",&pdsch_vars[gNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - } */ + if (frame_parms->nb_antennas_rx > 1) { + if (dlsch0_harq->mimo_mode<NR_DUALSTREAM) { + nr_dlsch_detection_mrc(pdsch_vars[gNB_id]->rxdataF_comp0, + (n_tx>1)? pdsch_vars[gNB_id]->rho : NULL, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + n_tx, + n_rx, + symbol, + nb_rb); + if (n_tx == 2)//Apply zero forcing for 2 Tx layers + nr_zero_forcing_rx_2layers(pdsch_vars[gNB_id]->rxdataF_comp0, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + nb_rb, + n_rx, + dlsch0_harq->Qm, + pdsch_vars[gNB_id]->log2_maxh, + symbol); } + else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { + nr_dlsch_detection_mrc_core(pdsch_vars[gNB_id]->rxdataF_comp0, + NULL, + pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[gNB_id]->dl_ch_rho2_ext, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + NULL, + NULL, + n_tx, + n_rx, + 2*len, + 0); } - - //printf("start compute LLR\n"); + } + //printf("start compute LLR\n"); if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { rxdataF_comp_ptr = pdsch_vars[gNB_id]->rxdataF_comp1[harq_pid][round]; dl_ch_mag_ptr = pdsch_vars[gNB_id]->dl_ch_mag1[harq_pid][round]; } else { - rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0; - dl_ch_mag_ptr = pdsch_vars[eNB_id_i]->dl_ch_mag0; + rxdataF_comp_ptr = pdsch_vars[gNB_id_i]->rxdataF_comp0; + dl_ch_mag_ptr = pdsch_vars[gNB_id_i]->dl_ch_mag0; //i_mod should have been passed as a parameter } @@ -747,7 +655,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, rxdataF_comp_ptr, dl_ch_mag_ptr, dlsch0_harq, dlsch1_harq, rx_type, harq_pid, - gNB_id, eNB_id_i, + gNB_id, gNB_id_i, first_symbol_flag, i, nb_rb, round, codeword_TB0, codeword_TB1, @@ -868,10 +776,11 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, int **dl_ch_magb, int **dl_ch_magr, int **rxdataF_comp, - int **rho, + int ***rho, NR_DL_FRAME_PARMS *frame_parms, + uint8_t nb_aatx, unsigned char symbol, - uint8_t pilots, + uint8_t pilots, uint8_t first_symbol_flag, unsigned char mod_order, unsigned short nb_rb, @@ -882,12 +791,12 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, #if defined(__i386) || defined(__x86_64) unsigned short rb; - unsigned char aatx,aarx; + unsigned char aatx,aarx,atx; __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*dl_ch_mag128r,*rxdataF128,*rxdataF_comp128,*rho128; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b,QAM_amp128r; QAM_amp128b = _mm_setzero_si128(); - for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) { + for (aatx=0; aatx<nb_aatx; aatx++) { if (mod_order == 4) { QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) QAM_amp128b = _mm_setzero_si128(); @@ -906,13 +815,12 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - dl_ch128 = (__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12]; - dl_ch_mag128 = (__m128i *)&dl_ch_mag[(aatx<<1)+aarx][symbol*nb_rb*12]; - dl_ch_mag128b = (__m128i *)&dl_ch_magb[(aatx<<1)+aarx][symbol*nb_rb*12]; - dl_ch_mag128r = (__m128i *)&dl_ch_magr[(aatx<<1)+aarx][symbol*nb_rb*12]; + dl_ch128 = (__m128i *)&dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; + dl_ch_mag128 = (__m128i *)&dl_ch_mag[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; + dl_ch_mag128b = (__m128i *)&dl_ch_magb[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; + dl_ch_mag128r = (__m128i *)&dl_ch_magr[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*nb_rb*12]; - rxdataF_comp128 = (__m128i *)&rxdataF_comp[(aatx<<1)+aarx][symbol*nb_rb*12]; - + rxdataF_comp128 = (__m128i *)&rxdataF_comp[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; for (rb=0; rb<nb_rb; rb++) { if (mod_order>2) { @@ -997,10 +905,15 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, // print_ints("c0",&mmtmpD2); // print_ints("c1",&mmtmpD3); rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + //printf("arx%d atx%d rb_index %d symbol%d\n",aarx,aatx,rb,symbol); // print_shorts("rx:",rxdataF128); // print_shorts("ch:",dl_ch128); // print_shorts("pack:",rxdataF_comp128); + //printf("arx%d atx%d rb_index %d symbol%d\n",aarx,aatx,rb,symbol); + //print_shorts("rx:",(int16_t*)&rxdataF128[0]); + //print_shorts("ch:",(int16_t*)&dl_ch128[0]); + //print_shorts("pack:",(int16_t*)&rxdataF_comp128[0]); // multiply by conjugated channel mmtmpD0 = _mm_madd_epi16(dl_ch128[1],rxdataF128[1]); // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) @@ -1015,9 +928,9 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - // print_shorts("rx:",rxdataF128+1); - // print_shorts("ch:",dl_ch128+1); - // print_shorts("pack:",rxdataF_comp128+1); + //print_shorts("rx:",(int16_t*)&rxdataF128[1]); + //print_shorts("ch:",(int16_t*)&dl_ch128[1]); + //print_shorts("pack:",(int16_t*)&rxdataF_comp128[1]); if (pilots==0) { // multiply by conjugated channel @@ -1034,9 +947,9 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - // print_shorts("rx:",rxdataF128+2); - // print_shorts("ch:",dl_ch128+2); - // print_shorts("pack:",rxdataF_comp128+2); + //print_shorts("rx:",(int16_t*)&rxdataF128[2]); + //print_shorts("ch:",(int16_t*)&dl_ch128[2]); + //print_shorts("pack:",(int16_t*)&rxdataF_comp128[2]); dl_ch128+=3; dl_ch_mag128+=3; @@ -1044,107 +957,145 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, dl_ch_mag128r+=3; rxdataF128+=3; rxdataF_comp128+=3; - } else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less - dl_ch128+=2; - dl_ch_mag128+=2; - dl_ch_mag128b+=2; - dl_ch_mag128r+=2; - rxdataF128+=2; - rxdataF_comp128+=2; } - + else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less + dl_ch128+=2; + dl_ch_mag128+=2; + dl_ch_mag128b+=2; + dl_ch_mag128r+=2; + rxdataF128+=2; + rxdataF_comp128+=2; + } } } } - if (rho) { + //we compute the Tx correlation matrix for each Rx antenna + //As an example the 2x2 MIMO case requires + //rho[aarx][nb_aatx*nb_aatx] = [cov(H_aarx_0,H_aarx_0) cov(H_aarx_0,H_aarx_1) + // cov(H_aarx_1,H_aarx_0) cov(H_aarx_1,H_aarx_1)], aarx=0,...,nb_antennas_rx-1 + int avg_rho_re[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; + int avg_rho_im[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - rho128 = (__m128i *)&rho[aarx][symbol*frame_parms->N_RB_DL*12]; - dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; - dl_ch128_2 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; - - for (rb=0; rb<nb_rb; rb++) { - // multiply by conjugated channel - mmtmpD0 = _mm_madd_epi16(dl_ch128[0],dl_ch128_2[0]); - // print_ints("re",&mmtmpD0); - - // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); - // print_ints("im",&mmtmpD1); - mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch128_2[0]); - // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); - // print_ints("re(shift)",&mmtmpD0); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); - // print_ints("im(shift)",&mmtmpD1); - mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - // print_ints("c0",&mmtmpD2); - // print_ints("c1",&mmtmpD3); - rho128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - //print_shorts("rx:",dl_ch128_2); - //print_shorts("ch:",dl_ch128); - //print_shorts("pack:",rho128); - - // multiply by conjugated channel - mmtmpD0 = _mm_madd_epi16(dl_ch128[1],dl_ch128_2[1]); - // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); - mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch128_2[1]); - // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); - mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - - - rho128[1] =_mm_packs_epi32(mmtmpD2,mmtmpD3); - //print_shorts("rx:",dl_ch128_2+1); - //print_shorts("ch:",dl_ch128+1); - //print_shorts("pack:",rho128+1); - // multiply by conjugated channel - mmtmpD0 = _mm_madd_epi16(dl_ch128[2],dl_ch128_2[2]); - // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[2],_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); - mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch128_2[2]); - // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); - mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - - rho128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - //print_shorts("rx:",dl_ch128_2+2); - //print_shorts("ch:",dl_ch128+2); - //print_shorts("pack:",rho128+2); - - dl_ch128+=3; - dl_ch128_2+=3; - rho128+=3; - - } - - if (first_symbol_flag==1) { - measurements->rx_correlation[0][aarx] = signal_energy(&rho[aarx][symbol*nb_rb*12],rb*12); + for (aatx=0; aatx<nb_aatx; aatx++) { + dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*nb_rb*12]; + + for (atx=0; atx<nb_aatx; atx++) { + avg_rho_re[aarx][aatx*nb_aatx+atx] = 0; + avg_rho_im[aarx][aatx*nb_aatx+atx] = 0; + rho128 = (__m128i *)&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12]; + dl_ch128_2 = (__m128i *)&dl_ch_estimates_ext[atx*frame_parms->nb_antennas_rx+aarx][symbol*nb_rb*12]; + + for (rb=0; rb<nb_rb; rb++) { + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch128[0],dl_ch128_2[0]); + // print_ints("re",&mmtmpD0); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); + // print_ints("im",&mmtmpD1); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch128_2[0]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + // print_ints("re(shift)",&mmtmpD0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + // print_ints("im(shift)",&mmtmpD1); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + // print_ints("c0",&mmtmpD2); + // print_ints("c1",&mmtmpD3); + rho128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + //print_shorts("rx:",dl_ch128_2); + //print_shorts("ch:",dl_ch128); + //print_shorts("pack:",rho128); + + avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[0])[0]+ + ((int16_t*)&rho128[0])[2] + + ((int16_t*)&rho128[0])[4] + + ((int16_t*)&rho128[0])[6])/16;// + + avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[0])[1]+ + ((int16_t*)&rho128[0])[3] + + ((int16_t*)&rho128[0])[5] + + ((int16_t*)&rho128[0])[7])/16;// + + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch128[1],dl_ch128_2[1]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch128_2[1]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + rho128[1] =_mm_packs_epi32(mmtmpD2,mmtmpD3); + //print_shorts("rx:",dl_ch128_2+1); + //print_shorts("ch:",dl_ch128+1); + //print_shorts("pack:",rho128+1); + + // multiply by conjugated channel + avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[1])[0]+ + ((int16_t*)&rho128[1])[2] + + ((int16_t*)&rho128[1])[4] + + ((int16_t*)&rho128[1])[6])/16; + + avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[1])[1]+ + ((int16_t*)&rho128[1])[3] + + ((int16_t*)&rho128[1])[5] + + ((int16_t*)&rho128[1])[7])/16; + + mmtmpD0 = _mm_madd_epi16(dl_ch128[2],dl_ch128_2[2]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[2],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch128_2[2]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rho128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + //print_shorts("rx:",dl_ch128_2+2); + //print_shorts("ch:",dl_ch128+2); + //print_shorts("pack:",rho128+2); + avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[0]+ + ((int16_t*)&rho128[2])[2] + + ((int16_t*)&rho128[2])[4] + + ((int16_t*)&rho128[2])[6])/16; + + avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[1]+ + ((int16_t*)&rho128[2])[3] + + ((int16_t*)&rho128[2])[5] + + ((int16_t*)&rho128[2])[7])/16; + + dl_ch128+=3; + dl_ch128_2+=3; + rho128+=3; + } + if (first_symbol_flag==1) { + //measurements->rx_correlation[0][0][aarx] = signal_energy(&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12],rb*12); + avg_rho_re[aarx][aatx*nb_aatx+atx] = 16*avg_rho_re[aarx][aatx*nb_aatx+atx]/(nb_rb*12); + avg_rho_im[aarx][aatx*nb_aatx+atx] = 16*avg_rho_im[aarx][aatx*nb_aatx+atx]/(nb_rb*12); + printf("rho[rx]%d tx%d tx%d = Re: %d Im: %d\n",aarx, aatx,atx, avg_rho_re[aarx][aatx*nb_aatx+atx], avg_rho_im[aarx][aatx*nb_aatx+atx]); + } + } } } } - _mm_empty(); _m_empty(); #elif defined(__arm__) - unsigned short rb; unsigned char aatx,aarx,symbol_mod,pilots=0; @@ -1349,7 +1300,7 @@ void nr_dlsch_channel_compensation_core(int **rxdataF_ext, int **dl_ch_mag, int **dl_ch_magb, int **rxdataF_comp, - int **rho, + int ***rho, unsigned char n_tx, unsigned char n_rx, unsigned char mod_order, @@ -1486,7 +1437,7 @@ void nr_dlsch_channel_compensation_core(int **rxdataF_ext, for (aarx=0; aarx<n_rx; aarx++) { - rho128 = (__m128i *)&rho[aarx][start_point]; + rho128 = (__m128i *)&rho[aarx][0][start_point]; dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][start_point]; dl_ch128_2 = (__m128i *)&dl_ch_estimates_ext[2+aarx][start_point]; @@ -1550,6 +1501,8 @@ void nr_dlsch_channel_compensation_core(int **rxdataF_ext, void nr_dlsch_scale_channel(int **dl_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, + uint8_t n_tx, + uint8_t n_rx, NR_UE_DLSCH_t **dlsch_ue, uint8_t symbol, uint8_t pilots, @@ -1574,10 +1527,10 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext, ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 - for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) { - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + for (aatx=0; aatx<n_tx; aatx++) { + for (aarx=0; aarx<n_rx; aarx++) { - dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12]; + dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx*n_rx)+aarx][symbol*nb_rb*12]; for (rb=0;rb<nb_rb_0;rb++) { @@ -1608,6 +1561,7 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext, //compute average channel_level on each (TX,RX) antenna pair void nr_dlsch_channel_level(int **dl_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, + uint8_t n_tx, int32_t *avg, uint8_t symbol, uint32_t len, @@ -1628,22 +1582,21 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, AssertFatal(y!=0,"Cannot divide by zero: in function %s of file %s\n", __func__, __FILE__); - for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) + for (aatx=0; aatx<n_tx; aatx++) for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { //clear average level avg128D = _mm_setzero_si128(); - // 5 is always a symbol with no pilots for both normal and extended prefix - dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12]; + dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; for (rb=0;rb<nb_rb;rb++) { - avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[0],dl_ch128[0]),x)); - avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[1],dl_ch128[1]),x)); - avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x)); - dl_ch128+=3; + avg128D = _mm_add_epi32(avg128D,_mm_srai_epi32(_mm_madd_epi16(dl_ch128[0],dl_ch128[0]),x)); + avg128D = _mm_add_epi32(avg128D,_mm_srai_epi32(_mm_madd_epi16(dl_ch128[1],dl_ch128[1]),x)); + avg128D = _mm_add_epi32(avg128D,_mm_srai_epi32(_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x)); + dl_ch128+=3; } - avg[(aatx<<1)+aarx] =(((int32_t*)&avg128D)[0] + + avg[(aatx*frame_parms->nb_antennas_rx)+aarx] =(((int32_t*)&avg128D)[0] + ((int32_t*)&avg128D)[1] + ((int32_t*)&avg128D)[2] + ((int32_t*)&avg128D)[3])/y; @@ -1729,38 +1682,36 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, int norm_pack; __m128i *dl_ch128, norm128D; - for (aatx=0; aatx<n_tx; aatx++){ + for (aatx=0; aatx<n_tx; aatx++) { for (aarx=0; aarx<n_rx; aarx++) { - max = 0; - min = 0; + max = median[aatx*n_rx + aarx];//initialize the med point for max + min = median[aatx*n_rx + aarx];//initialize the med point for min norm128D = _mm_setzero_si128(); - dl_ch128=(__m128i *)&dl_ch_estimates_ext[aatx*2 + aarx][start_point]; + dl_ch128=(__m128i *)&dl_ch_estimates_ext[aatx*n_rx + aarx][start_point]; - length2 = length>>2; + length2 = length>>2;//length = number of REs, hence length2=nb_REs*(32/128) in SIMD loop for (ii=0;ii<length2;ii++) { - norm128D = _mm_srai_epi32( _mm_madd_epi16(dl_ch128[0],dl_ch128[0]), 1); - //print_ints("norm128D",&norm128D[0]); + norm128D = _mm_srai_epi32( _mm_madd_epi16(dl_ch128[0],dl_ch128[0]), 2);//[|H_0|²/4 |H_1|²/4 |H_2|²/4 |H_3|²/4] + //print_ints("norm128D",&norm128D[0]); norm_pack = ((int32_t*)&norm128D)[0] + - ((int32_t*)&norm128D)[1] + - ((int32_t*)&norm128D)[2] + - ((int32_t*)&norm128D)[3]; + ((int32_t*)&norm128D)[1] + + ((int32_t*)&norm128D)[2] + + ((int32_t*)&norm128D)[3];// compute the sum if (norm_pack > max) - max = norm_pack; + max = norm_pack;//store values more than max if (norm_pack < min) - min = norm_pack; - + min = norm_pack;//store values less than min dl_ch128+=1; } - median[aatx*n_rx + aarx] = (max+min)>>1; - - // printf("Channel level median [%d]: %d\n",aatx*n_rx + aarx, median[aatx*n_rx + aarx]); + median[aatx*n_rx + aarx] = (max+min)>>1; + //printf("Channel level median [%d]: %d max = %d min = %d\n",aatx*n_rx + aarx, median[aatx*n_rx + aarx],max,min); } - } + } _mm_empty(); _m_empty(); @@ -2100,37 +2051,37 @@ void nr_dlsch_detection_mrc_core(int **rxdataF_comp, //============================================================================================== 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, - uint8_t config_type, - unsigned short start_rb, - unsigned short nb_rb_pdsch, - unsigned char nr_slot_rx, - uint32_t high_speed_flag, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos) { - - + uint16_t dlDmrsSymbPos) +{ unsigned short k,rb; - unsigned char i,aarx; //,nsymb,sss_symb,pss_symb=0,l; + unsigned char nushift,i,aarx; int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; int8_t validDmrsEst = 0; //store last DMRS Symbol index unsigned char j=0; - if (config_type==pdsch_dmrs_type1) - AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1, - "nushift %d is illegal\n",frame_parms->nushift); - else - AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 2 || frame_parms->nushift == 4, - "nushift %d is illegal\n",frame_parms->nushift); + if (config_type==pdsch_dmrs_type1) { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1 + + } else { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2 || n_dmrs_cdm_groups == 3, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = (n_dmrs_cdm_groups -1)<<1;//delta in Table 7.4.1.1.2-2 + } for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { @@ -2151,33 +2102,35 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; } if (pilots==0) { - memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); - memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext)); - dl_ch0_ext+=12; - rxF_ext+=12; + memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); + memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext)); + dl_ch0_ext+=12; + rxF_ext+=12; } else {//the symbol contains DMRS j=0; if (config_type==pdsch_dmrs_type1){ - for (i = (1-frame_parms->nushift); i<12; i+=2) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; + if (nushift == 0) {//data is multiplexed + for (i = (1-nushift); i<12; i+=2) { + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j]=dl_ch0[i]; + j++; + } + dl_ch0_ext+=6; + rxF_ext+=6; } - dl_ch0_ext+=6; - rxF_ext+=6; - } else { - for (i = (2+frame_parms->nushift); i<6; i++) { + } else {//pdsch_dmrs_type2 + for (i = (2+nushift); i<6; i++) { rxF_ext[j]=rxF[i]; dl_ch0_ext[j]=dl_ch0[i]; j++; } - for (i = (8+frame_parms->nushift); i<12; i++) { + for (i = (8+nushift); i<12; i++) { rxF_ext[j]=rxF[i]; dl_ch0_ext[j]=dl_ch0[i]; j++; } - dl_ch0_ext+= 8; - rxF_ext+= 8; + dl_ch0_ext+= j; + rxF_ext+= j; } } @@ -2190,104 +2143,782 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, } } } - - - return(nb_rb_pdsch/frame_parms->nb_antennas_rx); + return(nb_rb_pdsch); } -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_slot_rx, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode) { - - int prb,nb_rb=0; - unsigned short k; - int i,j,aarx; - int32_t *dl_ch0=NULL,*dl_ch0_ext=NULL,*dl_ch1=NULL,*dl_ch1_ext=NULL,*rxF=NULL,*rxF_ext=NULL; - - k = frame_parms->first_carrier_offset + 516; //0 +unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + uint8_t Nl, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos) +{ - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + unsigned short k,rb; + unsigned char nushift,j,i,aarx,aatx; + int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; + int8_t validDmrsEst = 0; //store last DMRS Symbol index - if (high_speed_flag==1) { - dl_ch0 = &dl_ch_estimates[aarx][symbol*(frame_parms->ofdm_symbol_size)]; - dl_ch1 = &dl_ch_estimates[2+aarx][symbol*(frame_parms->ofdm_symbol_size)]; - } else { - dl_ch0 = &dl_ch_estimates[aarx][0]; - dl_ch1 = &dl_ch_estimates[2+aarx][0]; - } + if (config_type==pdsch_dmrs_type1) { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1 + } else { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2 || n_dmrs_cdm_groups == 3, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = (n_dmrs_cdm_groups -1)<<1;//delta in Table 7.4.1.1.2-2 + } - //pmi_loc = pmi_ext; + validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos,symbol); - // pointers to extracted RX signals and channel estimates - rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; - dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)]; - dl_ch1_ext = &dl_ch_estimates_ext[2+aarx][symbol*(nb_rb_pdsch*12)]; + for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - for (prb=0; prb<frame_parms->N_RB_DL; prb++) { - //skip_half=0; + k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb; + if (k>frame_parms->ofdm_symbol_size) + k = k-frame_parms->ofdm_symbol_size; - if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs + rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; + rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; - // For second half of RBs skip DC carrier - if (k>=frame_parms->ofdm_symbol_size) { - rxF = &rxdataF[aarx][(symbol*(frame_parms->ofdm_symbol_size))]; - k=k-(frame_parms->ofdm_symbol_size); - } + for (aatx=0; aatx<Nl; aatx++) { - /* - if (mimo_mode <= PUSCH_PRECODING1) - *pmi_loc = (pmi>>((prb>>2)<<1))&3; - else - *pmi_loc=(pmi>>prb)&1;*/ - - // *pmi_loc = get_pmi(frame_parms->N_RB_DL,mimo_mode,pmi,prb); - // pmi_loc++; - - - if (pilots == 0) { - - memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); - memcpy(dl_ch1_ext,dl_ch1,12*sizeof(int)); - memcpy(rxF_ext,rxF,12*sizeof(int)); - dl_ch0_ext +=12; - dl_ch1_ext +=12; - rxF_ext +=12; - } else { // pilots==1 - j=0; - for (i=0; i<12; i++) { - if ((i&1)!=frame_parms->nushift) { - rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0 = &dl_ch_estimates[(aatx*frame_parms->nb_antennas_rx)+aarx][(validDmrsEst*(frame_parms->ofdm_symbol_size))]; + dl_ch0_ext = &dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*(nb_rb_pdsch*NR_NB_SC_PER_RB)]; + + for (rb = 0; rb < nb_rb_pdsch; rb++) + { + if (pilots==0) {//data symbol only + if (aatx==0) {//Extract Rx signal only + memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); + rxF_ext+=12; + } + memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext));//Extract Channel Estimate + dl_ch0_ext+=12; + } + else {//the symbol contains DMRS + j=0; + if (config_type==pdsch_dmrs_type1) { + if (nushift == 0) {//data is multiplexed + for (i = (1-nushift); i<12; i+=2) { + if (aatx==0) rxF_ext[j]=rxF[i]; dl_ch0_ext[j]=dl_ch0[i]; - dl_ch1_ext[j++]=dl_ch1[i]; + j++; } + dl_ch0_ext+=6; + if (aatx==0) rxF_ext+=6; } - dl_ch0_ext+=6; - dl_ch1_ext+=6; - rxF_ext+=6; - } // pilots==1 + } + else {//pdsch_dmrs_type2 + for (i = (2+nushift); i<6; i++) { + if (aatx==0) rxF_ext[j]=rxF[i]; + dl_ch0_ext[j]=dl_ch0[i]; + j++; + } + for (i = (8+nushift); i<12; i++) { + if (aatx==0) rxF_ext[j]=rxF[i]; + dl_ch0_ext[j]=dl_ch0[i]; + j++; + } + dl_ch0_ext+= j; + if (aatx==0) rxF_ext+= j; + } + } - dl_ch0+=12; - dl_ch1+=12; + dl_ch0+=12; + if (aatx==0) { rxF+=12; k+=12; + if (k>=frame_parms->ofdm_symbol_size) { + k=k-(frame_parms->ofdm_symbol_size); + rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))]; + } + } + }//rb + }//aatx + }//aarx + return(nb_rb_pdsch); +} + +void nr_dlsch_detection_mrc(int **rxdataF_comp, + int ***rho, + int **dl_ch_mag, + int **dl_ch_magb, + short n_tx, + short n_rx, + unsigned char symbol, + unsigned short nb_rb) { +#if defined(__x86_64__)||defined(__i386__) + unsigned char aatx, aarx; + int i; + __m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b; + + if (n_rx>1) { + for (aatx=0; aatx<n_tx; aatx++) { + rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[(aatx*n_rx)][symbol*nb_rb*12];//aarx=0 + dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[(aatx*n_rx)][symbol*nb_rb*12];//aarx=0 + dl_ch_mag128_0b = (__m128i *)&dl_ch_magb[(aatx*n_rx)][symbol*nb_rb*12]; + for (aarx=1; aarx<n_rx; aarx++) { + rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[(aatx*n_rx)+aarx][symbol*nb_rb*12];// aarx=1,..., n_rx-1 + dl_ch_mag128_1 = (__m128i *)&dl_ch_mag[(aatx*n_rx)+aarx][symbol*nb_rb*12]; + dl_ch_mag128_1b = (__m128i *)&dl_ch_magb[(aatx*n_rx)+aarx][symbol*nb_rb*12]; + + // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) + for (i=0; i<nb_rb*3; i++) { + rxdataF_comp128_0[i] = _mm_adds_epi16(rxdataF_comp128_0[i],rxdataF_comp128_1[i]); + dl_ch_mag128_0[i] = _mm_adds_epi16(dl_ch_mag128_0[i],dl_ch_mag128_1[i]); + dl_ch_mag128_0b[i] = _mm_adds_epi16(dl_ch_mag128_0b[i],dl_ch_mag128_1b[i]); + /*if (i==0) { + * printf("atx%d symbol%d\n",aatx,symbol); + * printf("mrc comp0 re: %d mrc comp0 im: %d \n",((int16_t*)&rxdataF_comp128_0[0])[0],((int16_t*)&rxdataF_comp128_0[0])[1]); + * printf("mrc mag0 = %d = %d \n",((int16_t*)&dl_ch_mag128_0[0])[0],((int16_t*)&dl_ch_mag128_0[0])[1]); + * printf("mrc mag0b = %d = %d \n",((int16_t*)&dl_ch_mag128_0b[0])[0],((int16_t*)&dl_ch_mag128_0b[0])[1]); + * }*/ + } + } + } + if (rho) { + /*rho128_0 = (__m128i *) &rho[0][symbol*frame_parms->N_RB_DL*12]; + rho128_1 = (__m128i *) &rho[1][symbol*frame_parms->N_RB_DL*12]; + for (i=0; i<nb_rb*3; i++) { + // print_shorts("mrc rho0:",&rho128_0[i]); + // print_shorts("mrc rho1:",&rho128_1[i]); + rho128_0[i] = _mm_adds_epi16(_mm_srai_epi16(rho128_0[i],1),_mm_srai_epi16(rho128_1[i],1)); + }*/ } - } // for prb - } // for aarx - return(nb_rb/frame_parms->nb_antennas_rx); + _mm_empty(); + _m_empty(); + } +#endif +} + +/* Zero Forcing Rx function: nr_det_HhH() + * + * + * */ +void nr_det_HhH(int32_t *after_mf_00,//a + int32_t *after_mf_01,//b + int32_t *after_mf_10,//c + int32_t *after_mf_11,//d + int32_t *det_fin,//1/ad-bc + unsigned short nb_rb, + unsigned char symbol) +{ + int16_t nr_conjug2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; + unsigned short rb; + __m128i *after_mf_00_128,*after_mf_01_128, *after_mf_10_128, *after_mf_11_128, ad_re_128, bc_re_128; //ad_im_128, bc_im_128; + __m128i *det_fin_128, det_re_128; //det_im_128, tmp_det0, tmp_det1; + + after_mf_00_128 = (__m128i *)after_mf_00; + after_mf_01_128 = (__m128i *)after_mf_01; + after_mf_10_128 = (__m128i *)after_mf_10; + after_mf_11_128 = (__m128i *)after_mf_11; + + det_fin_128 = (__m128i *)det_fin; + + for (rb=0; rb<3*nb_rb; rb++) { + + //complex multiplication (I_a+jQ_a)(I_d+jQ_d) = (I_aI_d - Q_aQ_d) + j(Q_aI_d + I_aQ_d) + //The imag part is often zero, we compute only the real part + ad_re_128 = _mm_sign_epi16(after_mf_00_128[0],*(__m128i*)&nr_conjug2[0]); + ad_re_128 = _mm_madd_epi16(ad_re_128,after_mf_11_128[0]); //Re: I_a0*I_d0 - Q_a1*Q_d1 + //ad_im_128 = _mm_shufflelo_epi16(after_mf_00_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits + //ad_im_128 = _mm_shufflehi_epi16(ad_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits + //ad_im_128 = _mm_madd_epi16(ad_im_128,after_mf_11_128[0]);//Im: (Q_aI_d + I_aQ_d) + + //complex multiplication (I_b+jQ_b)(I_c+jQ_c) = (I_bI_c - Q_bQ_c) + j(Q_bI_c + I_bQ_c) + //The imag part is often zero, we compute only the real part + bc_re_128 = _mm_sign_epi16(after_mf_01_128[0],*(__m128i*)&nr_conjug2[0]); + bc_re_128 = _mm_madd_epi16(bc_re_128,after_mf_10_128[0]); //Re: I_b0*I_c0 - Q_b1*Q_c1 + //bc_im_128 = _mm_shufflelo_epi16(after_mf_01_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits + //bc_im_128 = _mm_shufflehi_epi16(bc_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits + //bc_im_128 = _mm_madd_epi16(bc_im_128,after_mf_10_128[0]);//Im: (Q_bI_c + I_bQ_c) + + det_re_128 = _mm_sub_epi32(ad_re_128, bc_re_128); + //det_im_128 = _mm_sub_epi32(ad_im_128, bc_im_128); + + //convert back to Q15 before packing + det_re_128 = _mm_srai_epi32(det_re_128,8);//(2^15/64*2) + //det_im_128 = _mm_srai_epi32(det_im_128,8); + + //tmp_det0 = _mm_unpacklo_epi32(det_re_128,det_im_128); + ////print_ints("unpack lo:",&tmp_det0[rb]); + //tmp_det1 = _mm_unpackhi_epi32(det_re_128,det_im_128); + ////print_ints("unpack hi:",&tmp_det1[rb]); + //det_matrix_128[0] = _mm_packs_epi32(tmp_det0,tmp_det1); + det_fin_128[0] = _mm_abs_epi32(det_re_128); + + /*if ((rb==0)&&(symbol==1)) { + * printf("\n Computing det_HhH_inv \n"); + * print_ints("det_re_128:",(int32_t*)&det_re_128); + * print_ints("det_im_128:",(int32_t*)&det_im_128); + * print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]); + * }*/ + + det_fin_128+=1; + after_mf_00_128+=1; + after_mf_01_128+=1; + after_mf_10_128+=1; + after_mf_11_128+=1; + } + _mm_empty(); + _m_empty(); +} + +/* Zero Forcing Rx function: nr_inv_comp_muli + * Complex number multi: z = x*y + * = (x_re*y_re - x_im*y_im) + j(x_im*y_re + x_re*y_im) + * */ +__m128i nr_inv_comp_muli(__m128i input_x, + __m128i input_y) +{ + int16_t nr_conjug2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; + + __m128i xy_re_128, xy_im_128; + __m128i output_z, tmp_z0, tmp_z1; + + // complex multiplication (x_re + jx_im)*(y_re + jy_im) = (x_re*y_re - x_im*y_im) + j(x_im*y_re + x_re*y_im) + + // the real part + xy_re_128 = _mm_sign_epi16(input_x,*(__m128i*)&nr_conjug2[0]); + xy_re_128 = _mm_madd_epi16(xy_re_128,input_y); //Re: (x_re*y_re - x_im*y_im) + + // the imag part + xy_im_128 = _mm_shufflelo_epi16(input_x,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits + xy_im_128 = _mm_shufflehi_epi16(xy_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits + xy_im_128 = _mm_madd_epi16(xy_im_128,input_y);//Im: (x_im*y_re + x_re*y_im) + + //convert back to Q15 before packing + xy_re_128 = _mm_srai_epi32(xy_re_128,4);//(2^15/64*2*16) + xy_im_128 = _mm_srai_epi32(xy_im_128,4); + + tmp_z0 = _mm_unpacklo_epi32(xy_re_128,xy_im_128); + //print_ints("unpack lo:",&tmp_z0[0]); + tmp_z1 = _mm_unpackhi_epi32(xy_re_128,xy_im_128); + //print_ints("unpack hi:",&tmp_z1[0]); + output_z = _mm_packs_epi32(tmp_z0,tmp_z1); + + _mm_empty(); + _m_empty(); + return(output_z); } +/* Zero Forcing Rx function: nr_conjch0_mult_ch1() + * + * + * */ +void nr_conjch0_mult_ch1(int *ch0, + int *ch1, + int32_t *ch0conj_ch1, + unsigned short nb_rb, + unsigned char output_shift0) +{ + //This function is used to compute multiplications in H_hermitian * H matrix + short nr_conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; + unsigned short rb; + __m128i *dl_ch0_128,*dl_ch1_128, *ch0conj_ch1_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; + + dl_ch0_128 = (__m128i *)ch0; + dl_ch1_128 = (__m128i *)ch1; + + ch0conj_ch1_128 = (__m128i *)ch0conj_ch1; + + for (rb=0; rb<3*nb_rb; rb++) { + + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]); + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[0],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&nr_conjugate[0]); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch1_128[0]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + ch0conj_ch1_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + + /*printf("\n Computing conjugates \n"); + print_shorts("ch0:",(int16_t*)&dl_ch0_128[0]); + print_shorts("ch1:",(int16_t*)&dl_ch1_128[0]); + print_shorts("pack:",(int16_t*)&ch0conj_ch1_128[0]);*/ + + dl_ch0_128+=1; + dl_ch1_128+=1; + ch0conj_ch1_128+=1; + } + _mm_empty(); + _m_empty(); +} + +/* Zero Forcing Rx function: nr_construct_HhH_elements() + * + * + * */ +void nr_construct_HhH_elements(int *conjch00_ch00, + int *conjch01_ch01, + int *conjch11_ch11, + int *conjch10_ch10,// + int *conjch20_ch20, + int *conjch21_ch21, + int *conjch30_ch30, + int *conjch31_ch31, + int *conjch00_ch01,//00_01 + int *conjch01_ch00,//01_00 + int *conjch10_ch11,//10_11 + int *conjch11_ch10,//11_10 + int *conjch20_ch21, + int *conjch21_ch20, + int *conjch30_ch31, + int *conjch31_ch30, + int32_t *after_mf_00, + int32_t *after_mf_01, + int32_t *after_mf_10, + int32_t *after_mf_11, + unsigned short nb_rb, + unsigned char symbol) +{ + //This function is used to construct the (H_hermitian * H matrix) matrix elements + unsigned short rb; + __m128i *conjch00_ch00_128, *conjch01_ch01_128, *conjch11_ch11_128, *conjch10_ch10_128; + __m128i *conjch20_ch20_128, *conjch21_ch21_128, *conjch30_ch30_128, *conjch31_ch31_128; + __m128i *conjch00_ch01_128, *conjch01_ch00_128, *conjch10_ch11_128, *conjch11_ch10_128; + __m128i *conjch20_ch21_128, *conjch21_ch20_128, *conjch30_ch31_128, *conjch31_ch30_128; + __m128i *after_mf_00_128, *after_mf_01_128, *after_mf_10_128, *after_mf_11_128; + + conjch00_ch00_128 = (__m128i *)conjch00_ch00; + conjch01_ch01_128 = (__m128i *)conjch01_ch01; + conjch11_ch11_128 = (__m128i *)conjch11_ch11; + conjch10_ch10_128 = (__m128i *)conjch10_ch10; + + conjch20_ch20_128 = (__m128i *)conjch20_ch20; + conjch21_ch21_128 = (__m128i *)conjch21_ch21; + conjch30_ch30_128 = (__m128i *)conjch30_ch30; + conjch31_ch31_128 = (__m128i *)conjch31_ch31; + + conjch00_ch01_128 = (__m128i *)conjch00_ch01; + conjch01_ch00_128 = (__m128i *)conjch01_ch00; + conjch10_ch11_128 = (__m128i *)conjch10_ch11; + conjch11_ch10_128 = (__m128i *)conjch11_ch10; + + conjch20_ch21_128 = (__m128i *)conjch20_ch21; + conjch21_ch20_128 = (__m128i *)conjch21_ch20; + conjch30_ch31_128 = (__m128i *)conjch30_ch31; + conjch31_ch30_128 = (__m128i *)conjch31_ch30; + + after_mf_00_128 = (__m128i *)after_mf_00; + after_mf_01_128 = (__m128i *)after_mf_01; + after_mf_10_128 = (__m128i *)after_mf_10; + after_mf_11_128 = (__m128i *)after_mf_11; + + for (rb=0; rb<3*nb_rb; rb++) { + + after_mf_00_128[0] =_mm_adds_epi16(conjch00_ch00_128[0],conjch10_ch10_128[0]);//00_00 + 10_10 + if (conjch20_ch20 != NULL) after_mf_00_128[0] =_mm_adds_epi16(after_mf_00_128[0],conjch20_ch20_128[0]); + if (conjch30_ch30 != NULL) after_mf_00_128[0] =_mm_adds_epi16(after_mf_00_128[0],conjch30_ch30_128[0]); + + after_mf_11_128[0] =_mm_adds_epi16(conjch01_ch01_128[0], conjch11_ch11_128[0]); //01_01 + 11_11 + if (conjch21_ch21 != NULL) after_mf_11_128[0] =_mm_adds_epi16(after_mf_11_128[0],conjch21_ch21_128[0]); + if (conjch31_ch31 != NULL) after_mf_11_128[0] =_mm_adds_epi16(after_mf_11_128[0],conjch31_ch31_128[0]); + + after_mf_01_128[0] =_mm_adds_epi16(conjch00_ch01_128[0], conjch10_ch11_128[0]);//00_01 + 10_11 + if (conjch20_ch21 != NULL) after_mf_01_128[0] =_mm_adds_epi16(after_mf_01_128[0],conjch20_ch21_128[0]); + if (conjch30_ch31 != NULL) after_mf_01_128[0] =_mm_adds_epi16(after_mf_01_128[0],conjch30_ch31_128[0]); + + after_mf_10_128[0] =_mm_adds_epi16(conjch01_ch00_128[0], conjch11_ch10_128[0]);//01_00 + 11_10 + if (conjch21_ch20 != NULL) after_mf_10_128[0] =_mm_adds_epi16(after_mf_10_128[0],conjch21_ch20_128[0]); + if (conjch31_ch30 != NULL) after_mf_10_128[0] =_mm_adds_epi16(after_mf_10_128[0],conjch31_ch30_128[0]); + + /*if ((rb==0)&&(symbol==1)) + { + printf(" \n construct_HhH_elements \n"); + print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]); + print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]); + print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]); + print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]); + }*/ + + conjch00_ch00_128+=1; + conjch10_ch10_128+=1; + conjch01_ch01_128+=1; + conjch11_ch11_128+=1; + + if (conjch20_ch20 != NULL) conjch20_ch20_128+=1; + if (conjch21_ch21 != NULL) conjch21_ch21_128+=1; + if (conjch30_ch30 != NULL) conjch30_ch30_128+=1; + if (conjch31_ch31 != NULL) conjch31_ch31_128+=1; + + conjch00_ch01_128+=1; + conjch01_ch00_128+=1; + conjch10_ch11_128+=1; + conjch11_ch10_128+=1; + + if (conjch20_ch21 != NULL) conjch20_ch21_128+=1; + if (conjch21_ch20 != NULL) conjch21_ch20_128+=1; + if (conjch30_ch31 != NULL) conjch30_ch31_128+=1; + if (conjch31_ch30 != NULL) conjch31_ch30_128+=1; + + after_mf_00_128 += 1; + after_mf_01_128 += 1; + after_mf_10_128 += 1; + after_mf_11_128 += 1; + } + _mm_empty(); + _m_empty(); +} + +/* Zero Forcing Rx function: nr_zero_forcing_rx_2layers() + * + * + * */ +uint8_t nr_zero_forcing_rx_2layers(int **rxdataF_comp, + int **dl_ch_mag, + int **dl_ch_magb, + int **dl_ch_estimates_ext, + unsigned short nb_rb, + unsigned char n_rx, + unsigned char mod_order, + int shift, + unsigned char symbol) +{ + int *ch00, *ch01, *ch10, *ch11; + int *ch20, *ch30, *ch21, *ch31; + + /* we need at least alignment to 16 bytes, let's put 32 to be sure + * (maybe not necessary but doesn't hurt) + */ + int32_t conjch00_ch01[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch01_ch00[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch10_ch11[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch11_ch10[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch00_ch00[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch01_ch01[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch10_ch10[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch11_ch11[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch20_ch20[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch21_ch21[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch30_ch30[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch31_ch31[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch20_ch21[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch30_ch31[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch21_ch20[12*nb_rb] __attribute__((aligned(32))); + int32_t conjch31_ch30[12*nb_rb] __attribute__((aligned(32))); + + int32_t af_mf_00[12*nb_rb] __attribute__((aligned(32))); + int32_t af_mf_01[12*nb_rb] __attribute__((aligned(32))); + int32_t af_mf_10[12*nb_rb] __attribute__((aligned(32))); + int32_t af_mf_11[12*nb_rb] __attribute__((aligned(32))); + int32_t determ_fin[12*nb_rb] __attribute__((aligned(32))); + + switch (n_rx) { + case 2:// + ch00 = (int *)&dl_ch_estimates_ext[0][symbol*nb_rb*12]; + ch01 = (int *)&dl_ch_estimates_ext[2][symbol*nb_rb*12]; + ch10 = (int *)&dl_ch_estimates_ext[1][symbol*nb_rb*12]; + ch11 = (int *)&dl_ch_estimates_ext[3][symbol*nb_rb*12]; + ch20 = NULL; + ch21 = NULL; + ch30 = NULL; + ch31 = NULL; + break; + + case 4:// + ch00 = (int *)&dl_ch_estimates_ext[0][symbol*nb_rb*12]; + ch01 = (int *)&dl_ch_estimates_ext[4][symbol*nb_rb*12]; + ch10 = (int *)&dl_ch_estimates_ext[1][symbol*nb_rb*12]; + ch11 = (int *)&dl_ch_estimates_ext[5][symbol*nb_rb*12]; + ch20 = (int *)&dl_ch_estimates_ext[2][symbol*nb_rb*12]; + ch21 = (int *)&dl_ch_estimates_ext[6][symbol*nb_rb*12]; + ch30 = (int *)&dl_ch_estimates_ext[3][symbol*nb_rb*12]; + ch31 = (int *)&dl_ch_estimates_ext[7][symbol*nb_rb*12]; + break; + + default: + return -1; + break; + } + + /* 1- Compute the rx channel matrix after compensation: (1/2^log2_max)x(H_herm x H) + * for n_rx = 2 + * |conj_H_00 conj_H_10| | H_00 H_01| |(conj_H_00xH_00+conj_H_10xH_10) (conj_H_00xH_01+conj_H_10xH_11)| + * | | x | | = | | + * |conj_H_01 conj_H_11| | H_10 H_11| |(conj_H_01xH_00+conj_H_11xH_10) (conj_H_01xH_01+conj_H_11xH_11)| + * + */ + + if (n_rx>=2){ + // (1/2^log2_maxh)*conj_H_00xH_00: (1/(64*2))conjH_00*H_00*2^15 + nr_conjch0_mult_ch1(ch00, + ch00, + conjch00_ch00, + nb_rb, + shift); + // (1/2^log2_maxh)*conj_H_10xH_10: (1/(64*2))conjH_10*H_10*2^15 + nr_conjch0_mult_ch1(ch10, + ch10, + conjch10_ch10, + nb_rb, + shift); + // conj_H_00xH_01 + nr_conjch0_mult_ch1(ch00, + ch01, + conjch00_ch01, + nb_rb, + shift); // this shift is equal to the channel level log2_maxh + // conj_H_10xH_11 + nr_conjch0_mult_ch1(ch10, + ch11, + conjch10_ch11, + nb_rb, + shift); + // conj_H_01xH_01 + nr_conjch0_mult_ch1(ch01, + ch01, + conjch01_ch01, + nb_rb, + shift); + // conj_H_11xH_11 + nr_conjch0_mult_ch1(ch11, + ch11, + conjch11_ch11, + nb_rb, + shift); + // conj_H_01xH_00 + nr_conjch0_mult_ch1(ch01, + ch00, + conjch01_ch00, + nb_rb, + shift); + // conj_H_11xH_10 + nr_conjch0_mult_ch1(ch11, + ch10, + conjch11_ch10, + nb_rb, + shift); + } + if (n_rx==4){ + // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2*16))conjH_20*H_20*2^15 + nr_conjch0_mult_ch1(ch20, + ch20, + conjch20_ch20, + nb_rb, + shift); + + // (1/2^log2_maxh)*conj_H_30xH_30: (1/(64*2*4))conjH_30*H_30*2^15 + nr_conjch0_mult_ch1(ch30, + ch30, + conjch30_ch30, + nb_rb, + shift); + + // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2))conjH_20*H_20*2^15 + nr_conjch0_mult_ch1(ch20, + ch21, + conjch20_ch21, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch30, + ch31, + conjch30_ch31, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch21, + ch21, + conjch21_ch21, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch31, + ch31, + conjch31_ch31, + nb_rb, + shift); + + // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2))conjH_20*H_20*2^15 + nr_conjch0_mult_ch1(ch21, + ch20, + conjch21_ch20, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch31, + ch30, + conjch31_ch30, + nb_rb, + shift); + + nr_construct_HhH_elements(conjch00_ch00, + conjch01_ch01, + conjch11_ch11, + conjch10_ch10,// + conjch20_ch20, + conjch21_ch21, + conjch30_ch30, + conjch31_ch31, + conjch00_ch01, + conjch01_ch00, + conjch10_ch11, + conjch11_ch10,// + conjch20_ch21, + conjch21_ch20, + conjch30_ch31, + conjch31_ch30, + af_mf_00, + af_mf_01, + af_mf_10, + af_mf_11, + nb_rb, + symbol); + } + if (n_rx==2){ + nr_construct_HhH_elements(conjch00_ch00, + conjch01_ch01, + conjch11_ch11, + conjch10_ch10,// + NULL, + NULL, + NULL, + NULL, + conjch00_ch01, + conjch01_ch00, + conjch10_ch11, + conjch11_ch10,// + NULL, + NULL, + NULL, + NULL, + af_mf_00, + af_mf_01, + af_mf_10, + af_mf_11, + nb_rb, + symbol); + } + //det_HhH = ad -bc + nr_det_HhH(af_mf_00,//a + af_mf_01,//b + af_mf_10,//c + af_mf_11,//d + determ_fin, + nb_rb, + symbol); + /* 2- Compute the channel matrix inversion ********************************** + * + * |(conj_H_00xH_00+conj_H_10xH_10) (conj_H_00xH_01+conj_H_10xH_11)| + * A= | | + * |(conj_H_01xH_00+conj_H_11xH_10) (conj_H_01xH_01+conj_H_11xH_11)| + * + * + * + *inv(A) =(1/det)*[d -b + * -c a] + * + * + **************************************************************************/ + __m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128b_0,*dl_ch_mag128_1,*dl_ch_mag128b_1,*determ_fin_128; + __m128i mmtmpD2,mmtmpD3,mmtmpD0,mmtmpD1,QAM_amp128,QAM_amp128b; + __m128i *after_mf_a_128,*after_mf_b_128, *after_mf_c_128, *after_mf_d_128; + + determ_fin_128 = (__m128i *)&determ_fin[0]; + + rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[0][symbol*nb_rb*12];//aatx=0 @ aarx =0 + rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[n_rx][symbol*nb_rb*12];//aatx=1 @ aarx =0 + + dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[0][symbol*nb_rb*12]; + dl_ch_mag128_1 = (__m128i *)&dl_ch_mag[n_rx][symbol*nb_rb*12]; + dl_ch_mag128b_0 = (__m128i *)&dl_ch_magb[0][symbol*nb_rb*12]; + dl_ch_mag128b_1 = (__m128i *)&dl_ch_magb[n_rx][symbol*nb_rb*12]; + + after_mf_a_128 = (__m128i *)af_mf_00; + after_mf_b_128 = (__m128i *)af_mf_01; + after_mf_c_128 = (__m128i *)af_mf_10; + after_mf_d_128 = (__m128i *)af_mf_11; + + QAM_amp128b = _mm_setzero_si128(); + + if (mod_order == 4) { + QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) + QAM_amp128b = _mm_setzero_si128(); + } else if (mod_order == 6) { + QAM_amp128 = _mm_set1_epi16(QAM64_n1); // + QAM_amp128b = _mm_set1_epi16(QAM64_n2); + } + + for (int rb=0; rb<3*nb_rb; rb++) { + if (mod_order>2) { + // get channel determ (da -bc) if not QPSK + mmtmpD0 = _mm_packs_epi32(determ_fin_128[0],determ_fin_128[0]);//convert 32 bits to 16 bits + + dl_ch_mag128_0[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag128b_0[0] = dl_ch_mag128_0[0]; + + dl_ch_mag128_0[0] = _mm_mulhi_epi16(dl_ch_mag128_0[0],QAM_amp128); + dl_ch_mag128_0[0] = _mm_slli_epi16(dl_ch_mag128_0[0],1);//aatx=0 @ aarx =0 + dl_ch_mag128_1[0] = dl_ch_mag128_0[0];//aatx=1 @ aarx =0 + + dl_ch_mag128b_0[0] = _mm_mulhi_epi16(dl_ch_mag128b_0[0],QAM_amp128b); + dl_ch_mag128b_0[0] = _mm_slli_epi16(dl_ch_mag128b_0[0],1);//aatx=0 @ aarx = + dl_ch_mag128b_1[0] = dl_ch_mag128b_0[0];//aatx=1 @ aarx =0 + + if ((rb==0)&&(symbol==1)) { + printf("\n Signal mag after ZF \n"); + print_shorts("mag layer 1:",(int16_t*)&dl_ch_mag128_0[0]); + print_shorts("mag layer 2:",(int16_t*)&dl_ch_mag128_1[0]); + print_shorts("magb layer 1:",(int16_t*)&dl_ch_mag128b_0[0]); + print_shorts("magb layer 2:",(int16_t*)&dl_ch_mag128b_1[0]); + } + } + // multiply by channel Inv + //rxdataF_zf128_0 = rxdataF_comp128_0*d - b*rxdataF_comp128_1 + //rxdataF_zf128_1 = rxdataF_comp128_1*a - c*rxdataF_comp128_0 + mmtmpD2 = nr_inv_comp_muli(rxdataF_comp128_0[0],//x + after_mf_d_128[0]);//y + mmtmpD3 = nr_inv_comp_muli(rxdataF_comp128_1[0],//x + after_mf_b_128[0]);//y + //mmtmpD2[0] - mmtmpD3[0] + //rxdataF_zf128_0 + mmtmpD0 = _mm_sub_epi16(mmtmpD2, mmtmpD3); + + mmtmpD2 = nr_inv_comp_muli(rxdataF_comp128_1[0],//x + after_mf_a_128[0]);//y + mmtmpD3 = nr_inv_comp_muli(rxdataF_comp128_0[0],//x + after_mf_c_128[0]);//y + //mmtmpD2[0] - mmtmpD3[0] + //rxdataF_zf128_1 + mmtmpD1 = _mm_sub_epi16(mmtmpD2, mmtmpD3); + + rxdataF_comp128_0[0] = mmtmpD0; + rxdataF_comp128_1[0] = mmtmpD1; + + /*if ((rb==0)&&(symbol==1)) { + printf("\n Rx signal after ZF \n"); + print_shorts("Rx layer 1:",(int16_t*)&rxdataF_comp128_0[0]); + print_shorts("Rx layer 2:",(int16_t*)&rxdataF_comp128_1[0]); + }*/ + + determ_fin_128 += 1; + dl_ch_mag128_0 += 1; + dl_ch_mag128b_0 += 1; + dl_ch_mag128_1 += 1; + dl_ch_mag128b_1 += 1; + rxdataF_comp128_0 += 1; + rxdataF_comp128_1 += 1; + after_mf_a_128 += 1; + after_mf_b_128 += 1; + after_mf_c_128 += 1; + after_mf_d_128 += 1; + } + _mm_empty(); + _m_empty(); + return(0); +} static void nr_dlsch_layer_demapping(int16_t **llr_cw, uint8_t Nl, @@ -2327,7 +2958,7 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, RX_type_t rx_type, unsigned char harq_pid, unsigned char gNB_id, - unsigned char eNB_id_i, + unsigned char gNB_id_i, unsigned char first_symbol_flag, unsigned char symbol, unsigned short nb_rb, @@ -2736,10 +3367,8 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, } //============================================================================================== -#ifdef USER_MODE - -void dump_dlsch2(PHY_VARS_UE *ue,uint8_t gNB_id,uint8_t nr_slot_rx,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid) +void dump_nrdlsch(PHY_VARS_NR_UE *ue,uint8_t gNB_id,uint8_t nr_slot_rx,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid) { unsigned int nsymb = (ue->frame_parms.Ncp == 0) ? 14 : 12; char fname[32],vname[32]; @@ -2747,50 +3376,50 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t gNB_id,uint8_t nr_slot_rx,unsigned int snprintf(fname, 32, "dlsch%d_rxF_r%d_ext0.m", gNB_id, round); snprintf(vname, 32, "dl%d_rxF_r%d_ext0", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb,1,1); if (ue->frame_parms.nb_antennas_rx >1) { snprintf(fname, 32, "dlsch%d_rxF_r%d_ext1.m", gNB_id, round); snprintf(vname, 32, "dl%d_rxF_r%d_ext1", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_ext[1],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->rxdataF_ext[1],12*N_RB_DL*nsymb,1,1); } snprintf(fname, 32, "dlsch%d_ch_r%d_ext00.m", gNB_id, round); snprintf(vname, 32, "dl%d_ch_r%d_ext00", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); if (ue->transmission_mode[gNB_id]==7){ snprintf(fname, 32, "dlsch%d_bf_ch_r%d.m", gNB_id, round); snprintf(vname, 32, "dl%d_bf_ch_r%d", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_bf_ch_estimates[0],512*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_bf_ch_estimates[0],512*nsymb,1,1); //write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[gNB_id]->dl_bf_ch_estimates[0],512,1,1); snprintf(fname, 32, "dlsch%d_bf_ch_r%d_ext00.m", gNB_id, round); snprintf(vname, 32, "dl%d_bf_ch_r%d_ext00", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_bf_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_bf_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); } if (ue->frame_parms.nb_antennas_rx == 2) { snprintf(fname, 32, "dlsch%d_ch_r%d_ext01.m", gNB_id, round); snprintf(vname, 32, "dl%d_ch_r%d_ext01", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); } if (ue->frame_parms.nb_antenna_ports_gNB == 2) { snprintf(fname, 32, "dlsch%d_ch_r%d_ext10.m", gNB_id, round); snprintf(vname, 32, "dl%d_ch_r%d_ext10", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); if (ue->frame_parms.nb_antennas_rx == 2) { snprintf(fname, 32, "dlsch%d_ch_r%d_ext11.m",gNB_id,round); snprintf(vname, 32, "dl%d_ch_r%d_ext11",gNB_id,round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1); } } snprintf(fname, 32, "dlsch%d_rxF_r%d_uespec0.m", gNB_id, round); snprintf(vname, 32, "dl%d_rxF_r%d_uespec0", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_uespec_pilots[0],12*N_RB_DL,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->rxdataF_uespec_pilots[0],12*N_RB_DL,1,1); /* write_output("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[gNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); @@ -2800,35 +3429,35 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t gNB_id,uint8_t nr_slot_rx,unsigned int snprintf(fname, 32, "dlsch%d_r%d_rho.m", gNB_id, round); snprintf(vname, 32, "dl_rho_r%d_%d", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_rho_ext[harq_pid][round][0],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_ch_rho_ext[harq_pid][round][0],12*N_RB_DL*nsymb,1,1); snprintf(fname, 32, "dlsch%d_r%d_rho2.m", gNB_id, round); snprintf(vname, 32, "dl_rho2_r%d_%d", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_rho2_ext[0],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->dl_ch_rho2_ext[0],12*N_RB_DL*nsymb,1,1); snprintf(fname, 32, "dlsch%d_rxF_r%d_comp0.m", gNB_id, round); snprintf(vname, 32, "dl%d_rxF_r%d_comp0", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1); if (ue->frame_parms.nb_antenna_ports_gNB == 2) { snprintf(fname, 32, "dlsch%d_rxF_r%d_comp1.m", gNB_id, round); snprintf(vname, 32, "dl%d_rxF_r%d_comp1", gNB_id, round); - write_output(fname,vname,ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_comp1[harq_pid][round][0],12*N_RB_DL*nsymb,1,1); + write_output(fname,vname,ue->pdsch_vars[0][gNB_id]->rxdataF_comp1[harq_pid][round][0],12*N_RB_DL*nsymb,1,1); } snprintf(fname, 32, "dlsch%d_rxF_r%d_llr.m", gNB_id, round); snprintf(vname, 32, "dl%d_r%d_llr", gNB_id, round); - write_output(fname, vname, ue->pdsch_vars[proc->thread_id][gNB_id]->llr[0], coded_bits_per_codeword[0], 1, 0); + write_output(fname, vname, ue->pdsch_vars[0][gNB_id]->llr[0], coded_bits_per_codeword[0], 1, 0); snprintf(fname, 32, "dlsch%d_r%d_mag1.m", gNB_id, round); snprintf(vname, 32, "dl%d_r%d_mag1", gNB_id, round); - write_output(fname, vname, ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_mag0[0], 12*N_RB_DL*nsymb, 1, 1); + write_output(fname, vname, ue->pdsch_vars[0][gNB_id]->dl_ch_mag0[0], 12*N_RB_DL*nsymb, 1, 1); snprintf(fname, 32, "dlsch%d_r%d_mag2.m", gNB_id, round); snprintf(vname, 32, "dl%d_r%d_mag2", gNB_id, round); - write_output(fname, vname, ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_magb0[0], 12*N_RB_DL*nsymb, 1, 1); + write_output(fname, vname, ue->pdsch_vars[0][gNB_id]->dl_ch_magb0[0], 12*N_RB_DL*nsymb, 1, 1); // printf("log2_maxh = %d\n",ue->pdsch_vars[gNB_id]->log2_maxh); } -#endif + #ifdef DEBUG_DLSCH_DEMOD /* diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 13270c5c4b4c06030566d45debb76e53f58b272a..bfef89ea850eba7a19e4e97c6dfd6811742fd23d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -289,8 +289,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) proc, i, 0, - is*fp->samples_per_frame+ue->ssb_offset, - 0); + is*fp->samples_per_frame+ue->ssb_offset); #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"Calling sss detection (normal CP)\n"); @@ -317,7 +316,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) ue->init_sync_frame = is; } - nr_gold_pdcch(ue,0, 2); /* int nb_prefix_samples0 = fp->nb_prefix_samples0; fp->nb_prefix_samples0 = fp->nb_prefix_samples; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index e33693ce0e090ed2f45a63864a5511bcd99b6a7d..c8ee94f51056aabe2b44f817763af2b62e8d6dc4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -60,16 +60,15 @@ uint16_t nr_pbch_extract(int **rxdataF, uint8_t i,j,aarx; int32_t *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; int nushiftmod4 = frame_parms->nushift; - unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; //and - - // if (rx_offset>= frame_parms->ofdm_symbol_size) rx_offset-=frame_parms->ofdm_symbol_size; - rx_offset=(rx_offset)%(frame_parms->ofdm_symbol_size); AssertFatal(symbol>=1 && symbol<5, "symbol %d illegal for PBCH extraction\n", symbol); for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; + rx_offset = (rx_offset)%(frame_parms->ofdm_symbol_size); + rxF = &rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size]; rxF_ext = &rxdataF_ext[aarx][symbol*20*12]; #ifdef DEBUG_PBCH @@ -590,7 +589,9 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, frame_parms->ssb_index += (((nr_ue_pbch_vars->xtra_byte>>(7-i))&0x01)<<(3+i)); } - ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms); + ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms,i_ssb); + if (frame_parms->half_frame_bit) + ue->symbol_offset += (frame_parms->slots_per_frame>>1)*frame_parms->symbols_per_slot; uint8_t frame_number_4lsb = 0; for (int i=0; i<4; i++) @@ -612,7 +613,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, uint16_t number_pdus = 1; nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_MIB, gNB_id, ue, NULL, number_pdus); + nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, number_pdus); if (ue->if_inst && ue->if_inst->dl_indication) ue->if_inst->dl_indication(&dl_indication, NULL); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 3ab88dac0a5aeb804ec4e45667b3ef0ccdefd19c..12ac8ced478c7990ebd62f049bc1612de04ddcb5 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -83,7 +83,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ mu = nrUE_config->prach_config.prach_sub_c_spacing; restricted_set = prach_pdu->restricted_set; rootSequenceIndex = prach_pdu->root_seq_id; - n_ra_prb = prach_pdu->freq_msg1; + n_ra_prb = nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1,//prach_pdu->freq_msg1; NCS = prach_pdu->num_cs; prach_fmt_id = prach_pdu->prach_format; preamble_index = prach_resources->ra_PreambleIndex; @@ -130,6 +130,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ #endif not_found = 1; + nr_fill_du(N_ZC,prach_root_sequence_map); preamble_index0 = preamble_index; // set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this // preamble index and find the corresponding cyclic shift @@ -216,12 +217,13 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ k += kbar; k *= 2; - LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d, preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, - slot, - k, - n_ra_prb, - preamble_offset, - first_nonzero_root_idx); + LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d (k1 %d), preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, + slot, + k, + n_ra_prb, + nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1, + preamble_offset, + first_nonzero_root_idx); Xu = (int16_t*)ue->X_u[preamble_offset-first_nonzero_root_idx]; @@ -244,87 +246,83 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ *********************************************************/ if (mu==1) { - if (fp->N_RB_UL <= 100) - AssertFatal(1 == 0, "N_RB_UL %d not support for NR PRACH yet\n", fp->N_RB_UL); - else if (fp->N_RB_UL < 137) { - if (fp->threequarter_fs == 0) { - //40 MHz @ 61.44 Ms/s - //50 MHz @ 61.44 Ms/s + switch(fp->samples_per_subframe) { + case 15360: + // 10, 15 MHz @ 15.36 Ms/s if (prach_sequence_length == 0) { if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) - dftlen = 49152; + dftlen = 12288; if (prach_fmt_id == 3) - dftlen = 12288; - } // 839 sequence - else { - switch (mu){ - case 1: - dftlen = 2048; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; - } + dftlen = 3072; + } else { // 839 sequence + dftlen = 512; + } + break; + + case 30720: + // 20, 25, 30 MHz @ 30.72 Ms/s + if (prach_sequence_length == 0) { + if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) + dftlen = 24576; + if (prach_fmt_id == 3) + dftlen = 6144; + } else { // 839 sequence + dftlen = 1024; } - } else { // threequarter sampling - // 40 MHz @ 46.08 Ms/s + break; + + case 46080: + // 40 MHz @ 46.08 Ms/s if (prach_sequence_length == 0) { - AssertFatal(fp->N_RB_UL <= 107, "cannot do 108..136 PRBs with 3/4 sampling\n"); if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) dftlen = 36864; if (prach_fmt_id == 3) dftlen = 9216; - } else { - switch (mu){ - case 1: - dftlen = 1536; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; - } - } // short format - } // 3/4 sampling - } // <=50 MHz BW - else if (fp->N_RB_UL <= 273) { - if (fp->threequarter_fs == 0) { - //80,90,100 MHz @ 122.88 Ms/s + } else { // 839 sequence + dftlen = 1536; + } + break; + + case 61440: + // 40, 50, 60 MHz @ 61.44 Ms/s if (prach_sequence_length == 0) { if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) - dftlen = 98304; + dftlen = 49152; if (prach_fmt_id == 3) - dftlen = 24576; + dftlen = 12288; + } else { // 839 sequence + dftlen = 2048; } - } else { // threequarter sampling - switch (mu){ - case 1: - dftlen = 4096; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; + break; + + case 92160: + // 50, 60, 70, 80, 90 MHz @ 92.16 Ms/s + if (prach_sequence_length == 0) { + if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) + dftlen = 73728; + if (prach_fmt_id == 3) + dftlen = 18432; + } else { // 839 sequence + dftlen = 3072; } - } - } else { - AssertFatal(fp->N_RB_UL <= 217, "cannot do more than 217 PRBs with 3/4 sampling\n"); - // 80 MHz @ 92.16 Ms/s - if (prach_sequence_length == 0) { - if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) - dftlen = 73728; - if (prach_fmt_id == 3) - dftlen = 18432; - } else { - switch (mu){ - case 1: - dftlen = 3072; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; + break; + + case 122880: + // 70, 80, 90, 100 MHz @ 122.88 Ms/s + if (prach_sequence_length == 0) { + if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) + dftlen = 98304; + if (prach_fmt_id == 3) + dftlen = 24576; + } else { // 839 sequence + dftlen = 4096; } + break; + + default: + AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu); } } - } else if (mu==3) { if (fp->threequarter_fs) AssertFatal(1==0,"3/4 sampling not supported for numerology %d\n",mu); @@ -425,15 +423,16 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ uint8_t use_extended_prach_prefix = 0; if(fp->numerology_index == 0) { if (prachStartSymbol == 0 || prachStartSymbol == 7) - use_extended_prach_prefix = 1; + use_extended_prach_prefix = 1; } else { if (slot%(fp->slots_per_subframe/2)==0 && prachStartSymbol == 0) - use_extended_prach_prefix = 1; + use_extended_prach_prefix = 1; } - - if (fp->N_RB_UL <= 34) { //32 PRB case 61.44Msps - if (fp->threequarter_fs == 0) { + + if (mu == 3) { + switch (fp->samples_per_subframe) { + case 61440: // 32 PRB case, 61.44 Msps Ncp<<=1; //to account for 61.44Mbps // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples @@ -491,13 +490,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (512*12)+Ncp; } } - } - else - AssertFatal(1==0,"3/4 sampling not supported for this PRACH size %d\n",fp->N_RB_UL); - - } - else if (fp->N_RB_UL <= 68) {//66 PRB case, 122.88 Msps - if (fp->threequarter_fs == 0) { + break; + + case 122880: // 66 PRB case, 122.88 Msps Ncp<<=2; //to account for 122.88Mbps // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples @@ -555,13 +550,211 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (1024*12)+Ncp; } } + break; + + default: + AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu); } - else - AssertFatal(1==0,"3/4 sampling not supported for this PRACH size %d\n",fp->N_RB_UL); - } - else if (fp->N_RB_UL < 137) { // 46.08 or 61.44 Ms/s - if (fp->threequarter_fs == 0) { // full sampling @ 61.44 Ms/s - Ncp<<=1; //to account for 61.44Mbps + } else if (mu == 1) { + switch (fp->samples_per_subframe) { + case 15360: // full sampling @ 15.36 Ms/s + Ncp = Ncp/2; // to account for 15.36 Ms/s + // This is after cyclic prefix + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_sequence_length == 0){ + if (prach_fmt_id == 0) { // 24576 samples @ 30.72 Ms/s, 12288 samples @ 15.36 Ms/s + idft(IDFT_12288,prachF,prach2,1); + // here we have | empty | Prach12288 | + memmove(prach,prach+(12288<<1),(Ncp<<2)); + // here we have | Prefix | Prach12288 | + prach_len = 12288+Ncp; + } else if (prach_fmt_id == 1) { // 24576 samples @ 30.72 Ms/s, 12288 samples @ 15.36 Ms/s + idft(IDFT_12288,prachF,prach2,1); + // here we have | empty | Prach12288 | empty12288 | + memmove(prach2+(12288<<1),prach2,(12288<<2)); + // here we have | empty | Prach12288 | Prach12288 | + memmove(prach,prach+(12288<<2),(Ncp<<2)); + // here we have | Prefix | Prach12288 | Prach12288 | + prach_len = (12288*2)+Ncp; + } else if (prach_fmt_id == 2) { // 24576 samples @ 30.72 Ms/s, 12288 samples @ 15.36 Ms/s + idft(IDFT_12288,prachF,prach2,1); + // here we have | empty | Prach12288 | empty12288 | empty12288 | empty12288 | + memmove(prach2+(12288<<1),prach2,(12288<<2)); + // here we have | empty | Prach12288 | Prach12288 | empty12288 | empty12288 | + memmove(prach2+(12288<<2),prach2,(12288<<3)); + // here we have | empty | Prach12288 | Prach12288 | Prach12288 | Prach12288 | + memmove(prach,prach+(12288<<3),(Ncp<<2)); + // here we have | Prefix | Prach12288 | Prach12288 | Prach12288 | Prach12288 | + prach_len = (12288*4)+Ncp; + } else if (prach_fmt_id == 3) { // 6144 samples @ 30.72 Ms/s, 3072 samples @ 15.36 Ms/s + idft(IDFT_3072,prachF,prach2,1); + // here we have | empty | Prach3072 | empty3072 | empty3072 | empty3072 | + memmove(prach2+(3072<<1),prach2,(3072<<2)); + // here we have | empty | Prach3072 | Prach3072 | empty3072 | empty3072 | + memmove(prach2+(3072<<2),prach2,(3072<<3)); + // here we have | empty | Prach3072 | Prach3072 | Prach3072 | Prach3072 | + memmove(prach,prach+(3072<<3),(Ncp<<2)); + // here we have | Prefix | Prach3072 | Prach3072 | Prach3072 | Prach3072 | + prach_len = (3072*4)+Ncp; + } + } else { // short PRACH sequence + if (use_extended_prach_prefix) + Ncp += 8; // 16*kappa, kappa=0.5 for 15.36 Ms/s + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_fmt_id == 9) { + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | + prach_len = (512*1)+Ncp; + } else if (prach_fmt_id == 4 || prach_fmt_id == 7) { + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | + prach_len = (512*2)+Ncp; + } else if (prach_fmt_id == 5) { // 4x512 + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | empty512 | empty512 | + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | Prach512 | Prach512 | + prach_len = (512*4)+Ncp; + } else if (prach_fmt_id == 6) { // 6x512 + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | empty512 | empty512 | + memmove(prach2+(512<<3),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + prach_len = (512*6)+Ncp; + } else if (prach_fmt_id == 8) { // 12x512 + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<3),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1)*6,prach2,(512<<2)*6); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + prach_len = (512*12)+Ncp; + } + } + break; + + case 30720: // full sampling @ 30.72 Ms/s + Ncp = Ncp*1; // to account for 30.72 Ms/s + // This is after cyclic prefix + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_sequence_length == 0){ + if (prach_fmt_id == 0) { // 24576 samples @ 30.72 Ms/s + idft(IDFT_24576,prachF,prach2,1); + // here we have | empty | Prach24576 | + memmove(prach,prach+(24576<<1),(Ncp<<2)); + // here we have | Prefix | Prach24576 | + prach_len = 24576+Ncp; + } else if (prach_fmt_id == 1) { // 24576 samples @ 30.72 Ms/s + idft(IDFT_24576,prachF,prach2,1); + // here we have | empty | Prach24576 | empty24576 | + memmove(prach2+(24576<<1),prach2,(24576<<2)); + // here we have | empty | Prach24576 | Prach24576 | + memmove(prach,prach+(24576<<2),(Ncp<<2)); + // here we have | Prefix | Prach24576 | Prach24576 | + prach_len = (24576*2)+Ncp; + } else if (prach_fmt_id == 2) { // 24576 samples @ 30.72 Ms/s + idft(IDFT_24576,prachF,prach2,1); + // here we have | empty | Prach24576 | empty24576 | empty24576 | empty24576 | + memmove(prach2+(24576<<1),prach2,(24576<<2)); + // here we have | empty | Prach24576 | Prach24576 | empty24576 | empty24576 | + memmove(prach2+(24576<<2),prach2,(24576<<3)); + // here we have | empty | Prach24576 | Prach24576 | Prach24576 | Prach24576 | + memmove(prach,prach+(24576<<3),(Ncp<<2)); + // here we have | Prefix | Prach24576 | Prach24576 | Prach24576 | Prach24576 | + prach_len = (24576*4)+Ncp; + } else if (prach_fmt_id == 3) { // 6144 samples @ 30.72 Ms/s + idft(IDFT_6144,prachF,prach2,1); + // here we have | empty | Prach6144 | empty6144 | empty6144 | empty6144 | + memmove(prach2+(6144<<1),prach2,(6144<<2)); + // here we have | empty | Prach6144 | Prach6144 | empty6144 | empty6144 | + memmove(prach2+(6144<<2),prach2,(6144<<3)); + // here we have | empty | Prach6144 | Prach6144 | Prach6144 | Prach6144 | + memmove(prach,prach+(6144<<3),(Ncp<<2)); + // here we have | Prefix | Prach6144 | Prach6144 | Prach6144 | Prach6144 | + prach_len = (6144*4)+Ncp; + } + } else { // short PRACH sequence + if (use_extended_prach_prefix) + Ncp += 16; // 16*kappa, kappa=1 for 30.72Msps + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_fmt_id == 9) { + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | + prach_len = (1024*1)+Ncp; + } else if (prach_fmt_id == 4 || prach_fmt_id == 7) { + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | + prach_len = (1024*2)+Ncp; + } else if (prach_fmt_id == 5) { // 4x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + prach_len = (1024*4)+Ncp; + } else if (prach_fmt_id == 6) { // 6x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<3),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + prach_len = (1024*6)+Ncp; + } else if (prach_fmt_id == 8) { // 12x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<3),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1)*6,prach2,(1024<<2)*6); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + prach_len = (1024*12)+Ncp; + } + } + break; + + case 61440: // full sampling @ 61.44 Ms/s + Ncp = Ncp*2; // to account for 61.44 Ms/s // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_sequence_length == 0){ @@ -587,7 +780,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ memmove(prach,prach+(49152<<3),(Ncp<<2)); // here we have |Prefix | Prach49152 | Prach49152| Prach49152 | Prach49152 prach_len = (49152*4)+Ncp; - } else if (prach_fmt_id == 3) { // //6144 samples @ 30.72 Ms/s, 12288 samples @ 61.44 Ms/s + } else if (prach_fmt_id == 3) { // 6144 samples @ 30.72 Ms/s, 12288 samples @ 61.44 Ms/s idft(IDFT_12288,prachF,prach2,1); memmove(prach2+(12288<<1),prach2,(12288<<2)); // here we have |empty | Prach12288 | Prach12288| empty12288 | empty12288 @@ -649,7 +842,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (2048*12)+Ncp; } } - } else { // threequarter sampling @ 46.08 Ms/s + break; + + case 46080: // threequarter sampling @ 46.08 Ms/s Ncp = (Ncp*3)/2; prach2 = prach+(Ncp<<1); if (prach_sequence_length == 0){ @@ -738,9 +933,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (1536*12)+Ncp; } } - } - } else if (fp->N_RB_UL <= 273) {// 92.16 or 122.88 Ms/s - if (fp->threequarter_fs == 0) { // full sampling @ 122.88 Ms/s + break; + + case 122880: // full sampling @ 122.88 Ms/s Ncp<<=2; //to account for 122.88Mbps // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples @@ -828,7 +1023,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (4096*12)+Ncp; } } - } else { // three quarter sampling @ 92.16 Ms/s + break; + + case 92160: // three quarter sampling @ 92.16 Ms/s Ncp = (Ncp*3); //to account for 92.16 Msps prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_sequence_length == 0){ @@ -915,6 +1112,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (3072*12)+Ncp; } } + break; + + default: + AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu); } } 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 91274b908a686959ee5d8e24442347cf40e65a00..1e7e10def70891889b033605743d55b403711e95 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -686,11 +686,8 @@ void dlsch_detection_mrc_TM34(NR_DL_FRAME_PARMS *frame_parms, 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 nr_slot_rx, 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. @@ -698,67 +695,61 @@ void dlsch_detection_mrc_TM34(NR_DL_FRAME_PARMS *frame_parms, @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 nr_slot_rx Slot number - @param high_speed_flag + @param n_dmrs_cdm_groups @param frame_parms Pointer to frame descriptor */ 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, uint8_t config_type, unsigned short start_rb, - unsigned short nb_pdsch_rb, - unsigned char nr_slot_rx, - uint32_t high_speed_flag, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, NR_DL_FRAME_PARMS *frame_parms, uint16_t dlDmrsSymbPos); -/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, +/** \fn dlsch_extract_rbs_multiple(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) + unsigned char symbol + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + uint8_t Nl, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos) \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for dual antenna eNB transmission. + for the current allocation and for multiple layer antenna gNB 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 Nl nb of antenna layers @param symbol Symbol to extract - @param nr_slot_rx Slot index - @param high_speed_flag + @param n_dmrs_cdm_groups @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_slot_rx, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode); +unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + uint8_t Nl, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos); /** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, int32_t **dl_bf_ch_estimates, @@ -812,8 +803,9 @@ void nr_dlsch_channel_compensation(int32_t **rxdataF_ext, int32_t **dl_ch_magb, int32_t **dl_ch_magr, int32_t **rxdataF_comp, - int32_t **rho, + int32_t ***rho, NR_DL_FRAME_PARMS *frame_parms, + uint8_t nb_aatx, uint8_t symbol, uint8_t start_symbol, uint8_t first_symbol_flag, @@ -827,7 +819,7 @@ void nr_dlsch_channel_compensation_core(int **rxdataF_ext, int **dl_ch_mag, int **dl_ch_magb, int **rxdataF_comp, - int **rho, + int ***rho, unsigned char n_tx, unsigned char n_rx, unsigned char mod_order, @@ -898,6 +890,15 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, int length, int start_point); +void nr_dlsch_detection_mrc(int **rxdataF_comp, + int ***rho, + int **dl_ch_mag, + int **dl_ch_magb, + short n_tx, + short n_rx, + unsigned char symbol, + unsigned short nb_rb); + void nr_dlsch_detection_mrc_core(int **rxdataF_comp, int **rxdataF_comp_i, int **rho, @@ -971,6 +972,7 @@ void dlsch_channel_compensation_TM34(NR_DL_FRAME_PARMS *frame_parms, */ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, + uint8_t n_tx, int32_t *avg, uint8_t symbol, uint32_t len, @@ -1002,6 +1004,8 @@ void dlsch_channel_level_TM7(int32_t **dl_bf_ch_estimates_ext, void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, + uint8_t n_tx, + uint8_t n_rx, NR_UE_DLSCH_t **dlsch_ue, uint8_t symbol, uint8_t start_symbol, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 1a39def26b27ea8990305b987a357fa254f0a85c..1adc81d556c1c29400420e167765f583af17854e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -264,21 +264,22 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, 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 != harq_process->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet + LOG_D(PHY,"harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n",harq_pid,harq_process->ndi,harq_process->pusch_pdu.pusch_data.new_data_indicator); + if (harq_process->first_tx == 1 || + harq_process->ndi != harq_process->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet #ifdef DEBUG_ULSCH_CODING printf("encoding thinks this is a new packet \n"); #endif - + harq_process->first_tx=0; ///////////////////////// a---->| add CRC |---->b ///////////////////////// /////////// - /* + /* int i; printf("ulsch (tx): \n"); for (i=0;i<(A>>3);i++) - printf("%02x.",a[i]); + printf("%02x.",harq_process->a[i]); printf("\n"); - */ + */ if (A > 3824) { // Add 24-bit crc (polynomial A) to payload @@ -412,6 +413,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, /////////// /////////////////////////////////////////////////////////////////////////////// + LOG_D(PHY,"setting ndi to %d from pusch_data\n",harq_process->pusch_pdu.pusch_data.new_data_indicator); harq_process->ndi = harq_process->pusch_pdu.pusch_data.new_data_indicator; } F = harq_process->F; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 3d8c975a5c9bb286cbe5049b15e195bd8f6da663..18fe11d40a4e740844f59fd19a523aa7475994de 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -137,7 +137,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t mod_order = pusch_pdu->qam_mod_order; uint16_t rnti = pusch_pdu->rnti; uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data; - uint16_t start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB; + uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB; if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; @@ -146,6 +146,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, get_num_re_dmrs(pusch_pdu, &nb_dmrs_re_per_rb, &number_dmrs_symbols); + LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n", + rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb); + // TbD num_of_mod_symbols is set but never used N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords; @@ -161,7 +164,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////// //////////////////////////////////////////////////////////////////// - + //log_dump(PHY, harq_process_ul_ue->a, 16, LOG_DUMP_CHAR,"nrue pusch tx frame %d %d: ", frame, slot); + /////////////////////////ULSCH scrambling///////////////////////// /////////// @@ -195,7 +199,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////DMRS Modulation///////////////////////// /////////// uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; - uint16_t n_dmrs = (start_rb+nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4); + uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4); int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16))); /////////// //////////////////////////////////////////////////////////////////////// @@ -355,16 +359,18 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (pusch_pdu->transform_precoding == transform_precoder_disabled){ if (dmrs_type == pusch_dmrs_type1) - dmrs_idx = start_rb*6; + dmrs_idx = (pusch_pdu->bwp_start + start_rb)*6; else - dmrs_idx = start_rb*4; - - // Perform this on gold sequence, not required when SC FDMA operation is done, + dmrs_idx = (pusch_pdu->bwp_start + start_rb)*4; + + // TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part + // Perform this on gold sequence, not required when SC FDMA operation is done, + LOG_D(PHY,"DMRS in symbol %d\n",l); nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated } else { - dmrs_idx = 0; - } + dmrs_idx = 0; + } } else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 4ac1c47b02f5b48d39ce87ce41c0ea7e512e2ee0..28b6677b2ca9f0a5e7c77e9841b0246242ba6115 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -213,7 +213,7 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2) } for (int n=0; n < LENGTH_PSS_NR; n++) { - int m = (n + 43*N_ID_2)%(LENGTH_PSS_NR); + int m = (n + 43*N_ID_2)%(LENGTH_PSS_NR); d_pss[n] = 1 - 2*x[m]; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index 3560b235502de2d1e4927c2b7fa93fe2455d6bb8..9a191ae6f907fe84d995f059c921e86045a62550 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -62,7 +62,8 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, uint8_t mcs, uint8_t nrofSymbols, uint8_t startingSymbolIndex, - uint16_t startingPRB) { + uint16_t startingPRB, + uint16_t secondHopPRB) { #ifdef DEBUG_NR_PUCCH_TX printf("\t [nr_generate_pucch0] start function at slot(nr_slot_tx)=%d\n",nr_slot_tx); #endif @@ -94,38 +95,35 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, * x(l*12+n) = r_u_v_alpha_delta(n) */ // the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1 - uint8_t u=0,v=0;//,delta=0; - // if frequency hopping is disabled by the higher-layer parameter PUCCH-frequency-hopping - // n_hop = 0 - // if frequency hopping is enabled by the higher-layer parameter PUCCH-frequency-hopping - // n_hop = 0 for first hop - // n_hop = 1 for second hop - uint8_t n_hop = 0; - //uint8_t PUCCH_Frequency_Hopping; // from higher layers FIXME!! + uint8_t u[2]={0,0},v[2]={0,0}; + #ifdef DEBUG_NR_PUCCH_TX printf("\t [nr_generate_pucch0] sequence generation: variable initialization for test\n"); #endif // x_n contains the sequence r_u_v_alpha_delta(n) - int16_t x_n_re[24],x_n_im[24]; + int16_t x_n_re[2][24],x_n_im[2][24]; // we proceed to calculate alpha according to TS 38.211 Subclause 6.3.2.2.2 + int prb_offset[2]={startingPRB,startingPRB}; + nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,0,nr_slot_tx,&u[0],&v[0]); // calculating u and v value + if (startingPRB!=secondHopPRB) { + nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,1,nr_slot_tx,&u[1],&v[1]); // calculating u and v value + prb_offset[1] = secondHopPRB; + } for (int l=0; l<nrofSymbols; l++) { - // if frequency hopping is enabled n_hop = 1 for second hop. Not sure frequency hopping concerns format 0. FIXME!!! - // if ((PUCCH_Frequency_Hopping == 1)&&(l == (nrofSymbols-1))) n_hop = 1; - nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,n_hop,nr_slot_tx,&u,&v); // calculating u and v value alpha = nr_cyclic_shift_hopping(hoppingId,m0,mcs,l,startingSymbolIndex,nr_slot_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); -#endif +//#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[l],v[l],alpha,l); +//#endif for (int n=0; n<12; n++) { - x_n_re[(12*l)+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 base sequence shifted by alpha - x_n_im[(12*l)+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 base sequence shifted by alpha + x_n_re[l][n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Re[u[l]][n])>>15) + - (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u[l]][n])>>15))); // Re part of base sequence shifted by alpha + x_n_im[l][n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Im[u[l]][n])>>15) + + (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u[l]][n])>>15))); // Im part of base sequence shifted by alpha #ifdef DEBUG_NR_PUCCH_TX printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \tx_n(l=%d,n=%d)=(%d,%d)\n", - u,v,alpha,l,n,x_n_re[(12*l)+n],x_n_im[(12*l)+n]); + u[l],v[l],alpha,l,n,x_n_re[l][n],x_n_im[l][n]); #endif } } @@ -139,15 +137,18 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, for (int l=0; l<nrofSymbols; l++) { l2=l+startingSymbolIndex; - re_offset = (12*startingPRB) + frame_parms->first_carrier_offset; + re_offset = (12*prb_offset[l]) + frame_parms->first_carrier_offset; if (re_offset>= frame_parms->ofdm_symbol_size) re_offset-=frame_parms->ofdm_symbol_size; //txptr = &txdataF[0][re_offset]; +#ifdef DEBUG_NR_PUCCH_TX + printf("\t [nr_generate_pucch0] symbol %d PRB %d (%d)\n",l,prb_offset[l],re_offset); +#endif for (int n=0; n<12; n++) { - ((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[0] = (int16_t)(((int32_t)(amp) * x_n_re[(12*l)+n])>>15); - ((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[1] = (int16_t)(((int32_t)(amp) * x_n_im[(12*l)+n])>>15); + ((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[0] = (int16_t)(((int32_t)(amp) * x_n_re[l][n])>>15); + ((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[1] = (int16_t)(((int32_t)(amp) * x_n_im[l][n])>>15); //((int16_t *)txptr[0][re_offset])[0] = (int16_t)((int32_t)amp * x_n_re[(12*l)+n])>>15; //((int16_t *)txptr[0][re_offset])[1] = (int16_t)((int32_t)amp * x_n_im[(12*l)+n])>>15; //txptr[re_offset] = (x_n_re[(12*l)+n]<<16) + x_n_im[(12*l)+n]; diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h index c7f318f588e0be25d67d6d1b2c62d6f975537063..cb4b59c92fd4abd6343dd66806d3d44f26ad4887 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h @@ -57,7 +57,8 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, uint8_t mcs, uint8_t nrofSymbols, uint8_t startingSymbolIndex, - uint16_t startingPRB); + uint16_t startingPRB, + uint16_t secondHopPRB); void nr_generate_pucch1(PHY_VARS_NR_UE *ue, int32_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, diff --git a/openair1/PHY/TOOLS/calibration_scope.c b/openair1/PHY/TOOLS/calibration_scope.c new file mode 100644 index 0000000000000000000000000000000000000000..da1acb517570e78fa352fcbb289def26fcc67064 --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_scope.c @@ -0,0 +1,387 @@ +#include <stdlib.h> +#include <openair1/PHY/impl_defs_top.h> +#include "executables/softmodem-common.h" +#include "executables/nr-softmodem-common.h" +#include <forms.h> +#include <openair1/PHY/TOOLS/calibration_scope.h> + +#define TPUT_WINDOW_LENGTH 100 +#define ScaleZone 4 + +const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; +const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; + +typedef struct { + int16_t r; + int16_t i; +} scopeSample_t; +#define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) +typedef struct { + void ** samplesRx; + openair0_device *rfdevice; +} calibData_t; + +typedef struct OAIgraph { + FL_OBJECT *graph; + FL_OBJECT *text; + float maxX; + float maxY; + float minX; + float minY; + int x; + int y; + int w; + int h; + int waterFallh; + double *waterFallAvg; + boolean_t initDone; + int iteration; + void (*funct) (struct OAIgraph *graph, calibData_t *); +} OAIgraph_t; + + +/* Forms and Objects */ +typedef struct { + calibData_t * context; + FL_FORM *phy_scope; + OAIgraph_t graph[20]; + FL_OBJECT *button_0; +} OAI_phy_scope_t; + +typedef struct { + FL_FORM *stats_form; + void *vdata; + char *cdata; + long ldata; + FL_OBJECT *stats_text; + FL_OBJECT *stats_button; +} FD_stats_form; + +static void drawsymbol(FL_OBJECT *obj, int id, + FL_POINT *p, int n, int w, int h) { + fl_points( p, n, FL_YELLOW); +} + +#define WATERFALL 10000 + +static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + if (type==WATERFALL) { + graph->waterFallh=h-15; + graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh); + + for (int i=0; i< graph->waterFallh; i++) + graph->waterFallAvg[i]=0; + + graph->graph=fl_add_canvas(FL_NORMAL_CANVAS, x, y, w, graph->waterFallh, label); + graph->text=fl_add_text(FL_NORMAL_TEXT, x, y+graph->waterFallh, w, 15, label); + fl_set_object_lcolor(graph->text,FL_WHITE); + fl_set_object_color(graph->text, FL_BLACK, FL_BLACK); + fl_set_object_lalign(graph->text, FL_ALIGN_CENTER ); + } else { + graph->graph=fl_add_xyplot(type, x, y, w, h, label); + fl_set_object_lcolor(graph->graph, FL_WHITE ); // Label color + fl_set_object_color(graph->graph, FL_BLACK, pointColor); + + for (int i=0; i< FL_MAX_XYPLOTOVERLAY; i++) + fl_set_xyplot_symbol(graph->graph, i, drawsymbol); + } + + graph->x=x; + graph->y=y; + graph->w=w; + graph->h=h; + graph->maxX=0; + graph->maxY=0; + graph->minX=0; + graph->minY=0; + graph->initDone=false; + graph->iteration=0; +} + +static OAIgraph_t calibrationCommonGraph( void (*funct) (OAIgraph_t *graph, calibData_t *context), + int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + OAIgraph_t graph; + commonGraph(&graph, type, x, y, w, h, label, pointColor); + graph.funct=funct; + return graph; +} + + +static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, float maxY) { + if ( maxX > graph->maxX || minX < graph->minX || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 ) { + graph->maxX/=2; + graph->minX/=2; + graph->maxX=max(graph->maxX,maxX); + graph->minX=min(graph->minX,minX); + fl_set_xyplot_xbounds(graph->graph, graph->minX*1.2, graph->maxX*1.2); + } + + if ( maxY > graph->maxY || minY < graph->minY || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 ) { + graph->maxY/=2; + graph->minY/=2; + graph->maxY=max(graph->maxY,maxY); + graph->minY=min(graph->minY,minY); + fl_set_xyplot_ybounds(graph->graph, graph->minY*1.2, graph->maxY*1.2); + } +} + +static void oai_xygraph_getbuff(OAIgraph_t *graph, float **x, float **y, int len, int layer) { + float *old_x; + float *old_y; + int old_len=-1; + + if (graph->iteration >1) + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + + if (old_len != len) { + LOG_W(HW,"allocating graph of %d scope\n", len); + float values[len]; + float time[len]; + + // make time in case we will use it + for (int i=0; i<len; i++) + time[i] = values[i] = i; + + if (layer==0) + fl_set_xyplot_data(graph->graph,time,values,len,"","",""); + else + fl_add_xyplot_overlay(graph->graph,layer,time,values,len,rx_antenna_colors[layer]); + + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + AssertFatal(old_len==len,""); + } + + *x=old_x; + *y=old_y; +} + +static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, boolean_t NoAutoScale) { + fl_redraw_object(graph->graph); + + if ( NoAutoScale && graph->iteration%NoAutoScale == 0) { + float maxX=0, maxY=0, minX=0, minY=0; + + for (int k=0; k<len; k++) { + maxX=max(maxX,x[k]); + minX=min(minX,x[k]); + maxY=max(maxY,y[k]); + minY=min(minY,y[k]); + } + + setRange(graph, minX-5, maxX+5, minY-5, maxY+5); + } + + graph->iteration++; +} + +static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { + if ( values == NULL ) + return; + fl_winset(FL_ObjWin(graph->graph)); + const int samplesPerPixel=datasize/graph->w; + int displayPart=graph->waterFallh-ScaleZone; + int row=graph->iteration%displayPart; + double avg=0; + + for (int i=0; i < displayPart; i++) + avg+=graph->waterFallAvg[i]; + + avg/=displayPart; + graph->waterFallAvg[row]=0; + + for (int pix=0; pix<graph->w; pix++) { + scopeSample_t *end=values+(pix+1)*samplesPerPixel; + end-=2; + AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize); + double val=0; + + for (scopeSample_t *s=values+(pix)*samplesPerPixel; + s <end; + s++) + val += SquaredNorm(*s); + + val/=samplesPerPixel; + graph->waterFallAvg[row]+=val/graph->w; + int col=0; + + if (val > avg*2 ) + col=1; + + if (val > avg*10 ) + col=2; + + if (val > avg*100 ) + col=3; + + fl_point(pix, graph->iteration%displayPart, water_colors[col]); + } + + if (graph->initDone==false) { + for ( int i=0; i < graph->waterFallh; i++ ) + for ( int j = 0 ; j < graph->w ; j++ ) + fl_point(j, i, FL_BLACK); + + for ( int i=1; i<divisions; i++) + for (int j= displayPart; j<graph->waterFallh; j++) + fl_point(i*(graph->w/divisions),j, FL_WHITE); + + graph->initDone=true; + } + + fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg)); + graph->iteration++; +} + +static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); + + for (int ant=0; ant<nb_ant; ant++) { + if (data[ant] != NULL) { + for (int i=0; i<len; i++) { + values[i] = SquaredNorm(data[ant][i]); + } + + oai_xygraph(graph,time,values, len, ant, 10); + } + } +} + +static void gNBWaterFall (OAIgraph_t *graph, calibData_t *context) { + //use 1st antenna + genericWaterFall(graph, (scopeSample_t *)context->samplesRx[0], + 0, 0, + "X axis:one frame in time"); +} +static void gNBfreqWaterFall (OAIgraph_t *graph, calibData_t *context) { + //use 1st antenna + genericWaterFall(graph, (scopeSample_t *)context->samplesRx[0], + 0, 0, + "X axis:one frame in time"); +} +static void timeResponse (OAIgraph_t *graph, calibData_t *context) { + #if 0 + const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size; + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); + const int ant=0; // display antenna 0 for each UE + + for (int ue=0; ue<nb_UEs; ue++) { + scopeSample_t *data= (scopeSample_t *)phy_vars_gnb->pusch_vars[ue]->ul_ch_estimates_time[ant]; + + if (data != NULL) { + for (int i=0; i<len; i++) { + values[i] = SquaredNorm(data[i]); + } + + oai_xygraph(graph,time,values, len, ue, 10); + } + } + #endif +} + +static void puschIQ (OAIgraph_t *graph, calibData_t *context) { + #if 0 + NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; + int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; + + for (int ue=0; ue<nb_UEs; ue++) { + scopeSample_t *pusch_comp = (scopeSample_t *) phy_vars_gnb->pusch_vars[ue]->rxdataF_comp[0]; + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz, ue); + + if (pusch_comp) { + for (int k=0; k<sz; k++ ) { + I[k] = pusch_comp[k].r; + Q[k] = pusch_comp[k].i; + } + + oai_xygraph(graph,I,Q,sz,ue,10); + } + } + #endif +} + + +static OAI_phy_scope_t *createScopeCalibration(calibData_t * context) { + FL_OBJECT *obj; + OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); + fdui->context=context; + // 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] = calibrationCommonGraph( gNBWaterFall, WATERFALL, 0, curY, 400, 100, + "Received Signal (Time-Domain, one frame)", FL_RED ); + + // Time-domain channel response + //fdui->graph[1] = calibrationCommonGraph( 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[1] = calibrationCommonGraph( gNBfreqWaterFall, WATERFALL, 0, curY, 800, 100, + "Channel Frequency domain (RE, one frame)", FL_RED ); + fl_get_object_bbox(fdui->graph[1].graph,&x, &y,&w, &h); + curY+=h+20; + // LLR of PUSCH + //fdui->graph[3] = calibrationCommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW ); + // I/Q PUSCH comp + fdui->graph[2] = calibrationCommonGraph( puschIQ, FL_POINTS_XYPLOT, 500, curY, 300, 200, + "PUSCH I/Q of MF Output", FL_YELLOW ); + fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); + curY+=h; + //fl_get_object_bbox(fdui->graph[6].graph,&x, &y,&w, &h); + curY+=h; + fdui->graph[3].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; +} + +void calibrationScope(OAI_phy_scope_t *form) { + int i=0; + + while (form->graph[i].graph) { + form->graph[i].funct(form->graph+i, form->context); + i++; + } + + //fl_check_forms(); +} + +static void *scopeThread(void *arg) { + calibData_t * context = (calibData_t *)arg; + size_t stksize=0; + pthread_attr_t atr; + pthread_attr_init(&atr); + pthread_attr_getstacksize(&atr, &stksize); + pthread_attr_setstacksize(&atr,32*1024*1024 ); + sleep(3); // no clean interthread barriers + int fl_argc=1; + char *name="Calibration-scope"; + fl_initialize (&fl_argc, &name, NULL, 0, 0); + OAI_phy_scope_t *form = createScopeCalibration(context); + + while (!oai_exit) { + calibrationScope(form); + usleep(99*1000); + } + + return NULL; +} + +void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice) { + pthread_t forms_thread; + calibData_t * tmp=(calibData_t *) malloc(sizeof(*tmp)); + tmp->samplesRx=samplesRx; + tmp->rfdevice=rfdevice; + threadCreate(&forms_thread, scopeThread, (void*) tmp, "scope", -1, OAI_PRIORITY_RT_LOW); +} diff --git a/openair1/PHY/TOOLS/calibration_scope.h b/openair1/PHY/TOOLS/calibration_scope.h new file mode 100644 index 0000000000000000000000000000000000000000..052a1a6b6e5d73e0ccd26db2fc35cfd5d02425f2 --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_scope.h @@ -0,0 +1,5 @@ +#ifndef CALIB_SCOPE_H +#define CALIB_SCOPE_H + +void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice); +#endif diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c new file mode 100644 index 0000000000000000000000000000000000000000..982ca9d254cb47caf105f82a5b2d864d4feaa95b --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -0,0 +1,330 @@ +#include <stdint.h> +#include <openair1/PHY/impl_defs_top.h> +#include <targets/ARCH/COMMON/common_lib.h> +#include <executables/softmodem-common.h> +#include <openair1/PHY/TOOLS/calibration_scope.h> + + +volatile int oai_exit=false; +unsigned int mmapped_dma=0; +int single_thread_flag; +uint32_t timing_advance; +int8_t threequarter_fs; +int usrp_tx_thread; +uint64_t downlink_frequency[MAX_NUM_CCs][4]; +int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; +int opp_enabled; +static double snr_dB=20; +THREAD_STRUCT thread_struct; +#include <executables/nr-softmodem.h> + +int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;} +void nfapi_setmode(nfapi_mode_t nfapi_mode) {} +void set_taus_seed(unsigned int seed_init){}; + +int main(int argc, char **argv) { + ///static configuration for NR at the moment + if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) { + exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); + } + set_softmodem_sighandler(); + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + logInit(); + paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ; + + CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); + get_common_options(SOFTMODEM_GNB_BIT ); + config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); + CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); + configure_linux(); + + + int N_RB=50; + int subCarrierFreq=30e3; + int sampling_rate=30.72e6; + int DFT=2048; + int TxAdvanceInDFTSize=12; + int antennas=1; + uint64_t freq=3619.200e6; + int rxGain=90; + int txGain=90; + int filterBand=40e6; + char * usrp_addrs="type=b200"; + + openair0_config_t openair0_cfg= { + //! Module ID for this configuration + .Mod_id=0, + //! device log level + .log_level=0, + //! duplexing mode + .duplex_mode=0, + //! number of downlink resource blocks + .num_rb_dl=N_RB, + //! number of samples per frame + .samples_per_frame=0, + //! the sample rate for both transmit and receive. + .sample_rate=sampling_rate, + //device is doing mmapped DMA transfers + .mmapped_dma=0, + //! offset in samples between TX and RX paths + .tx_sample_advance=0, + //! samples per packet on the fronthaul interface + .samples_per_packet=1024, + //! number of RX channels (=RX antennas) + .rx_num_channels=antennas, + //! number of TX channels (=TX antennas) + .tx_num_channels=antennas, + //! \brief Center frequency in Hz for RX. + //! index: [0..rx_num_channels[ + .rx_freq={freq,freq,freq,freq}, + //! \brief Center frequency in Hz for TX. + //! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels + .tx_freq={freq,freq,freq,freq}, + //! \brief memory + //! \brief Pointer to Calibration table for RX gains + .rx_gain_calib_table=NULL, + //! mode for rxgain (ExpressMIMO2) + .rxg_mode={0}, + //! \brief Gain for RX in dB. + //! index: [0..rx_num_channels] + .rx_gain={rxGain,rxGain,rxGain,rxGain}, + //! \brief Gain offset (for calibration) in dB + //! index: [0..rx_num_channels] + .rx_gain_offset={0}, + //! gain for TX in dB + .tx_gain={txGain,txGain,txGain,txGain}, + //! RX bandwidth in Hz + .rx_bw=filterBand, + //! TX bandwidth in Hz + .tx_bw=filterBand, + //! clock source + .clock_source=external,//internal gpsdo external + //! timing_source + .time_source=internal, //internal gpsdo external + //! Manual SDR IP address + //#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + .sdr_addrs=usrp_addrs, + //! Auto calibration flag + .autocal={0}, + //! rf devices work with x bits iqs when oai have its own iq format + //! the two following parameters are used to convert iqs + .iq_txshift=0, + .iq_rxrescale=0, + //! Configuration file for LMS7002M + .configFilename="", + //! remote IP/MAC addr for Ethernet interface + .remote_addr="", + //! remote port number for Ethernet interface + .remote_port=0, + //! local IP/MAC addr for Ethernet interface (eNB/BBU, UE) + .my_addr=0, + //! local port number for Ethernet interface (eNB/BBU, UE) + .my_port=0, + //! record player configuration, definition in record_player.h + .recplay_mode=0, + .recplay_conf=NULL, + //! number of samples per tti + .samples_per_tti=0, + //! check for threequarter sampling rate + .threequarter_fs=0, + }; + //----------------------- + openair0_device rfdevice= { + /*!tx write thread*/ + //.write_thread={0}, + /*!brief Module ID of this device */ + .Mod_id=0, + /*!brief Component Carrier ID of this device */ + .CC_id=0, + /*!brief Type of this device */ + .type=NONE_DEV, + /*!brief Transport protocol type that the device supports (in case I/Q samples need to be transported) */ + .transp_type=NONE_TP, + /*!brief Type of the device's host (RAU/RRU) */ + .host_type=MIN_HOST_TYPE, + /* !brief RF frontend parameters set by application */ + .openair0_cfg=NULL, //set by device_init + /* !brief ETH params set by application */ + .eth_params=NULL, + //! record player data, definition in record_player.h + .recplay_state=NULL, + /* !brief Indicates if device already initialized */ + .is_init=0, + /*!brief Can be used by driver to hold internal structure*/ + .priv=NULL, + /* Functions API, which are called by the application*/ + /*! \brief Called to start the transceiver. Return 0 if OK, < 0 if error + @param device pointer to the device structure specific to the RF hardware target + */ + .trx_start_func=NULL, + + /*! \brief Called to configure the device + @param device pointer to the device structure specific to the RF hardware target + */ + .trx_config_func=NULL, + + /*! \brief Called to send a request message between RAU-RRU on control port + @param device pointer to the device structure specific to the RF hardware target + @param msg pointer to the message structure passed between RAU-RRU + @param msg_len length of the message + */ + .trx_ctlsend_func=NULL, + + /*! \brief Called to receive a reply message between RAU-RRU on control port + @param device pointer to the device structure specific to the RF hardware target + @param msg pointer to the message structure passed between RAU-RRU + @param msg_len length of the message + */ + .trx_ctlrecv_func=NULL, + + /*! \brief Called to send samples to the RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples (2 dimensional) + @param nsamps number of samples to be sent + @param number of antennas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied + */ + .trx_write_func=NULL, + + /*! \brief Called to send samples to the RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples (1 dimensional) + @param nsamps number of samples to be sent + @param antenna_id index of the antenna if the device has multiple anteannas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied + */ + .trx_write_func2=NULL, + + /*! \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 + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param num_antennas number of antennas from which to receive samples + * \returns the number of sample read + */ + + .trx_read_func=NULL, + + /*! \brief Receive samples from hardware, this version provides a single antenna at a time and returns. + * 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 + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff A pointers to a buffer for received samples. The buffer must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param antenna_id Index of antenna from which samples were received + * \returns the number of sample read + */ + .trx_read_func2=NULL, + + /*! \brief print the device statistics + * \param device the hardware to use + * \returns 0 on success + */ + /*! \brief print the device statistics + * \param device the hardware to use + * \returns 0 on success + */ + .trx_get_stats_func=NULL, + + /*! \brief Reset device statistics + * \param device the hardware to use + * \returns 0 in success + */ + .trx_reset_stats_func=NULL, + + /*! \brief Terminate operation of the transceiver -- free all associated resources + * \param device the hardware to use + */ + .trx_end_func=NULL, + + /*! \brief Stop operation of the transceiver + */ + .trx_stop_func=NULL, + + /* Functions API related to UE*/ + + /*! \brief Set RX feaquencies + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \param exmimo_dump_config dump EXMIMO configuration + * \returns 0 in success + */ + .trx_set_freq_func=NULL, + + /*! \brief Set gains + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ + .trx_set_gains_func=NULL, + + /*! \brief RRU Configuration callback + * \param idx RU index + * \param arg pointer to capabilities or configuration + */ + .configure_rru=NULL, + /*! \brief Pointer to generic RRU private information + */ + .thirdparty_priv=NULL, + .thirdparty_init=NULL, + /*! \brief Callback for Third-party RRU Cleanup routine + \param device the hardware configuration to use + */ + .thirdparty_cleanup=NULL, + + /*! \brief Callback for Third-party start streaming routine + \param device the hardware configuration to use + */ + .thirdparty_startstreaming=NULL, + + /*! \brief RRU Configuration callback + * \param idx RU index + * \param arg pointer to capabilities or configuration + */ + .trx_write_init=NULL, + /* \brief Get internal parameter + * \param id parameter to get + * \return a pointer to the parameter + */ + .get_internal_parameter=NULL, + }; + + openair0_device_load(&rfdevice,&openair0_cfg); + + void ** samplesRx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + void ** samplesTx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + + for (int i=0; i<antennas; i++) { + samplesRx[i] = (int32_t *)malloc16_clear( DFT*sizeof(struct complex16) ); + samplesTx[i] = (int32_t *)malloc16_clear( DFT*sizeof(struct complex16) ); + } + + CalibrationInitScope(samplesRx, &rfdevice); + openair0_timestamp timestamp=0; + rfdevice.trx_start_func(&rfdevice); + + while(!oai_exit) { + int readBlockSize = rfdevice.trx_read_func(&rfdevice, + ×tamp, + samplesTx, + DFT, + antennas); + int txs = rfdevice.trx_write_func(&rfdevice, + timestamp+TxAdvanceInDFTSize*DFT, + samplesRx, + DFT, + antennas, + 0); + } + + return 0; +} diff --git a/openair1/PHY/TOOLS/lte_enb_scope.c b/openair1/PHY/TOOLS/lte_enb_scope.c index 19e135ae56a9cfde9a8b92633bf20dfb8f24b59e..220df5b54a3c6629c8259fb6a75b43de141801aa 100644 --- a/openair1/PHY/TOOLS/lte_enb_scope.c +++ b/openair1/PHY/TOOLS/lte_enb_scope.c @@ -44,7 +44,6 @@ FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; char title[255]; unsigned char scope_enb_num_ue = 2; static pthread_t forms_thread; //xforms -int otg_enabled=0; void reset_stats(FL_OBJECT *button, long arg) { int i,j,k; @@ -131,7 +130,7 @@ int enbscope_autoinit(void) { sprintf (title, "LTE UL SCOPE eNB for CC_id %d, UE %d",CC_id,UE_id); fl_show_form (form_enb[CC_id][UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - if (otg_enabled) { + if (0) { fl_set_button(form_enb[CC_id][UE_id]->button_0,1); fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON"); } else { diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index acd22bc78d38cd5d1337d8c7e18623d14e99e23b..d28bb1b8ba221c952909e9e6110d04d5d6679cab 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -27,7 +27,6 @@ #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #define TPUT_WINDOW_LENGTH 100 -int otg_enabled; FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; @@ -57,11 +56,9 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg) { 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); } } @@ -131,7 +128,6 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) { 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 ); @@ -153,7 +149,6 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, int16_t **chest_t; int16_t **chest_f; int16_t *pusch_llr; - int32_t *pusch_comp; int32_t *pucch1_comp; int32_t *pucch1_thres; int32_t *pucch1ab_comp; @@ -184,12 +179,11 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); llr = (float *) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero bit = malloc(coded_bits_per_codeword*sizeof(float)); - - rxsig_t = (int16_t**) phy_vars_enb->RU_list[0]->common.rxdata; + rxsig_t = (int16_t **) phy_vars_enb->RU_list[0]->common.rxdata; chest_t = (int16_t **) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates; chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates; pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr; - pusch_comp = (int32_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0]; + int16_t *pusch_comp= (int16_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0]; pucch1_comp = (int32_t *) phy_vars_enb->pucch1_stats[UE_id]; pucch1_thres = (int32_t *) phy_vars_enb->pucch1_stats_thres[UE_id]; pucch1ab_comp = (int32_t *) phy_vars_enb->pucch1ab_stats[UE_id]; diff --git a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c index d44f8e325befb7ae2dc0fd6af11dfcdfb1e90fc9..a9caf8713bda520524a8949fab353fe2130624d2 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c +++ b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c @@ -32,8 +32,7 @@ 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) -{ +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; @@ -45,8 +44,7 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg) } } -static void dl_traffic_on_off( FL_OBJECT *button, long arg) -{ +static void dl_traffic_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "DL Traffic ON"); otg_enabled = 1; @@ -58,9 +56,7 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg) } } -static void sic_receiver_on_off( FL_OBJECT *button, long arg) -{ - +static void sic_receiver_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "SIC Receiver ON"); use_sic_receiver = 1; @@ -72,8 +68,7 @@ static void sic_receiver_on_off( FL_OBJECT *button, long arg) } } -FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) -{ +FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) { FL_OBJECT *obj; FD_lte_phy_scope_enb *fdui = fl_malloc( sizeof *fdui ); // Define form @@ -145,8 +140,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) void phy_scope_eNB(FD_lte_phy_scope_enb *form, PHY_VARS_eNB *phy_vars_enb, - int UE_id) -{ + int UE_id) { int eNB_id = 0; int i,i2,arx,atx,ind,k; LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_enb->frame_parms; @@ -176,24 +170,27 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, 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 mcs = 0; + // choose max MCS to compute coded_bits_per_codeword if (phy_vars_enb->ulsch[UE_id]!=NULL) { for (harq_pid=0; harq_pid<3; harq_pid++) { mcs = cmax(phy_vars_enb->ulsch[UE_id]->harq_processes[harq_pid]->mcs,mcs); } } + coded_bits_per_codeword = frame_parms->N_RB_UL*12*get_Qm(mcs)*frame_parms->symbols_per_tti; - chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); - llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero + chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); + llr = (float *) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero bit = malloc(coded_bits_per_codeword*sizeof(float)); - rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[eNB_id]; - chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; - chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; - pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr; - pusch_comp = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0]; - pucch1_comp = (int32_t*) phy_vars_enb->pucch1_stats[UE_id]; - pucch1_thres = (int32_t*) phy_vars_enb->pucch1_stats_thres[UE_id]; - pucch1ab_comp = (int32_t*) phy_vars_enb->pucch1ab_stats[UE_id]; + rxsig_t = (int16_t **) phy_vars_enb->common_vars.rxdata[eNB_id]; + chest_t = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; + chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; + pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr; + pusch_comp = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0]; + pucch1_comp = (int32_t *) phy_vars_enb->pucch1_stats[UE_id]; + pucch1_thres = (int32_t *) phy_vars_enb->pucch1_stats_thres[UE_id]; + pucch1ab_comp = (int32_t *) phy_vars_enb->pucch1ab_stats[UE_id]; + // Received signal in time domain of receive antenna 0 if (rxsig_t != NULL) { if (rxsig_t[0] != NULL) { @@ -201,48 +198,61 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, 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_LENGTH_COMPLEX_SAMPLES,"","",""); } + for (arx=1; arx<nb_antennas_rx; arx++) { if (rxsig_t[arx] != NULL) { for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; 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_LENGTH_COMPLEX_SAMPLES,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; - time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); + i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; + time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); 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; arx<nb_antennas_rx; arx++) { if (chest_t[arx] !=NULL) { for (i=0; i<(frame_parms->ofdm_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 (chest_f != NULL) { ind = 0; + for (atx=0; atx<nb_antennas_tx; atx++) { for (arx=0; arx<nb_antennas_rx; arx++) { if (chest_f[(atx<<1)+arx] != NULL) { @@ -256,14 +266,17 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, } } } + // 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,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; arx<nb_antennas_rx; arx++) { fl_add_xyplot_overlay(form->chest_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) { @@ -279,17 +292,21 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, } } } + // PUSCH LLRs if (pusch_llr != NULL) { for (i=0; i<coded_bits_per_codeword; i++) { llr[i] = (float) pusch_llr[i]; bit[i] = (float) i; } + fl_set_xyplot_data(form->pusch_llr,bit,llr,coded_bits_per_codeword,"","",""); } + // PUSCH I/Q of MF Output if (pusch_comp!=NULL) { ind=0; + for (k=0; k<frame_parms->symbols_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]; @@ -297,8 +314,10 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, 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++) { @@ -308,6 +327,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, B_pucch[ind] = ind; C_pucch[ind] = (float)pucch1_thres[ind]; } + fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","",""); fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","",""); fl_add_xyplot_overlay(form->pucch_comp1,1,B_pucch,C_pucch,1024,FL_RED); @@ -315,6 +335,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, 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) ); @@ -329,509 +350,564 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, free(chest_f_abs); } -FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) -{ - FL_OBJECT *obj; - FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui ); - // Define form - fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 1000 ); - // This the whole UI box - obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 1000, "" ); - 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,30,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); - */ - int offset=240; - // LLR of PDSCH - fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500-offset, 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-offset, 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); - // LLR of PDSCH - fdui->pdsch_llr1 = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 720-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdsch_llr1, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_llr1, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_llr1, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_llr1,2); - fl_set_xyplot_xgrid( fdui->pdsch_llr1,FL_GRID_MAJOR); - // I/Q PDSCH comp - fdui->pdsch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 720-offset, 240, 200, "PDSCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdsch_comp1, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_comp1, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_comp1, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_comp1,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 ); - //use_sic_receiver = 0; - fl_set_button(fdui->button_0,0); - fl_set_object_label(fdui->button_0, "SIC Receiver OFF"); - fl_set_object_color(fdui->button_0, FL_RED, FL_RED); - fl_set_object_callback(fdui->button_0, sic_receiver_on_off, 0 ); - fl_hide_object(fdui->button_0); - - fl_end_form( ); - fdui->lte_phy_scope_ue->fdui = fdui; - return fdui; +FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) { + FL_OBJECT *obj; + FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui ); + // Define form + fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 1000 ); + // This the whole UI box + obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 1000, "" ); + 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,30,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); + */ + int offset=240; + // LLR of PDSCH + fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500-offset, 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-offset, 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); + // LLR of PDSCH + fdui->pdsch_llr1 = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 720-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pdsch_llr1, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_llr1, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_llr1, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_llr1,2); + fl_set_xyplot_xgrid( fdui->pdsch_llr1,FL_GRID_MAJOR); + // I/Q PDSCH comp + fdui->pdsch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 720-offset, 240, 200, "PDSCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pdsch_comp1, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_comp1, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_comp1, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_comp1,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 ); + //use_sic_receiver = 0; + fl_set_button(fdui->button_0,0); + fl_set_object_label(fdui->button_0, "SIC Receiver OFF"); + fl_set_object_color(fdui->button_0, FL_RED, FL_RED); + fl_set_object_callback(fdui->button_0, sic_receiver_on_off, 0 ); + fl_hide_object(fdui->button_0); + fl_end_form( ); + fdui->lte_phy_scope_ue->fdui = fdui; + return fdui; } void phy_scope_UE(FD_lte_phy_scope_ue *form, PHY_VARS_UE *phy_vars_ue, int eNB_id, int UE_id, - uint8_t subframe) -{ - int i,arx,atx,ind,k; - LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; - int nsymb_ce = frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti; - uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; - int16_t **rxsig_t; - int16_t **chest_t; - int16_t **chest_f; - int16_t *pdsch_llr,*pdsch_llr1; - int16_t *pdsch_comp,*pdsch_comp1; - int16_t *pdsch_mag0,*pdsch_mag1,*pdsch_magb0,*pdsch_magb1; - int8_t *pdcch_llr; - int16_t *pdcch_comp; - int8_t *pbch_llr; - int16_t *pbch_comp; - float Re,Im,ymax=1; - int num_pdcch_symbols=3; - float *llr0, *bit0, *llr1, *bit1, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch; - float *I, *Q; - float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES]; - float **chest_t_abs; - float time[FRAME_LENGTH_COMPLEX_SAMPLES]; - float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; - int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; - uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id]; - int coded_bits_per_codeword0=0,coded_bits_per_codeword1=1; - int mod0,mod1; - int mcs0 = 0; - int mcs1=0; - unsigned char harq_pid = 0; - int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; - 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; + uint8_t subframe) { + int i,arx,atx,ind,k; + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; + int nsymb_ce = frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti; + uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; + uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; + int16_t **rxsig_t; + int16_t **chest_t; + int16_t **chest_f; + int16_t *pdsch_llr,*pdsch_llr1; + int16_t *pdsch_comp,*pdsch_comp1; + int16_t *pdsch_mag0,*pdsch_mag1,*pdsch_magb0,*pdsch_magb1; + int8_t *pdcch_llr; + int16_t *pdcch_comp; + int8_t *pbch_llr; + int16_t *pbch_comp; + float Re,Im,ymax=1; + int num_pdcch_symbols=3; + float *llr0, *bit0, *llr1, *bit1, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch; + float *I, *Q; + float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES]; + float **chest_t_abs; + float time[FRAME_LENGTH_COMPLEX_SAMPLES]; + float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; + int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; + uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id]; + int coded_bits_per_codeword0=0,coded_bits_per_codeword1=1; + int mod0,mod1; + int mcs0 = 0; + int mcs1=0; + unsigned char harq_pid = 0; + int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; + + 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; + mcs0 = 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_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off) { - // we are in TM5 - fl_show_object(form->button_0); - } - */ - } - fl_show_object(form->button_0); - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { - harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->current_harq_pid; - if (harq_pid>=8) - return; + // Button 0 + /* + if(!phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off) { + // we are in TM5 + fl_show_object(form->button_0); + } + */ + } + + fl_show_object(form->button_0); + + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { + harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->current_harq_pid; + + if (harq_pid>=8) + return; + mcs1 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->mcs; + } + + 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) { + mod0 = get_Qm(mcs0); + coded_bits_per_codeword0 = get_G(frame_parms, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, + get_Qm(mcs0), + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, + num_pdcch_symbols, + frame, + subframe, + beamforming_mode); + } else { + coded_bits_per_codeword0 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + mod0=0; + } + + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { + mod1 = get_Qm(mcs1); + coded_bits_per_codeword1 = get_G(frame_parms, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even, + get_Qm(mcs1), + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl, + num_pdcch_symbols, + frame, + subframe, + beamforming_mode); + } else { + coded_bits_per_codeword1 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + mod1=0; + } + + I = (float *) calloc(nsymb_ce*2,sizeof(float)); + Q = (float *) calloc(nsymb_ce*2,sizeof(float)); + chest_t_abs = (float **) malloc(nb_antennas_rx*sizeof(float *)); + + for (arx=0; arx<nb_antennas_rx; arx++) { + chest_t_abs[arx] = (float *) calloc(frame_parms->ofdm_symbol_size,sizeof(float)); + } + + chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); + //llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. + llr0 = (float *) malloc(coded_bits_per_codeword0*sizeof(float)); + memset((void *)llr0, 0,coded_bits_per_codeword0*sizeof(float)); // init to zero + bit0 = malloc(coded_bits_per_codeword0*sizeof(float)); + //llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. + llr1 = (float *) malloc(coded_bits_per_codeword1*sizeof(float)); + memset((void *)llr1, 0,coded_bits_per_codeword1*sizeof(float)); // init to zero + bit1 = malloc(coded_bits_per_codeword1*sizeof(float)); + llr_pdcch = (float *) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero + bit_pdcch = (float *) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); + rxsig_t = (int16_t **) phy_vars_ue->common_vars.rxdata; + chest_t = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id]; + chest_f = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; + pbch_llr = (int8_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_llr1 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[1]; // stream 1 + pdsch_comp = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0]; + //pdsch_comp = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0]; + //pdsch_comp1 = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1]; + pdsch_comp1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[0][0])[0]; + //pdsch_comp1 = (int16_t*) (phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0][0])[0]; + pdsch_mag0 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0]; + pdsch_mag1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag1[0][0])[0]; + pdsch_magb0 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0]; + pdsch_magb1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb1[0][0])[0]; + fl_freeze_form(form->lte_phy_scope_ue); + + // Received signal in time domain of receive antenna 0 + if (rxsig_t != NULL) { + if (rxsig_t[0] != NULL) { + for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; 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_LENGTH_COMPLEX_SAMPLES,"","",""); } - 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) { - mod0 = get_Qm(mcs0); - coded_bits_per_codeword0 = get_G(frame_parms, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, - get_Qm(mcs0), - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols, - frame, - subframe, - beamforming_mode); - } else { - coded_bits_per_codeword0 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - mod0=0; - } - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { - mod1 = get_Qm(mcs1); - coded_bits_per_codeword1 = get_G(frame_parms, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even, - get_Qm(mcs1), - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols, - frame, - subframe, - beamforming_mode); - } else { - coded_bits_per_codeword1 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - mod1=0; - } - I = (float*) calloc(nsymb_ce*2,sizeof(float)); - Q = (float*) calloc(nsymb_ce*2,sizeof(float)); - chest_t_abs = (float**) malloc(nb_antennas_rx*sizeof(float*)); - for (arx=0;arx<nb_antennas_rx;arx++) { - chest_t_abs[arx] = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float)); - } - chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); - //llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. - llr0 = (float*) malloc(coded_bits_per_codeword0*sizeof(float)); - memset((void *)llr0, 0,coded_bits_per_codeword0*sizeof(float)); // init to zero - bit0 = malloc(coded_bits_per_codeword0*sizeof(float)); - - //llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. - llr1 = (float*) malloc(coded_bits_per_codeword1*sizeof(float)); - memset((void *)llr1, 0,coded_bits_per_codeword1*sizeof(float)); // init to zero - bit1 = malloc(coded_bits_per_codeword1*sizeof(float)); - llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero - bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); - rxsig_t = (int16_t**) phy_vars_ue->common_vars.rxdata; - chest_t = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id]; - chest_f = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; - pbch_llr = (int8_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_llr1 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[1]; // stream 1 - pdsch_comp = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0]; - //pdsch_comp = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0]; - //pdsch_comp1 = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1]; - pdsch_comp1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[0][0])[0]; - //pdsch_comp1 = (int16_t*) (phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0][0])[0]; - pdsch_mag0 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0]; - pdsch_mag1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag1[0][0])[0]; - pdsch_magb0 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0]; - pdsch_magb1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb1[0][0])[0]; - fl_freeze_form(form->lte_phy_scope_ue); - // Received signal in time domain of receive antenna 0 - if (rxsig_t != NULL) { - if (rxsig_t[0] != NULL) { - for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; 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_LENGTH_COMPLEX_SAMPLES,"","",""); - } - for (arx=1;arx<nb_antennas_rx;arx++) { - if (rxsig_t[arx] != NULL) { - for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; 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_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); - } + + for (arx=1; arx<nb_antennas_rx; arx++) { + if (rxsig_t[arx] != NULL) { + for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; 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_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); + } } + } + // Channel Impulse Response (still repeated format) 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][4*i]*chest_t[0][4*i]+chest_t[0][4*i+1]*chest_t[0][4*i+1]); + 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; arx<nb_antennas_rx; arx++) { if (chest_t[arx] !=NULL) { for (i=0; i<(frame_parms->ofdm_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); - fl_set_xyplot_ybounds(form->chest_t,0,ymax); - } - // Channel Frequency Response (includes 5 complex sample for filter) - if (chest_f != NULL) { - ind = 0; - for (atx=0;atx<nb_antennas_tx;atx++) { - for (arx=0;arx<nb_antennas_rx;arx++) { - if (chest_f[(atx<<1)+arx] != NULL) { - for (k=0; k<nsymb_ce; k++) { - freq[ind] = (float)ind; - Re = (float)(chest_f[(atx<<1)+arx][(2*k)]); - Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]); - chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im)); - 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,nsymb_ce,"","",""); - for (arx=1;arx<nb_antennas_rx;arx++) { - fl_add_xyplot_overlay(form->chest_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;atx<nb_antennas_tx;atx++) { - for (arx=0;arx<nb_antennas_rx;arx++) { - fl_add_xyplot_overlay(form->chest_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<1920;i++) { - llr_pbch[i] = (float) pbch_llr[i]; - bit_pbch[i] = (float) i; - } - fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,1920,"","",""); - } - // PBCH I/Q of MF Output - if (pbch_comp!=NULL) { - for (i=0; i<72*2; i++) { - I[i] = pbch_comp[2*i]; - Q[i] = pbch_comp[2*i+1]; + + // Avoid flickering effect + // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); + fl_set_xyplot_ybounds(form->chest_t,0,ymax); + } + + // Channel Frequency Response (includes 5 complex sample for filter) + if (chest_f != NULL) { + ind = 0; + + for (atx=0; atx<nb_antennas_tx; atx++) { + for (arx=0; arx<nb_antennas_rx; arx++) { + if (chest_f[(atx<<1)+arx] != NULL) { + for (k=0; k<nsymb_ce; k++) { + freq[ind] = (float)ind; + Re = (float)(chest_f[(atx<<1)+arx][(2*k)]); + Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]); + chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im)); + ind++; + } } - fl_set_xyplot_data(form->pbch_comp,I,Q,72*2,"","",""); + } } - // PDCCH LLRs - if (pdcch_llr != NULL) { - for (i=0; i<12*frame_parms->N_RB_DL*2*num_pdcch_symbols;i++) { - llr_pdcch[i] = (float) pdcch_llr[i]; - bit_pdcch[i] = (float) i; - } - fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3); - fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); + + // 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,nsymb_ce,"","",""); + + for (arx=1; arx<nb_antennas_rx; arx++) { + fl_add_xyplot_overlay(form->chest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); } - // PDCCH I/Q of MF Output - if (pdcch_comp!=NULL) { - for (i=0; i<12*frame_parms->N_RB_DL*num_pdcch_symbols; i++) { - I[i] = pdcch_comp[2*i]; - Q[i] = pdcch_comp[2*i+1]; + + // other tx antennas + if (nb_antennas_tx > 1) { + if (nb_antennas_rx > 1) { + for (atx=1; atx<nb_antennas_tx; atx++) { + for (arx=0; arx<nb_antennas_rx; arx++) { + fl_add_xyplot_overlay(form->chest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); + } } - fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); + } 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]); + } } - */ - // PDSCH LLRs CW0 - if (pdsch_llr != NULL) { - for (i=0; i<coded_bits_per_codeword0; i++) { - llr0[i] = (float) pdsch_llr[i]; - bit0[i] = (float) i; - } - fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword0); - fl_set_xyplot_data(form->pdsch_llr,bit0,llr0,coded_bits_per_codeword0,"","",""); + } + + /* + // PBCH LLRs + if (pbch_llr != NULL) { + for (i=0; i<1920;i++) { + llr_pbch[i] = (float) pbch_llr[i]; + bit_pbch[i] = (float) i; + } + fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,1920,"","",""); + } + // PBCH I/Q of MF Output + if (pbch_comp!=NULL) { + for (i=0; i<72*2; i++) { + I[i] = pbch_comp[2*i]; + Q[i] = pbch_comp[2*i+1]; + } + fl_set_xyplot_data(form->pbch_comp,I,Q,72*2,"","",""); + } + // PDCCH LLRs + if (pdcch_llr != NULL) { + for (i=0; i<12*frame_parms->N_RB_DL*2*num_pdcch_symbols;i++) { + llr_pdcch[i] = (float) pdcch_llr[i]; + bit_pdcch[i] = (float) i; + } + fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3); + fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); + } + // PDCCH I/Q of MF Output + if (pdcch_comp!=NULL) { + for (i=0; i<12*frame_parms->N_RB_DL*num_pdcch_symbols; i++) { + I[i] = pdcch_comp[2*i]; + Q[i] = pdcch_comp[2*i+1]; + } + fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); + } + */ + // PDSCH LLRs CW0 + if (pdsch_llr != NULL) { + for (i=0; i<coded_bits_per_codeword0; i++) { + llr0[i] = (float) pdsch_llr[i]; + bit0[i] = (float) i; } + + fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword0); + fl_set_xyplot_data(form->pdsch_llr,bit0,llr0,coded_bits_per_codeword0,"","",""); + } + // PDSCH I/Q of MF Output - if (pdsch_comp!=NULL) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { - I[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i]; - Q[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; - ind++; - } - } - fl_set_xyplot_data(form->pdsch_comp,I,Q,ind,"","",""); + if (pdsch_comp!=NULL) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + I[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i]; + Q[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; + ind++; + } } - if (pdsch_mag0 != NULL) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_set_xyplot_data(form->pdsch_comp,I,Q,ind,"","",""); + } + + if (pdsch_mag0 != NULL) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,1,I,Q,ind,FL_GREEN); + } } - if (pdsch_magb0 != NULL) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp,1,I,Q,ind,FL_GREEN); + } + + if (pdsch_magb0 != NULL) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,2,I,Q,ind,FL_RED); + } } - if ((pdsch_mag0 != NULL) && (pdsch_magb0 != NULL)) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp,2,I,Q,ind,FL_RED); + } + + if ((pdsch_mag0 != NULL) && (pdsch_magb0 != NULL)) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = - (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]+ - pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i])* - cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]+ + pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i])* + cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = - (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ - pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* - sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ + pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* + sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,3,I,Q,ind,FL_BLUE); + } } - // PDSCH LLRs CW1 - if (pdsch_llr1 != NULL) { - for (i=0; i<coded_bits_per_codeword1; i++) { - llr1[i] = (float) pdsch_llr1[i]; - bit1[i] = (float) i; - } - fl_set_xyplot_xbounds(form->pdsch_llr1,0,coded_bits_per_codeword1); - fl_set_xyplot_data(form->pdsch_llr1,bit1,llr1,coded_bits_per_codeword1,"","",""); + + fl_add_xyplot_overlay(form->pdsch_comp,3,I,Q,ind,FL_BLUE); + } + + // PDSCH LLRs CW1 + if (pdsch_llr1 != NULL) { + for (i=0; i<coded_bits_per_codeword1; i++) { + llr1[i] = (float) pdsch_llr1[i]; + bit1[i] = (float) i; } - // PDSCH I/Q of MF Output - if (pdsch_comp1!=NULL) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { - I[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i]; - Q[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; - ind++; - } - } - fl_set_xyplot_data(form->pdsch_comp1,I,Q,ind,"","",""); + + fl_set_xyplot_xbounds(form->pdsch_llr1,0,coded_bits_per_codeword1); + fl_set_xyplot_data(form->pdsch_llr1,bit1,llr1,coded_bits_per_codeword1,"","",""); + } + + // PDSCH I/Q of MF Output + if (pdsch_comp1!=NULL) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + I[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i]; + Q[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; + ind++; + } } - if (pdsch_mag1 != NULL) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_set_xyplot_data(form->pdsch_comp1,I,Q,ind,"","",""); + } + + if (pdsch_mag1 != NULL) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,1,I,Q,ind,FL_GREEN); + } } - if (pdsch_magb1 != NULL) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp1,1,I,Q,ind,FL_GREEN); + } + + if (pdsch_magb1 != NULL) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,2,I,Q,ind,FL_RED); + } } - if ((pdsch_mag1 != NULL) && (pdsch_magb1 != NULL)) { - ind=0; - for (k=0; k<frame_parms->symbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp1,2,I,Q,ind,FL_RED); + } + + if ((pdsch_mag1 != NULL) && (pdsch_magb1 != NULL)) { + ind=0; + + for (k=0; k<frame_parms->symbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = - (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]+ - pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i])* - cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]+ + pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i])* + cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = - (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ - pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* - sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ + pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* + sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,3,I,Q,ind,FL_BLUE); - } - /* - // PDSCH Throughput - memcpy((void*)tput_time_ue[UE_id],(void*)&tput_time_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); - memcpy((void*)tput_ue[UE_id],(void*)&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_unfreeze_form(form->lte_phy_scope_ue); - fl_check_forms(); - free(I); - free(Q); - free(chest_f_abs); - free(llr0); - free(bit0); - free(llr1); - free(bit1); - free(bit_pdcch); - free(llr_pdcch); - - //This is done to avoid plotting old data when TB0 is disabled, and TB1 is mapped onto CW0 - /*if (phy_vars_ue->transmission_mode[eNB_id]==3 && phy_vars_ue->transmission_mode[eNB_id]==4){ - for (int i = 0; i<8; ++i) - for (int j = 0; j < 7*2*frame_parms->N_RB_DL*12+4; ++j ) - phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[0][0][i][j]=0; - - for (int m=0; m<coded_bits_per_codeword1; ++m) - phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0; - }*/ + + fl_add_xyplot_overlay(form->pdsch_comp1,3,I,Q,ind,FL_BLUE); + } + + /* + // PDSCH Throughput + memcpy((void*)tput_time_ue[UE_id],(void*)&tput_time_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); + memcpy((void*)tput_ue[UE_id],(void*)&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_unfreeze_form(form->lte_phy_scope_ue); + fl_check_forms(); + free(I); + free(Q); + free(chest_f_abs); + free(llr0); + free(bit0); + free(llr1); + free(bit1); + free(bit_pdcch); + free(llr_pdcch); + //This is done to avoid plotting old data when TB0 is disabled, and TB1 is mapped onto CW0 + /*if (phy_vars_ue->transmission_mode[eNB_id]==3 && phy_vars_ue->transmission_mode[eNB_id]==4){ + for (int i = 0; i<8; ++i) + for (int j = 0; j < 7*2*frame_parms->N_RB_DL*12+4; ++j ) + phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[0][0][i][j]=0; + + for (int m=0; m<coded_bits_per_codeword1; ++m) + phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0; + }*/ } diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index b45c1abf0b580fa187fec265ec5cd987d909660a..90a252dc986b7ea69379e7f0ea2a9ed4abc5ab0b 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -38,10 +38,7 @@ int otg_enabled; const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; -typedef struct { - int16_t r; - int16_t i; -} scopeSample_t; +typedef struct complex16 scopeSample_t; #define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) typedef struct OAIgraph { @@ -59,7 +56,7 @@ typedef struct OAIgraph { double *waterFallAvg; boolean_t initDone; int iteration; - void (*gNBfunct) (struct OAIgraph *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id); + void (*gNBfunct) (struct OAIgraph *graph, scopeData_t *p, int UE_id); void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id); } OAIgraph_t; @@ -135,7 +132,7 @@ static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_ graph->iteration=0; } -static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id), +static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, scopeData_t *p, int UE_id), int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { OAIgraph_t graph; commonGraph(&graph, type, x, y, w, h, label, pointColor); @@ -226,7 +223,8 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { if ( values == NULL ) - return; + return; + fl_winset(FL_ObjWin(graph->graph)); const int samplesPerPixel=datasize/graph->w; int displayPart=graph->waterFallh-ScaleZone; @@ -242,7 +240,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in for (int pix=0; pix<graph->w; pix++) { scopeSample_t *end=values+(pix+1)*samplesPerPixel; end-=2; - AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize); + AssertFatal(end <= values+datasize,"diff : %u", end-values+datasize); double val=0; for (scopeSample_t *s=values+(pix)*samplesPerPixel; @@ -278,7 +276,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in graph->initDone=true; } - fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg)); + fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, 0/*sqrt(avg)*/); graph->iteration++; } @@ -297,10 +295,10 @@ static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const sc } } -static void gNBWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { - NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; +static void gNBWaterFall (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdata[0], + genericWaterFall(graph, (scopeSample_t *)p->ru->common.rxdata[0], frame_parms->samples_per_frame, frame_parms->slots_per_frame, "X axis:one frame in time"); } @@ -318,31 +316,35 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy } */ -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; +static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + const int len=2*p->gNB->frame_parms.ofdm_symbol_size; float *values, *time; oai_xygraph_getbuff(graph, &time, &values, len, 0); const int ant=0; // display antenna 0 for each UE for (int ue=0; ue<nb_UEs; ue++) { - scopeSample_t *data= (scopeSample_t *)phy_vars_gnb->pusch_vars[ue]->ul_ch_estimates_time[ant]; + if ( p->gNB->pusch_vars && p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->ul_ch_estimates_time && + p->gNB->pusch_vars[ue]->ul_ch_estimates_time[ant] ) { + scopeSample_t *data= (scopeSample_t *)p->gNB->pusch_vars[ue]->ul_ch_estimates_time[ant]; + + if (data != NULL) { + for (int i=0; i<len; i++) { + values[i] = SquaredNorm(data[i]); + } - if (data != NULL) { - for (int i=0; i<len; i++) { - values[i] = SquaredNorm(data[i]); + oai_xygraph(graph,time,values, len, ue, 10); } - - oai_xygraph(graph,time,values, len, ue, 10); } } } -static void gNBfreqWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { - NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; +static void gNBfreqWaterFall (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdataF[0], frame_parms->samples_per_frame_wCP, + genericWaterFall(graph, (scopeSample_t *)p->rxdataF, frame_parms->samples_per_frame_wCP, frame_parms->slots_per_frame, - "X axis: Frequency domain, one frame"); + "X axis: Frequency domain, one subframe"); } /* @@ -354,16 +356,18 @@ static void frequencyResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU } */ -static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void puschLLR (OAIgraph_t *graph, scopeData_t *p, 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; for (int ue=0; ue<nb_UEs; ue++) { - int16_t *pusch_llr = (int16_t *)phy_vars_gnb->pusch_vars[ue]->llr; - float *llr, *bit; - oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue); + if ( p->gNB->pusch_vars && + p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->llr ) { + int16_t *pusch_llr = (int16_t *)p->gNB->pusch_vars[ue]->llr; + float *llr, *bit; + oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue); - if (pusch_llr) { for (int i=0; i<coded_bits_per_codeword; i++) { llr[i] = (float) pusch_llr[i]; } @@ -373,16 +377,19 @@ static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_v } } -static void puschIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { - NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; +static void puschIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; for (int ue=0; ue<nb_UEs; ue++) { - scopeSample_t *pusch_comp = (scopeSample_t *) phy_vars_gnb->pusch_vars[ue]->rxdataF_comp[0]; - float *I, *Q; - oai_xygraph_getbuff(graph, &I, &Q, sz, ue); + if ( p->gNB->pusch_vars && + p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->rxdataF_comp && + p->gNB->pusch_vars[ue]->rxdataF_comp[0] ) { + scopeSample_t *pusch_comp = (scopeSample_t *) p->gNB->pusch_vars[ue]->rxdataF_comp[0]; + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz, ue); - if (pusch_comp) { for (int k=0; k<sz; k++ ) { I[k] = pusch_comp[k].r; Q[k] = pusch_comp[k].i; @@ -393,7 +400,7 @@ static void puschIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_va } } -static void pucchEnergy (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void pucchEnergy (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { // PUSCH I/Q of MF Output /* int32_t *pucch1ab_comp = (int32_t *) NULL; //phy_vars_gnb->pucch1ab_stats[UE_id]; @@ -419,10 +426,10 @@ static void pucchEnergy (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *ph */ } -static void pucchIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void pucchIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { } -static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void puschThroughtput (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { // PUSCH Throughput /* float tput_time_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; @@ -437,7 +444,6 @@ static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_ // 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); @@ -486,11 +492,9 @@ static OAI_phy_scope_t *create_phy_scope_gnb(void) { 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, + scopeData_t *p, int UE_id) { static OAI_phy_scope_t *rememberForm=NULL; @@ -505,15 +509,14 @@ void phy_scope_gNB(OAI_phy_scope_t *form, int i=0; while (form->graph[i].graph) { - form->graph[i].gNBfunct(form->graph+i, phy_vars_gnb, phy_vars_ru, UE_id); + form->graph[i].gNBfunct(form->graph+i, p, UE_id); i++; } //fl_check_forms(); } - static void *scope_thread_gNB(void *arg) { - scopeParms_t *p=(scopeParms_t *) arg; + scopeData_t *p=(scopeData_t *) arg; //# ifdef ENABLE_XFORMS_WRITE_STATS // FILE *gNB_stats = fopen("gNB_stats.txt", "w"); //#endif @@ -530,20 +533,31 @@ static void *scope_thread_gNB(void *arg) { OAI_phy_scope_t *form_gnb = create_phy_scope_gnb(); while (!oai_exit) { - phy_scope_gNB(form_gnb, p->gNB, p->ru, nb_ue); + phy_scope_gNB(form_gnb, p, nb_ue); usleep(99*1000); } return NULL; } +static void copyRxdataF(int32_t *data, int slot, void *scopeData) { + scopeData_t *scope=(scopeData_t *)scopeData; + memcpy(scope->rxdataF + slot*scope->gNB->frame_parms.samples_per_slot_wCP, + data, + scope->gNB->frame_parms.samples_per_slot_wCP); +} void gNBinitScope(scopeParms_t *p) { - static scopeParms_t parms; - memcpy(&parms,p,sizeof(parms)); + AssertFatal(p->gNB->scopeData=malloc(sizeof(scopeData_t)),""); + scopeData_t *scope=(scopeData_t *) p->gNB->scopeData; + scope->argc=p->argc; + scope->argv=p->argv; + scope->ru=p->ru; + scope->gNB=p->gNB; + scope->slotFunc=copyRxdataF; + AssertFatal(scope->rxdataF=(int32_t *) calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1),""); pthread_t forms_thread; - threadCreate(&forms_thread, scope_thread_gNB, &parms, "scope", -1, OAI_PRIORITY_RT_LOW); + threadCreate(&forms_thread, scope_thread_gNB, p->gNB->scopeData, "scope", -1, OAI_PRIORITY_RT_LOW); } - static void ueWaterFall (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 genericWaterFall(graph, @@ -552,7 +566,6 @@ static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eN phy_vars_ue->frame_parms.slots_per_frame, "X axis: one frame time"); } - /* replaced by waterfall 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 @@ -561,14 +574,12 @@ static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int 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 ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) { NR_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->frame_parms; //use 1st antenna @@ -578,7 +589,6 @@ static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int phy_vars_ue->frame_parms.slots_per_frame, "X axis: one frame frequency" ); } - /* 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) @@ -614,7 +624,6 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue 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) @@ -630,7 +639,6 @@ static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ 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]) @@ -665,15 +673,14 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i AssertFatal(base <= 180*3,""); oai_xygraph(graph,I,Q,base,0, 10); } - static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDCCH LLRs if (!phy_vars_ue->pdcch_vars[0][eNB_id]->llr) return; - int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols - int Qm = 2; - int coded_bits_per_codeword = num_re*Qm; + //int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols + //int Qm = 2; + int coded_bits_per_codeword = 2*4*100*12; //num_re*Qm; float *llr, *bit; oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0); int base=0; @@ -691,7 +698,6 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ AssertFatal(base <= coded_bits_per_codeword*RX_NB_TH_MAX, ""); oai_xygraph(graph,bit,llr,base,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]) @@ -716,7 +722,6 @@ static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i AssertFatal(base <= nb*RX_NB_TH_MAX, ""); 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]) @@ -744,7 +749,6 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB //fl_set_xyplot_xbounds(form->pdsch_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]) @@ -772,7 +776,6 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ AssertFatal(base <= sz*RX_NB_TH_MAX, ""); oai_xygraph(graph,I,Q,sz*RX_NB_TH_MAX,0,10); } - static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { /* float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; @@ -796,7 +799,6 @@ static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, 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); @@ -866,7 +868,6 @@ static OAI_phy_scope_t *create_phy_scope_nrue( int 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, @@ -890,8 +891,6 @@ void phy_scope_nrUE(OAI_phy_scope_t *form, //fl_check_forms(); } - - static void *nrUEscopeThread(void *arg) { PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg; size_t stksize; @@ -915,13 +914,10 @@ static void *nrUEscopeThread(void *arg) { 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); } - - void nrscope_autoinit(void *dataptr) { AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context"); @@ -956,7 +952,6 @@ static void reset_stats_gNB(FL_OBJECT *button, } } } - static FD_stats_form *create_form_stats_form(int ID) { FL_OBJECT *obj; FD_stats_form *fdui = calloc(( sizeof *fdui ),1); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.h b/openair1/PHY/TOOLS/nr_phy_scope.h index 84b9e66908bec48d048e3cee9f345ae5726cc1fd..e34ddf2c20a420230277a8e38d36fecf2bb9c6c1 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.h +++ b/openair1/PHY/TOOLS/nr_phy_scope.h @@ -33,13 +33,7 @@ //#include "PHY/impl_defs_top.h" #include "PHY/defs_nr_UE.h" -typedef struct { - int *argc; - char **argv; - RU_t *ru; - PHY_VARS_gNB *gNB; -} scopeParms_t; - +#include <openair1/PHY/TOOLS/phy_scope_interface.h> extern RAN_CONTEXT_t RC; #endif diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index 6569f7eab5be3b4b92c92b951bd73ef360fd1329..6e85bca38464403e0f7dce82edea901f7a8e9f3e 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -18,7 +18,7 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ - + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -3103,10 +3103,12 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) dft64((int16_t*)(xtmp),(int16_t*)ytmp,1); dft64((int16_t*)(xtmp+32),(int16_t*)(ytmp+16),1); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128a.m","dfta",ytmp,64,1,1); LOG_M("dft128b.m","dftb",ytmp+16,64,1,1); } +#endif for (i=0; i<16; i++) { bfly2_16(ytmpp,ytmpp+16, y128p,y128p+16, @@ -3155,10 +3157,12 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) } +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128out.m","dft128",y,128,1,1); exit(-1); } +#endif _mm_empty(); _m_empty(); @@ -3183,18 +3187,20 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) transpose4_ooff_simd256(x256+10,xtmp+5,8); transpose4_ooff_simd256(x256+12,xtmp+6,8); transpose4_ooff_simd256(x256+14,xtmp+7,8); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128ina_256.m","dftina",xtmp,64,1,1); LOG_M("dft128inb_256.m","dftinb",xtmp+8,64,1,1); } - +#endif dft64((int16_t*)(xtmp),(int16_t*)ytmp,1); dft64((int16_t*)(xtmp+8),(int16_t*)(ytmp+8),1); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128outa_256.m","dftouta",ytmp,64,1,1); LOG_M("dft128outb_256.m","dftoutb",ytmp+8,64,1,1); } - +#endif for (i=0; i<8; i++) { bfly2_16_256(ytmpp,ytmpp+8, y256p,y256p+8, @@ -3226,10 +3232,12 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) y256[15] = mulhi_int16_simd256(y256[15],ONE_OVER_SQRT2_Q15_256); } +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128.m","dft",y256,128,1,1); exit(-1); } +#endif } #endif @@ -6031,11 +6039,13 @@ void dft1536(int16_t *input, int16_t *output, unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft1536out0.m","o0",tmpo[0],2048,1,1); LOG_M("dft1536out1.m","o1",tmpo[1],2048,1,1); LOG_M("dft1536out2.m","o2",tmpo[2],2048,1,1); } +#endif for (i=0,i2=0; i<1024; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+1024+i),(simd_q15_t*)(output+2048+i), @@ -6193,14 +6203,14 @@ void idft6144(int16_t *input, int16_t *output,unsigned char scale) idft2048((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); idft2048((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); idft2048((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft6144in.m","in",input,6144,1,1); LOG_M("idft6144out0.m","o0",tmpo[0],2048,1,1); LOG_M("idft6144out1.m","o1",tmpo[1],2048,1,1); LOG_M("idft6144out2.m","o2",tmpo[2],2048,1,1); } - +#endif for (i=0,i2=0; i<4096; i+=8,i2+=4) { ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+4096+i),(simd_q15_t*)(output+8192+i), @@ -6260,11 +6270,13 @@ void dft6144(int16_t *input, int16_t *output,unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("ft6144out0.m","o0",tmpo[0],2048,1,1); LOG_M("ft6144out1.m","o1",tmpo[1],2048,1,1); LOG_M("ft6144out2.m","o2",tmpo[2],2048,1,1); } +#endif for (i=0,i2=0; i<4096; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+4096+i),(simd_q15_t*)(output+8192+i), @@ -6336,11 +6348,13 @@ void dft12288(int16_t *input, int16_t *output,unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft12288out0.m","o0",tmpo[0],4096,1,1); LOG_M("dft12288out1.m","o1",tmpo[1],4096,1,1); LOG_M("dft12288out2.m","o2",tmpo[2],4096,1,1); } +#endif for (i=0,i2=0; i<8192; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+8192+i),(simd_q15_t*)(output+16384+i), @@ -6392,14 +6406,14 @@ void idft12288(int16_t *input, int16_t *output,unsigned char scale) idft4096((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),scale); idft4096((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),scale); idft4096((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),scale); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft12288in.m","in",input,12288,1,1); LOG_M("idft12288out0.m","o0",tmpo[0],4096,1,1); LOG_M("idft12288out1.m","o1",tmpo[1],4096,1,1); LOG_M("idft12288out2.m","o2",tmpo[2],4096,1,1); } - +#endif for (i=0,i2=0; i<8192; i+=8,i2+=4) { ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+8192+i),(simd_q15_t*)(output+16384+i), @@ -6429,9 +6443,11 @@ void idft12288(int16_t *input, int16_t *output,unsigned char scale) } _mm_empty(); _m_empty(); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft12288out.m","out",output,6144,1,1); } +#endif } int16_t twa18432[12288] __attribute__((aligned(32))); @@ -6560,11 +6576,13 @@ void dft24576(int16_t *input, int16_t *output,unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft24576out0.m","o0",tmpo[0],8192,1,1); LOG_M("dft24576out1.m","o1",tmpo[1],8192,1,1); LOG_M("dft24576out2.m","o2",tmpo[2],8192,1,1); } +#endif for (i=0,i2=0; i<16384; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+16384+i),(simd_q15_t*)(output+32768+i), @@ -6595,9 +6613,11 @@ void dft24576(int16_t *input, int16_t *output,unsigned char scale) } _mm_empty(); _m_empty(); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("out.m","out",output,24576,1,1); } +#endif } void idft24576(int16_t *input, int16_t *output,unsigned char scale) @@ -6617,14 +6637,14 @@ void idft24576(int16_t *input, int16_t *output,unsigned char scale) idft8192((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); idft8192((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); idft8192((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); - + #ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft24576in.m","in",input,24576,1,1); LOG_M("idft24576out0.m","o0",tmpo[0],8192,1,1); LOG_M("idft24576out1.m","o1",tmpo[1],8192,1,1); LOG_M("idft24576out2.m","o2",tmpo[2],8192,1,1); } - +#endif for (i=0,i2=0; i<16384; i+=8,i2+=4) { ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+16384+i),(simd_q15_t*)(output+32768+i), @@ -6653,10 +6673,11 @@ void idft24576(int16_t *input, int16_t *output,unsigned char scale) } _mm_empty(); _m_empty(); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft24576out.m","out",output,24576,1,1); } +#endif } int16_t twa36864[24576] __attribute__((aligned(32))); @@ -6680,13 +6701,13 @@ void dft36864(int16_t *input, int16_t *output,uint8_t scale) { dft12288((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); dft12288((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); dft12288((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft36864out0.m","o0",tmpo[0],12288,1,1); LOG_M("dft36864out1.m","o1",tmpo[1],12288,1,1); LOG_M("dft36864out2.m","o2",tmpo[2],12288,1,1); } - +#endif for (i=0,i2=0; i<24576; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+24576+i),(simd_q15_t*)(output+49152+i), @@ -6716,9 +6737,11 @@ void dft36864(int16_t *input, int16_t *output,uint8_t scale) { } _mm_empty(); _m_empty(); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("out.m","out",output,36864,1,1); } +#endif } void idft36864(int16_t *input, int16_t *output,uint8_t scale) { diff --git a/openair1/PHY/TOOLS/phy_scope_interface.c b/openair1/PHY/TOOLS/phy_scope_interface.c index af237b2325e8a3f2fc035478cff4df4f39974901..7cd68c53d23d4cc8df04786dfb7cd82349666d6f 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.c +++ b/openair1/PHY/TOOLS/phy_scope_interface.c @@ -35,6 +35,7 @@ #include "phy_scope_interface.h" #define SOFTSCOPE_ENDFUNC_IDX 0 + static loader_shlibfunc_t scope_fdesc[]= {{"end_forms",NULL}}; int load_softscope(char *exectype, void *initarg) { diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index adf04d5ea4a6a7f664e23eab35c8bff82d46121e..8b747d575d1720f95ae192013a31dfe914ed7ad8 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -29,7 +29,26 @@ * \note * \warning */ +#ifndef __PHY_SCOPE_INTERFACE_H__ +#define __PHY_SCOPE_INTERFACE_H__ +#include <openair1/PHY/defs_gNB.h> +typedef struct { + int *argc; + char **argv; + RU_t *ru; + PHY_VARS_gNB *gNB; +} scopeParms_t; +typedef struct scopeData_s { + int *argc; + char **argv; + RU_t *ru; + PHY_VARS_gNB *gNB; + int32_t * rxdataF; + void (*slotFunc)(int32_t* data, int slot, void * scopeData); +} scopeData_t; + int load_softscope(char *exectype, void *initarg); int end_forms(void) ; +#endif diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index cfa3b93007f06d16ebe7aa42cf285dbe1b2fce26..001770c876f376dd03b404dd7e92816fcc8d8a9e 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -26,9 +26,12 @@ // global var for openair performance profiler int opp_enabled = 0; +double cpu_freq_GHz __attribute__ ((aligned(32))); +double cpu_freq_GHz __attribute__ ((aligned(32)))=0.0; double get_cpu_freq_GHz(void) { + if (cpu_freq_GHz <1 ) { time_stats_t ts = {0}; reset_meas(&ts); ts.trials++; @@ -37,6 +40,7 @@ double get_cpu_freq_GHz(void) ts.diff = (rdtsc_oai()-ts.in); cpu_freq_GHz = (double)ts.diff/1000000000; printf("CPU Freq is %f \n", cpu_freq_GHz); + } return cpu_freq_GHz; } @@ -99,10 +103,11 @@ void print_meas(time_stats_t *ts, if (ts->trials>0) { //printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials); if ((total_exec_time == NULL) || (sf_exec_time== NULL)) { - fprintf(stderr, "%25s: %15.3f us; %15d;\n", + fprintf(stderr, "%25s: %15.3f us; %15d; %15.3f us;\n", name, (ts->diff/ts->trials/cpu_freq_GHz/1000.0), - ts->trials); + ts->trials, + ts->max/cpu_freq_GHz/1000.0); } else { fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n", name, diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 2deab40f27fef6bb44ee41327ffd6e38bd0901f0..e2ceef84050de9f7ddf3e8664948724aa2f50eb0 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -33,7 +33,7 @@ #include <linux/types.h> // global var to enable openair performance profiler extern int opp_enabled; -double cpu_freq_GHz __attribute__ ((aligned(32)));; +extern double cpu_freq_GHz __attribute__ ((aligned(32)));; #if defined(__x86_64__) || defined(__i386__) typedef struct { diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index db7ac3d813cb6266cc99b41dd0681db4a70d3d7c..4c68c15cb68fb60ee351c9cad227fb0ca63adef4 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -44,6 +44,11 @@ struct complex { double y; }; +struct complexd { + double r; + double i; +}; + struct complexf { float r; float i; diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 885f955a2a8fe8b9144e7e05b41606fd0ab70b53..86c94421f25780afa0dc022cf4d8b48debcc6fec 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -92,17 +92,17 @@ typedef enum { typedef struct { - /// \brief Holds the transmit data in the frequency domain. + /// \brief Holds the transmit data in the frequency domain (1 frame). /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ + /// - second index: ? [0..samples_per_frame[ int32_t **txdata; - /// \brief holds the transmit data after beamforming in the frequency domain. + /// \brief holds the transmit data after beamforming in the frequency domain (1 slot). /// - first index: tx antenna [0..nb_antennas_tx[ - /// - second index: sample [0..] + /// - second index: sample [0..samples_per_slot_woCP] int32_t **txdataF_BF; - /// \brief holds the transmit data before beamforming in the frequency domain. - /// - first index: tx antenna [0..nb_antennas_tx[ - /// - second index: sample [0..] + /// \brief holds the transmit data before beamforming in the frequency domain (1 frame). + /// - first index: tx antenna [0..nb_antenna_ports[ + /// - second index: sample [0..samples_per_frame_woCP] int32_t **txdataF; /// \brief holds the transmit data before beamforming for epdcch/mpdcch /// - first index : tx antenna [0..nb_epdcch_antenna_ports[ @@ -128,6 +128,10 @@ typedef struct { /// - second index: tx antenna [0..nb_antennas_tx[ /// - third index: frequency [0..] int32_t **tdd_calib_coeffs; + /// \brief Anaglogue beam ID for each OFDM symbol (used when beamforming not done in RU) + /// - first index: antenna port + /// - second index: beam_id [0.. symbols_per_frame[ + uint8_t **beam_id; } RU_COMMON; diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index 27765a854810ba30733b5cc6ffef7ac9f640c5ac..70ca77fcc6cf011e7535734de6742ff3e8d4396f 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -867,8 +867,10 @@ typedef enum { NOT_SYNCHED=0, PRACH=1, RA_RESPONSE=2, - PUSCH=3, - RESYNCH=4 + RA_WAIT_CR=3, + PUSCH=4, + RESYNCH=5, + NUM_UE_MODE=6 } UE_MODE_t; #define FOREACH_PARALLEL(GEN) \ diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 822f4c39862c8f0588a5798d3b2890eefc3bc58f..129f7a9a712ea7b958329496462665f4a7a79d64 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -133,13 +133,39 @@ typedef struct { int total_bytes_rx; int current_Qm; int current_RI; + int power[NB_ANTENNAS_RX]; + int noise_power[NB_ANTENNAS_RX]; + int DTX; } NR_gNB_SCH_STATS_t; +typedef struct { + int frame; + uint16_t rnti; + int pucch0_sr_trials; + int pucch0_sr_thres; + int current_pucch0_sr_stat0; + int current_pucch0_sr_stat1; + int pucch0_positive_SR; + int pucch01_trials; + int pucch0_n00; + int pucch0_n01; + int pucch0_thres; + int current_pucch0_stat0; + int current_pucch0_stat1; + int pucch01_DTX; + int pucch02_trials; + int pucch02_DTX; + int pucch2_trials; + int pucch2_DTX; +} NR_gNB_UCI_STATS_t; + typedef struct { /// Pointers to variables related to DLSCH harq process NR_DL_gNB_HARQ_t harq_process; - /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) + /// TX buffers for UE-spec transmission (antenna layers 1,...,4 after to precoding) int32_t *txdataF[NR_MAX_NB_LAYERS]; + /// TX buffers for UE-spec transmission (antenna ports 1000 or 1001,...,1007, before precoding) + int32_t *txdataF_precoding[NR_MAX_NB_LAYERS]; /// Modulated symbols buffer int32_t *mod_symbs[NR_MAX_NB_CODEWORDS]; /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? @@ -180,7 +206,10 @@ typedef struct { int16_t sqrt_rho_b; } NR_gNB_DLSCH_t; - +typedef struct { + bool active; + nfapi_nr_dl_tti_ssb_pdu ssb_pdu; +} NR_gNB_SSB_t; typedef struct { int frame; @@ -385,8 +414,12 @@ typedef struct { /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? /// - first index: eNB id [0..2] (hard coded) /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports. - /// - third index: sample [0..] + /// - third index: sample [0..samples_per_frame_woCP] int32_t **txdataF; + /// \brief Anaglogue beam ID for each OFDM symbol (used when beamforming not done in RU) + /// - first index: antenna port + /// - second index: beam_id [0.. symbols_per_frame[ + uint8_t **beam_id; int32_t *debugBuff; int32_t debugBuff_sample_offset; } NR_gNB_COMMON; @@ -456,7 +489,13 @@ typedef struct { /// - second index: ? [0..168*N_RB_UL[ int32_t **ul_ch_magb1[8][8]; /// measured RX power based on DRS - int ulsch_power[2]; + int ulsch_power[8]; + /// total signal over antennas + int ulsch_power_tot; + /// measured RX noise power + int ulsch_noise_power[8]; + /// total noise over antennas + int ulsch_noise_power_tot; /// \brief llr values. /// - first index: ? [0..1179743] (hard coded) int16_t *llr; @@ -477,6 +516,8 @@ typedef struct { int16_t *ul_valid_re_per_slot; /// flag to verify if channel level computation is done uint8_t cl_done; + /// flag to indicate DTX on reception + int DTX; } NR_gNB_PUSCH; /// Context data structure for RX/TX portion of slot processing @@ -553,8 +594,10 @@ typedef struct gNB_L1_proc_t_s { pthread_t pthread_single; /// pthread structure for asychronous RX/TX processing thread pthread_t pthread_asynch_rxtx; - /// pthread structure for printing time meas + /// pthread structure for dumping L1 stats pthread_t L1_stats_thread; + /// pthread structure for printing time meas + pthread_t process_stats_thread; /// flag to indicate first RX acquisition int first_rx; /// flag to indicate first TX transmission @@ -620,6 +663,8 @@ typedef struct { unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][275]; //! estimated avg noise power per RB per RX ant (dB) unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275]; + //! estimated avg subband noise power (dB) + unsigned short n0_subband_power_avg_dB; //! estimated avg noise power per RB (dB) short n0_subband_power_tot_dB[275]; //! estimated avg noise power per RB (dBm) @@ -655,6 +700,7 @@ typedef struct { int prach_I0; } PHY_MEASUREMENTS_gNB; +#define MAX_NUM_NR_PRACH_PREAMBLES 64 #define MAX_NUM_NR_RX_RACH_PDUS 4 #define MAX_NUM_NR_RX_PRACH_PREAMBLES 4 #define MAX_UL_PDUS_PER_SLOT 8 @@ -705,10 +751,10 @@ typedef struct PHY_VARS_gNB_s { // nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu; // nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu; - nfapi_nr_dl_tti_ssb_pdu ssb_pdu; uint16_t num_pdsch_rnti[80]; - NR_gNB_PBCH pbch; + NR_gNB_SSB_t ssb[64]; + NR_gNB_PBCH pbch; nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL]; NR_gNB_COMMON common_vars; NR_gNB_PRACH prach_vars; @@ -724,7 +770,7 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_SCH_STATS_t dlsch_stats[NUMBER_OF_NR_SCH_STATS_MAX]; /// statistics for ULSCH measurement collection NR_gNB_SCH_STATS_t ulsch_stats[NUMBER_OF_NR_SCH_STATS_MAX]; - + NR_gNB_UCI_STATS_t uci_stats[NUMBER_OF_NR_UCI_STATS_MAX]; t_nrPolar_params *uci_polarParams; uint8_t pbch_configured; @@ -791,6 +837,9 @@ typedef struct PHY_VARS_gNB_s { int prach_energy_counter; int pucch0_thres; + int pusch_thres; + int prach_thres; + uint64_t bad_pucch; /* time_stats_t phy_proc; */ @@ -813,6 +862,7 @@ typedef struct PHY_VARS_gNB_s { time_stats_t dlsch_segmentation_stats; time_stats_t rx_pusch_stats; + time_stats_t ul_indication_stats; time_stats_t ulsch_decoding_stats; time_stats_t ulsch_rate_unmatching_stats; time_stats_t ulsch_ldpc_decoding_stats; @@ -836,7 +886,7 @@ typedef struct PHY_VARS_gNB_s { tpool_t *threadPool; int nbDecode; uint8_t pusch_proc_threads; - + void * scopeData; } PHY_VARS_gNB; typedef struct LDPCDecode_s { diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 390574a66b049c19648fc8ca6cf6573265467ba1..bf0a7bc9e5474dd7cfac255341e3bf51b7923e8a 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -142,6 +142,7 @@ typedef struct { uint32_t rsrp[7]; float rsrp_filtered[7]; // after layer 3 filtering float rsrq_filtered[7]; + short rsrp_dBm[7]; // common measurements //! estimated noise power (linear) unsigned int n0_power[NB_ANTENNAS_RX]; @@ -187,7 +188,7 @@ typedef struct { //! estimated rssi (dBm) short rx_rssi_dBm[NUMBER_OF_CONNECTED_gNB_MAX]; //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) - int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][2]; + int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][4][4]; //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) int rx_correlation_dB[NUMBER_OF_CONNECTED_gNB_MAX][2]; @@ -332,12 +333,10 @@ typedef struct { int32_t **dl_ch_magb1[8][8]; /// \brief Magnitude of Downlink Channel, first layer (256QAM level). int32_t **dl_ch_magr0; - /// \brief Cross-correlation of two gNB signals. - /// - first index: rx antenna [0..nb_antennas_rx[ + /// \brief Cross-correlation Matrix of the gNB Tx channel signals. + /// - first index: aatx*n_rx+aarx for all aatx=[0..n_tx[ and aarx=[0..nb_rx[ /// - second index: symbol [0..] - int32_t **rho; - /// never used... always send dl_ch_rho_ext instead... - int32_t **rho_i; + int32_t ***rho; /// \brief Pointers to llr vectors (2 TBs). /// - first index: ? [0..1] (hard coded) /// - second index: ? [0..1179743] (hard coded) @@ -842,9 +841,15 @@ typedef struct { /// PDSCH DMRS uint32_t ****nr_gold_pdsch[NUMBER_OF_CONNECTED_eNB_MAX]; + // Scrambling IDs used in PDSCH DMRS + uint16_t scramblingID[2]; + /// PDCCH DMRS uint32_t ***nr_gold_pdcch[NUMBER_OF_CONNECTED_eNB_MAX]; + // Scrambling IDs used in PDCCH DMRS + uint16_t scramblingID_pdcch; + /// PUSCH DMRS sequence uint32_t ****nr_gold_pusch_dmrs; diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index ceb75c255472d725cb13a07e03607fe476a9b820..fad578c8b01920268afdf2e1db169c2c3413f4f5 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -214,10 +214,8 @@ typedef enum { #define NB_SRS_PERIOD (17) -const uint16_t srs_period[NB_SRS_PERIOD] -#ifdef INIT_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H +static const uint16_t srs_period[NB_SRS_PERIOD] = { 1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, 2560} -#endif ; /// SRS_Resource of SRS_Config information element from 38.331 RRC specifications @@ -796,7 +794,6 @@ typedef struct { uint8_t initial_CS_indexes[MAX_NB_CYCLIC_SHIFT]; } initial_pucch_resource_t; -const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE]; /* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ /* structure with all possible fields for pucch format from 0 to 4 */ typedef struct { @@ -1051,11 +1048,6 @@ typedef struct { #define NB_SR_PERIOD (15) -const uint16_t scheduling_request_periodicity[NB_SR_PERIOD] -#ifdef INIT_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H -= { 0, 0, 1, 2, 4, 5, 8, 10, 16, 20, 40, 80, 160, 320, 640 } -#endif -; typedef enum { sr_sym2 = 0, diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h index a8548af8dc983f1f5cc2490efa953a40dc7d0dc5..fa021ffe81860cba2a9ed26d5717a565ad156fda 100644 --- a/openair1/PHY/impl_defs_top.h +++ b/openair1/PHY/impl_defs_top.h @@ -275,6 +275,12 @@ #define NR_UE_CAPABILITY_SLOT_RX_TO_TX (6) /* FFS_NR_TODO it defines ue capability which is the number of slots */ /* - between reception of pdsch and tarnsmission of its acknowlegment */ /* - between reception of un uplink grant and its related transmission */ +#ifndef NO_RAT_NR + #define DURATION_RX_TO_TX (NR_UE_CAPABILITY_SLOT_RX_TO_TX) /* for NR this will certainly depends to such UE capability which is not yet defined */ +#else + #define DURATION_RX_TO_TX (6) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */ +#endif + #define NR_MAX_HARQ_PROCESSES (16) #define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 6.1 UE procedure for receiving the physical uplink shared channel */ diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h index 165ed961b30f0a40a3723c2ca275a88152fef815..4ba5e328e3f960fc733d1a4aba45d4d605fc862f 100644 --- a/openair1/PHY/phy_extern.h +++ b/openair1/PHY/phy_extern.h @@ -48,12 +48,6 @@ extern short primary_synch2[144]; extern unsigned char primary_synch0_tab[72]; extern unsigned char primary_synch1_tab[72]; extern unsigned char primary_synch2_tab[72]; -extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_extern_nr_ue.h b/openair1/PHY/phy_extern_nr_ue.h index 700419c61c9b9268978b78671c21d5fbbd871787..f1704a7902e26dd685ef3559c4b24c7f895bd522 100644 --- a/openair1/PHY/phy_extern_nr_ue.h +++ b/openair1/PHY/phy_extern_nr_ue.h @@ -55,9 +55,6 @@ extern unsigned char primary_synch2_tab[72]; extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h index 622551c2fe9891ad7a77df04ef2de7ed9e0d5953..fdaf6eaa8904eef42d148866aef80ae02e685459 100644 --- a/openair1/PHY/phy_extern_ue.h +++ b/openair1/PHY/phy_extern_ue.h @@ -47,12 +47,6 @@ extern short primary_synch2[144]; extern unsigned char primary_synch0_tab[72]; extern unsigned char primary_synch1_tab[72]; extern unsigned char primary_synch2_tab[72]; -extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h index 5e2be8bd8f76181ff7f660da8902ab2d1bf88415..dadb1649ec68ee10cfbb756b4e03246c05642f4d 100644 --- a/openair1/PHY/phy_vars.h +++ b/openair1/PHY/phy_vars.h @@ -33,9 +33,6 @@ char* namepointer_log2; #include "PHY/LTE_REFSIG/primary_synch.h" -int16_t *primary_synch0_time; -int16_t *primary_synch1_time; -int16_t *primary_synch2_time; #include "PHY/LTE_TRANSPORT/transport_vars.h" diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h index e90c2641aa7f852ff4e5cf5a855db0d6ecf0a2d5..469a5c475470fe044b27382bc1acfd9f3f60001c 100644 --- a/openair1/PHY/phy_vars_ue.h +++ b/openair1/PHY/phy_vars_ue.h @@ -33,9 +33,6 @@ char *namepointer_log2; #include "PHY/LTE_REFSIG/primary_synch.h" -int16_t *primary_synch0_time; -int16_t *primary_synch1_time; -int16_t *primary_synch2_time; PHY_VARS_UE ***PHY_vars_UE_g; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 38307a7b9ee8b477b6ec761219df0ba007eb3d17..d894061acd55c8e78a8f1e35ac81356e2ccc637b 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -40,6 +40,7 @@ #include "common/utils/LOG/log.h" #include <common/utils/system.h> #include "common/utils/LOG/vcd_signal_dumper.h" +#include <nfapi/oai_integration/nfapi_pnf.h> #include "assertions.h" #include "msc.h" @@ -51,7 +52,6 @@ #define MBMS_NFAPI_SCHEDULER -nfapi_ue_release_request_body_t release_rntis; int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor) { uint32_t Nre,sumKr,MPR_x100,Kr,r; diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index d65d3b54bb90ab6d264561e8a3071cd71c280f30..88f3dca070ce092aea91a0759d285729330125f5 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -50,8 +50,15 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot, AssertFatal(dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag== 1, "bchPayloadFlat %d != 1\n", dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag); - LOG_D(PHY,"%d.%d : pbch_pdu: %x\n",frame,slot,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload); - memcpy((void*)&gNB->ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu)); + uint8_t i_ssb = dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex; + + LOG_D(PHY,"%d.%d : ssb index %d pbch_pdu: %x\n",frame,slot,i_ssb,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload); + if (gNB->ssb[i_ssb].active) + AssertFatal(1==0,"SSB PDU with index %d already active\n",i_ssb); + else { + gNB->ssb[i_ssb].active = true; + memcpy((void*)&gNB->ssb[i_ssb].ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu)); + } } /*void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int subframe,gNB_L1_rxtx_proc_t *proc, @@ -166,14 +173,11 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ gNB->dlsch[i][0]->harq_mask=0; } - gNB->pbch_configured=0; - for (int i=0;i<number_dl_pdu;i++) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu = &DL_req->dl_tti_request_body.dl_tti_pdu_list[i]; LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType); switch (dl_tti_pdu->PDUType) { case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: - gNB->pbch_configured=1; if(NFAPI_MODE != NFAPI_MODE_VNF) handle_nr_nfapi_ssb_pdu(gNB,frame,slot, @@ -257,4 +261,4 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ } -} \ No newline at end of file +} diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 5a98b17cea7a8b0b77b8629ac7b3b73e63c36064..533dbb8e1a3ecb72f88327ba518df8e0236ba5e7 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -122,7 +122,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { gNB->prach_energy_counter); if ((gNB->prach_energy_counter == 100) && - (max_preamble_energy[0] > gNB->measurements.prach_I0+100)) { + (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) { LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d start symbol %u freq index %u\n", gNB->Mod_id, diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index a78b1f48056ffa09963ef58045b1f7fd06852d30..1b2baf03f53f9bce7f63a7d14f0c7595dbc7fde9 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -208,6 +208,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { memcpy((void*)&ru->common.txdataF[i][j*fp->ofdm_symbol_size], (void*)&gNB->common_vars.txdataF[i][j*fp->ofdm_symbol_size + txdataF_offset], fp->ofdm_symbol_size*sizeof(int32_t)); + } }//num_gNB == 1 @@ -279,13 +280,12 @@ static void *nr_feptx_thread(void *param) { RU_feptx_t *feptx = (RU_feptx_t *)param; RU_t *ru; - int aa, slot, start, l, nb_antenna_ports, ret; + int aa, slot, start, l, ret; int i; int32_t ***bw; NR_DL_FRAME_PARMS *fp; int ofdm_mask_full; int txdataF_offset; - int32_t *txdataF; while (!oai_exit) { ret = 0; if (wait_on_condition(&feptx->mutex_feptx,&feptx->cond_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; @@ -299,31 +299,39 @@ static void *nr_feptx_thread(void *param) { l = feptx->symbol; fp = ru->nr_frame_parms; start = feptx->symbol; - nb_antenna_ports = feptx->nb_antenna_ports; ofdm_mask_full = (1<<(ru->nb_tx*2))-1; if(ru->num_gNB != 0){ txdataF_offset = ((slot%2)*fp->samples_per_slot_wCP); ////////////precoding//////////// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 1); + start_meas(&ru->precoding_stats); + + for(i=0; i<ru->nb_log_antennas; ++i) { + memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot+l], + (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot+l], + (fp->symbols_per_slot>>1)*sizeof(uint8_t)); + } + + if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { - memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], - (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], - (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); + memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], + (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], + (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); } else { bw = ru->beam_weights[0]; - txdataF = &ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset]; for(i=0; i<fp->symbols_per_slot>>1; ++i){ - nr_beam_precoding(&txdataF, + nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, ru->common.txdataF_BF, fp, bw, slot, l+i, aa, - nb_antenna_ports); + ru->nb_log_antennas, + txdataF_offset);//here } } stop_meas(&ru->precoding_stats); @@ -362,7 +370,8 @@ static void *nr_feptx_thread(void *param) { slot, l, aa, - nb_antenna_ports); + ru->nb_log_antennas, + 0); } stop_meas(&ru->precoding_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 0); @@ -459,10 +468,14 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT) return; - for(i=0; i<ru->nb_log_antennas; ++i) + for(i=0; i<ru->nb_log_antennas; ++i) { memcpy((void*)ru->common.txdataF[i], (void*)&gNB->common_vars.txdataF[i][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)); + memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot], + (void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot], + fp->symbols_per_slot*sizeof(uint8_t)); + } if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { @@ -485,7 +498,8 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { tti_tx, l, aa, - ru->nb_log_antennas); + ru->nb_log_antennas, + 0); }// for (aa=0;aa<ru->nb_tx;aa++) }// for (l=0;l<fp->symbols_per_slot;l++) }// if (ru->nb_tx == 1) @@ -520,8 +534,7 @@ void nr_fep0(RU_t *ru, int first_half) { ru->common.rxdataF[aa], l, proc->tti_rx, - ru->N_TA_offset, - 0); + ru->N_TA_offset); } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 0); @@ -657,8 +670,7 @@ void nr_fep_full(RU_t *ru, int slot) { ru->common.rxdataF[aa], l, proc->tti_rx, - ru->N_TA_offset, - 0); + ru->N_TA_offset); } } diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index 3864b2fcb20a0dc8bec2718984bcf4348e861233..9be678059710977f460be65f0aa2aa294ccf6ac0 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -41,7 +41,7 @@ * * OUTPUT: table of uplink symbol for each slot for 2 frames * -* RETURN : 0 if tdd has been properly configurated +* RETURN : nb_periods_per_frame if tdd has been properly configurated * -1 tdd configuration can not be done * * DESCRIPTION : generate bit map for uplink symbol for each slot for several frames @@ -179,7 +179,7 @@ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, LOG_E(PHY,"set_tdd_configuration_nr: additionnal tdd configuration 2 is not supported for tdd configuration \n"); return (-1); }*/ - return (0); + return (nb_periods_per_frame); } /******************************************************************* diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index da32be23749714ec4e585501069c5a2f8d059d06..b472d7a9bab5434360075e5448d2f38d682cf3ec 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -67,74 +67,63 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier,cfg->ssb_table.ssb_offset_point_a.value,sco); } -void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { +void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu) { NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; int **txdataF = gNB->common_vars.txdataF; uint8_t ssb_index, n_hf; - uint16_t ssb_start_symbol, rel_slot; + uint16_t ssb_start_symbol; int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; uint16_t slots_per_hf = (fp->slots_per_frame)>>1; - n_hf = fp->half_frame_bit; + if (slot<slots_per_hf) + n_hf=0; + else + n_hf=1; - // if SSB periodicity is 5ms, they are transmitted in both half frames - if ( cfg->ssb_table.ssb_period.value == 0) { - if (slot<slots_per_hf) - n_hf=0; - else - n_hf=1; - } + ssb_index = ssb_pdu.ssb_pdu_rel15.SsbBlockIndex; + LOG_D(PHY,"common_signal_procedures: frame %d, slot %d ssb index %d\n",frame,slot,ssb_index); - // to set a effective slot number in the half frame where the SSB is supposed to be - rel_slot = (n_hf)? (slot-slots_per_hf) : slot; - - LOG_D(PHY,"common_signal_procedures: frame %d, slot %d\n",frame,slot); - - if(rel_slot<38 && rel_slot>=0) { // there is no SSB beyond slot 37 - - for (int i=0; i<2; i++) { // max two SSB per frame - - ssb_index = i + SSB_Table[rel_slot]; // computing the ssb_index - - if ((ssb_index<64) && ((fp->L_ssb >> (63-ssb_index)) & 0x01)) { // generating the ssb only if the bit of L_ssb at current ssb index is 1 - fp->ssb_index = ssb_index; - int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp); // computing the starting symbol for current ssb - ssb_start_symbol = ssb_start_symbol_abs % fp->symbols_per_slot; // start symbol wrt slot - - nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier - - LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); - nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - - if (cfg->carrier_config.num_tx_ant.value <= 4) - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - else - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - - if (T_ACTIVE(T_GNB_PHY_MIB)) { - unsigned char bch[3]; - bch[0] = gNB->ssb_pdu.ssb_pdu_rel15.bchPayload & 0xff; - bch[1] = (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload >> 8) & 0xff; - bch[2] = (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload >> 16) & 0xff; - T(T_GNB_PHY_MIB, T_INT(0) /* module ID */, T_INT(frame), T_INT(slot), T_BUFFER(bch, 3)); - } + int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp,ssb_index); // computing the starting symbol for current ssb + ssb_start_symbol = ssb_start_symbol_abs % fp->symbols_per_slot; // start symbol wrt slot - nr_generate_pbch(&gNB->pbch, - &gNB->ssb_pdu, - gNB->nr_pbch_interleaver, - &txdataF[0][txdataF_offset], - AMP, - ssb_start_symbol, - n_hf, frame, cfg, fp); + nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier - } - } + LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); + nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + + if (cfg->carrier_config.num_tx_ant.value <= 4) + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + else + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + + if (T_ACTIVE(T_GNB_PHY_MIB)) { + unsigned char bch[3]; + bch[0] = ssb_pdu.ssb_pdu_rel15.bchPayload & 0xff; + bch[1] = (ssb_pdu.ssb_pdu_rel15.bchPayload >> 8) & 0xff; + bch[2] = (ssb_pdu.ssb_pdu_rel15.bchPayload >> 16) & 0xff; + T(T_GNB_PHY_MIB, T_INT(0) /* module ID */, T_INT(frame), T_INT(slot), T_BUFFER(bch, 3)); } + + // Beam_id is currently used only for FR2 + if (fp->freq_range==nr_FR2){ + LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value); + for (int j=0;j<fp->symbols_per_slot;j++) + gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value; + } + + nr_generate_pbch(&gNB->pbch, + &ssb_pdu, + gNB->nr_pbch_interleaver, + &txdataF[0][txdataF_offset], + AMP, + ssb_start_symbol, + n_hf, frame, cfg, fp); } + void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame,int slot, int do_meas) { @@ -142,11 +131,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; int offset = gNB->CC_id; - uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; - - if (cfg->ssb_table.ssb_period.value > 1) - ssb_frame_periodicity = 1 <<(cfg->ssb_table.ssb_period.value -1) ; if ((cfg->cell_config.frame_duplex_type.value == TDD) && (nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return; @@ -155,15 +140,20 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (do_meas==1) start_meas(&gNB->phy_proc_tx); - // clear the transmit data array for the current subframe + // clear the transmit data array and beam index for the current slot for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) { memset(&gNB->common_vars.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t)); + memset(&gNB->common_vars.beam_id[aa][slot*fp->symbols_per_slot],255,fp->symbols_per_slot*sizeof(uint8_t)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1); if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { - if ((!(frame%ssb_frame_periodicity))) // generate SSB only for given frames according to SSB periodicity - nr_common_signal_procedures(gNB,frame, slot); + for (int i=0; i<fp->Lmax; i++) { + if (gNB->ssb[i].active) { + nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[i].ssb_pdu); + gNB->ssb[i].active = false; + } + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,0); @@ -204,10 +194,14 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); } + if (do_meas==1) stop_meas(&gNB->phy_proc_tx); + if ((frame&127) == 0) dump_pdsch_stats(gNB); //apply the OFDM symbol rotation here - apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[0][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14,fp->ofdm_symbol_size); + for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) { + apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[aa][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14,fp->ofdm_symbol_size); + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0); } @@ -265,6 +259,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { LOG_D(PHY, "ULSCH received ok \n"); nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0); + //log_dump(PHY, ulsch_harq->b, 16, LOG_DUMP_CHAR,"gnb pusch rx frame %d %d: ", ulsch_harq->frame, ulsch_harq->slot); } else { LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n", gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot, @@ -367,7 +362,6 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, int timing_advance_update, cqi; int sync_pos; - uint16_t mu = gNB->frame_parms.numerology_index; NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; @@ -375,19 +369,10 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, // pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b; sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC - timing_advance_update = sync_pos * (1 << mu); // scale by the used scs numerology // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size - switch (gNB->frame_parms.N_RB_DL) { - case 106: timing_advance_update /= 16; break; - case 133: timing_advance_update /= 16; break; - case 217: timing_advance_update /= 32; break; - case 245: timing_advance_update /= 32; break; - case 273: timing_advance_update /= 32; break; - case 66: timing_advance_update /= 12; break; - case 32: timing_advance_update /= 12; break; - default: AssertFatal(0==1,"No case defined for PRB %d to calculate timing_advance_update\n",gNB->frame_parms.N_RB_DL); - } + uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048; + timing_advance_update = sync_pos / bw_scaling; // put timing advance command in 0..63 range timing_advance_update += 31; @@ -397,10 +382,12 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, LOG_D(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update); - // estimate UL_CQI for MAC (from antenna port 0 only) - int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - (10*gNB->measurements.n0_power_dB[0]); + // estimate UL_CQI for MAC - LOG_D(PHY, "Estimated SNR for PUSCH is = %d dB\n", SNRtimes10/10); + int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) - + dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot); + + LOG_D(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0); if (SNRtimes10 < -640) cqi=0; else if (SNRtimes10 > 635) cqi=255; @@ -461,14 +448,14 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; if (pucch) { if ((pucch->active == 1) && - (pucch->frame == frame_rx) && - (pucch->slot == slot_rx) ) { + (pucch->frame == frame_rx) && + (pucch->slot == slot_rx) ) { gNB->ulmask_symb = symbol; - nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch[i].pucch_pdu; + nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu; if ((symbol>=pucch_pdu->start_symbol_index) && (symbol<(pucch_pdu->start_symbol_index + pucch_pdu->nr_of_symbols))){ for (rb=0; rb<pucch_pdu->prb_size; rb++) { - rb2 = rb+pucch_pdu->prb_start; + rb2 = rb+pucch_pdu->prb_start+pucch_pdu->bwp_start; gNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31)); } nb_rb+=pucch_pdu->prb_size; @@ -496,7 +483,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { if ((symbol>=symbol_start) && (symbol<symbol_end)){ for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) { - rb2 = rb+ulsch_harq->ulsch_pdu.rb_start; + rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start; gNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31)); } nb_rb+=ulsch_harq->ulsch_pdu.rb_size; @@ -518,15 +505,12 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) unsigned char aa; for(symbol = 0; symbol < (gNB->frame_parms.Ncp==EXTENDED?12:14); symbol++) { - // nr_slot_fep_ul(gNB, symbol, proc->slot_rx, 0, 0); - for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { nr_slot_fep_ul(&gNB->frame_parms, gNB->common_vars.rxdata[aa], gNB->common_vars.rxdataF[aa], symbol, slot_rx, - 0, 0); } } @@ -553,19 +537,29 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) if (gNB->frame_parms.frame_type == TDD) fill_ul_rb_mask(gNB, frame_rx, slot_rx); - gNB_I0_measurements(gNB); + int first_symb=0,num_symb=0; + if (gNB->frame_parms.frame_type == TDD) + for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { + if (gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) { + if (num_symb==0) first_symb=symbol_count; + num_symb++; + } + } + else num_symb=NR_NUMBER_OF_SYMBOLS_PER_SLOT; + gNB_I0_measurements(gNB,first_symb,num_symb); - // measure enegry in SS=10 L=4, nb_rb = 18, first_rb = 0 (corresponds to msg3) int offset = 10*gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset; - int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12*18); + int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset+(47*12)],12*18); LOG_D(PHY,"frame %d, slot %d: UL signal energy %d\n",frame_rx,slot_rx,power_rxF); + start_meas(&gNB->phy_proc_rx); + for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){ NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; if (pucch) { if ((pucch->active == 1) && - (pucch->frame == frame_rx) && - (pucch->slot == slot_rx) ) { + (pucch->frame == frame_rx) && + (pucch->slot == slot_rx) ) { pucch_decode_done = 1; @@ -582,13 +576,14 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1; nr_decode_pucch0(gNB, - slot_rx, + frame_rx, + slot_rx, uci_pdu_format0, pucch_pdu); gNB->UL_INFO.uci_ind.num_ucis += 1; pucch->active = 0; - break; + break; case 2: num_ucis = gNB->UL_INFO.uci_ind.num_ucis; gNB->UL_INFO.uci_ind.uci_list = &gNB->uci_pdu_list[0]; @@ -607,7 +602,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) pucch->active = 0; break; default: - AssertFatal(1==0,"Only PUCCH formats 0 and 2 are currently supported\n"); + AssertFatal(1==0,"Only PUCCH formats 0 and 2 are currently supported\n"); } } } @@ -616,22 +611,24 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) for (int ULSCH_id=0;ULSCH_id<NUMBER_OF_NR_ULSCH_MAX;ULSCH_id++) { NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; int harq_pid; - int no_sig; NR_UL_gNB_HARQ_t *ulsch_harq; if ((ulsch) && (ulsch->rnti > 0)) { // for for an active HARQ process for (harq_pid=0;harq_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) { - ulsch_harq = ulsch->harq_processes[harq_pid]; - AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid); - if ((ulsch_harq->status == NR_ACTIVE) && - (ulsch_harq->frame == frame_rx) && - (ulsch_harq->slot == slot_rx) && - (ulsch_harq->handled == 0)){ + ulsch_harq = ulsch->harq_processes[harq_pid]; + AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid); + if ((ulsch_harq->status == NR_ACTIVE) && + (ulsch_harq->frame == frame_rx) && + (ulsch_harq->slot == slot_rx) && + (ulsch_harq->handled == 0)){ LOG_D(PHY, "PUSCH detection started in frame %d slot %d\n", frame_rx,slot_rx); + int num_dmrs=0; + for (int s=0;s<NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++) + num_dmrs+=(ulsch_harq->ulsch_pdu.ul_dmrs_symb_pos>>s)&1; #ifdef DEBUG_RXDATA NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; @@ -662,16 +659,32 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index; uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,1); - start_meas(&gNB->rx_pusch_stats); - for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) { - no_sig = nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid); - if (no_sig) { - LOG_I(PHY, "PUSCH not detected in symbol %d\n",symbol); - nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); - return; - } - } - stop_meas(&gNB->rx_pusch_stats); + start_meas(&gNB->rx_pusch_stats); + for (uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) { + nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid); + } + gNB->pusch_vars[ULSCH_id]->ulsch_power_tot=0; + gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot=0; + for (int aarx=0;aarx<gNB->frame_parms.nb_antennas_rx;aarx++) { + gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx]/=num_dmrs; + gNB->pusch_vars[ULSCH_id]->ulsch_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx]; + gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx]/=num_dmrs; + gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx]; + } + if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) < + dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) { + NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch); + + LOG_I(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx, + dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot), + dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres); + nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); + gNB->pusch_vars[ULSCH_id]->DTX=1; + stats->DTX++; + return; + } else gNB->pusch_vars[ULSCH_id]->DTX=0; + + stop_meas(&gNB->rx_pusch_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,0); //LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1); //LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1); @@ -683,9 +696,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } } } + stop_meas(&gNB->phy_proc_rx); // figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS - if ((frame_rx&127) == 0 && slot_rx==19) dump_pusch_stats(gNB); - if (pucch_decode_done || pusch_decode_done) { T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4)); } diff --git a/openair1/SCHED_NR/sched_nr.h b/openair1/SCHED_NR/sched_nr.h index 24885f1bb4ee341ed1d4df8c200eaeedcdca53ec..e0cf20d86264d6b26c66292577e749e3236fa1cb 100644 --- a/openair1/SCHED_NR/sched_nr.h +++ b/openair1/SCHED_NR/sched_nr.h @@ -40,7 +40,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame_tx, int slot_tx, int do_ 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); void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot); -void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot); +void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu); void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa); diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index e70c353589554e45141b51abef271bfa9c1e3ede..fe3d25b6f70c145b5ce4dcfc6571705923b66be8 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -42,7 +42,7 @@ extern PHY_VARS_NR_UE ***PHY_vars_UE_g; -const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH"}; +const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH", "SI_DLSCH", "P_DLSCH"}; const char *ul_pdu_type[]={"PRACH", "PUCCH", "PUSCH", "SRS"}; int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ @@ -67,7 +67,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ pdcch_vars->nb_search_space = 0; for (i = 0; i < dl_config->number_pdus; ++i){ - + AssertFatal(dl_config->number_pdus < FAPI_NR_DL_CONFIG_LIST_NUM,"dl_config->number_pdus %d out of bounds\n",dl_config->number_pdus); + AssertFatal(dl_config->dl_config_list[i].pdu_type<=FAPI_NR_DL_CONFIG_TYPES,"pdu_type %d > 2\n",dl_config->dl_config_list[i].pdu_type); LOG_D(PHY, "In %s: received 1 DL %s PDU of %d total DL PDUs:\n", __FUNCTION__, dl_pdu_type[dl_config->dl_config_list[i].pdu_type - 1], dl_config->number_pdus); if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) { @@ -84,6 +85,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ } 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]; + dlsch0->rnti_type = _RA_RNTI_; + dlsch0->harq_processes[dlsch0->current_harq_pid]->status = ACTIVE; } else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0]; @@ -147,6 +150,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ for (i = 0; i < ul_config->number_pdus; ++i){ + AssertFatal(ul_config->ul_config_list[i].pdu_type <= FAPI_NR_UL_CONFIG_TYPES,"pdu_type %d out of bounds\n",ul_config->ul_config_list[i].pdu_type); LOG_D(PHY, "In %s: processing %s PDU of %d total UL PDUs (ul_config %p) \n", __FUNCTION__, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config); uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type, pucch_resource_id, current_harq_pid, format, gNB_id = 0; @@ -179,7 +183,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ if (scheduled_response->tx_request){ fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[i]; - + LOG_D(PHY,"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",scheduled_response->frame,slot,tx_req_body->pdu_length,current_harq_pid); memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length); harq_process_ul_ue->status = ACTIVE; @@ -265,9 +269,11 @@ 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; - if(phy_config != NULL) + if(phy_config != NULL) { memcpy(nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t)); - + if (PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->UE_mode[0] == NOT_SYNCHED) + PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->UE_mode[0] = PRACH; + } return 0; } diff --git a/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c b/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c index 6254f6a2d239f76454231470197a2d5de57ecea8..696828a970ed34c86c73a2af3aeb813cdf6cad13 100644 --- a/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c @@ -46,6 +46,8 @@ int nr_ue_slot_select(fapi_nr_config_request_t *cfg, int nr_frame, int nr_slot) if (cfg->cell_config.frame_duplex_type == FDD) { return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT); } + if (cfg->tdd_table.max_tdd_periodicity_list == NULL) // this happens before receiving TDD configuration + return (NR_DOWNLINK_SLOT); if (nr_frame%2 == 0) { for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index d23322f55d5cabc205dd8c7016e202ed1c7dab3d..1680b59ab7ed0148cf71f0cacc1558205b234785 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -77,7 +77,7 @@ fifo_dump_emos_UE emos_dump_UE; #include "intertask_interface.h" #include "T.h" -char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; +char nr_mode_string[NUM_UE_MODE][20] = {"NOT SYNCHED","PRACH","RAR","RA_WAIT_CR", "PUSCH", "RESYNCH"}; const uint8_t nr_rv_round_map_ue[4] = {0, 2, 1, 3}; @@ -139,12 +139,13 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b; rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS / 8; break; - case FAPI_NR_RX_PDU_TYPE_MIB: - rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output; - rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte; - rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_index = frame_parms->ssb_index; - rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_length = frame_parms->Lmax; - rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.cell_id = frame_parms->Nid_cell; + case FAPI_NR_RX_PDU_TYPE_SSB: + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output; + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte; + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_index = frame_parms->ssb_index; + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_length = frame_parms->Lmax; + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.cell_id = frame_parms->Nid_cell; + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_start_subcarrier = frame_parms->ssb_start_subcarrier; break; default: break; @@ -203,20 +204,15 @@ uint8_t get_ra_PreambleIndex(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_id){ } - -// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size -uint16_t get_bw_scaling(uint16_t nb_rb){ - uint16_t bw_scaling; - switch (nb_rb) { - case 32: bw_scaling = 4; break; - case 66: bw_scaling = 8; break; - case 106: bw_scaling = 16; break; - case 217: bw_scaling = 32; break; - case 245: bw_scaling = 32; break; - case 273: bw_scaling = 32; break; - default: abort(); - } - return bw_scaling; +// convert time factor "16 * 64 * T_c / (2^mu)" in N_TA calculation in TS38.213 section 4.2 to samples by multiplying with samples per second +// 16 * 64 * T_c / (2^mu) * samples_per_second +// = 16 * T_s / (2^mu) * samples_per_second +// = 16 * 1 / (15 kHz * 2048) / (2^mu) * (15 kHz * 2^mu * ofdm_symbol_size) +// = 16 * 1 / 2048 * ofdm_symbol_size +// = 16 * ofdm_symbol_size / 2048 +static inline +uint16_t get_bw_scaling(uint16_t ofdm_symbol_size){ + return 16 * ofdm_symbol_size / 2048; } // UL time alignment procedures: @@ -234,14 +230,12 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){ if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) { - uint8_t numerology = ue->frame_parms.numerology_index; - uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL; - int factor_mu = 1 << numerology; - uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB); + uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; + uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); - ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu; + ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling; - LOG_I(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", + LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", __FUNCTION__, ue->Mod_id, frame_tx, @@ -283,14 +277,12 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, } if (get_softmodem_params()->usim_test==0) { - LOG_D(PHY, "Generating PUCCH\n"); pucch_procedures_ue_nr(ue, gNB_id, proc, FALSE); } - LOG_D(PHY, "Sending Uplink data \n"); nr_ue_pusch_common_procedures(ue, slot_tx, &ue->frame_parms,1); @@ -300,7 +292,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) { nr_ue_prach_procedures(ue, proc, gNB_id); } - LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); + LOG_D(PHY,"****** end TX-Chain (%s) for AbsSubframe %d.%d ******\n", nr_mode_string[ue->UE_mode[gNB_id]],frame_tx, slot_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); #if UE_TIMING_TRACE @@ -778,15 +770,17 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ uint16_t pdsch_nb_rb = dlsch0_harq->nb_rb; uint16_t s0 = dlsch0_harq->start_symbol; uint16_t s1 = dlsch0_harq->nb_symbols; + bool is_SI = dlsch0->rnti_type == _SI_RNTI_; LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos); for (m = s0; m < (s0 +s1); m++) { if (((1<<m)&dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos) > 0) { - for (uint8_t aatx=0; aatx<1; aatx++) {//for MIMO Config: it shall loop over no_layers + for (uint8_t aatx=0; aatx<dlsch0->harq_processes[harq_pid]->Nl; aatx++) {//for MIMO Config: it shall loop over no_layers nr_pdsch_channel_estimation(ue, proc, 0 /*eNB_id*/, + is_SI, nr_slot_rx, aatx /*p*/, m, @@ -838,43 +832,24 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ slot = 1; start_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]); #endif - // process DLSCH received in first slot - // skip DMRS symbols (will have to check later if PDSCH/DMRS are multiplexed - if (((1<<m)&dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos) == 0) { + // process DLSCH received symbols in the slot + // symbol by symbol processing (if data/DMRS are multiplexed is checked inside the function) + if (pdsch == PDSCH || pdsch == SI_PDSCH || pdsch == RA_PDSCH) { if (nr_rx_pdsch(ue, - proc, - pdsch, - eNB_id, - eNB_id_i, - frame_rx, - nr_slot_rx, - m, - first_symbol_flag, - dual_stream_UE, - i_mod, - dlsch0->current_harq_pid) < 0) - return -1; - } - 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[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1]; - else if (pdsch == PDSCH || pdsch == SI_PDSCH) { - if (nr_rx_pdsch(ue, - proc, - pdsch, - eNB_id, - eNB_id_i, - frame_rx, - nr_slot_rx, - m, - first_symbol_flag, - dual_stream_UE, - i_mod, - dlsch0->current_harq_pid) < 0) - return -1; - } - else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); - } - if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]); + proc, + pdsch, + eNB_id, + eNB_id_i, + frame_rx, + nr_slot_rx, + m, + first_symbol_flag, + dual_stream_UE, + i_mod, + dlsch0->current_harq_pid) < 0) + return -1; + } else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); + #if UE_TIMING_TRACE stop_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]); #if DISABLE_LOG_X @@ -884,10 +859,9 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ #endif #endif - if(first_symbol_flag) - { - proc->first_symbol_available = 1; - } + if(first_symbol_flag) { + proc->first_symbol_available = 1; + } } // CRNTI active } return 0; @@ -908,35 +882,21 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, int harq_pid = dlsch0->current_harq_pid; int frame_rx = proc->frame_rx; int nr_slot_rx = proc->nr_slot_rx; - int ret=0, ret1=0; + uint32_t ret = UINT32_MAX, ret1 = UINT32_MAX; NR_UE_PDSCH *pdsch_vars; - uint8_t is_cw0_active = 0; - uint8_t is_cw1_active = 0; - uint8_t dmrs_type, nb_re_dmrs; uint16_t dmrs_len = get_num_dmrs(dlsch0->harq_processes[dlsch0->current_harq_pid]->dlDmrsSymbPos); - uint16_t nb_symb_sch = 9; nr_downlink_indication_t dl_indication; fapi_nr_rx_indication_t rx_ind; uint16_t number_pdus = 1; // params for UL time alignment procedure NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[eNB_id]; - uint16_t slots_per_frame = ue->frame_parms.slots_per_frame; - uint16_t slots_per_subframe = ue->frame_parms.slots_per_subframe; - uint8_t numerology = ue->frame_parms.numerology_index, mapping_type_ul, mapping_type_dl; - int ul_tx_timing_adjustment, N_TA_max, factor_mu, N_t_1, N_t_2, N_1, N_2, d_1_1 = 0, d_2_1, d; - uint8_t d_2_2 = 0;// set to 0 because there is only 1 BWP - // TODO this should corresponds to the switching time as defined in - // TS 38.133 - uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; - uint16_t nb_prefix_samples = ue->frame_parms.nb_prefix_samples; - uint32_t t_subframe = 1; // subframe duration of 1 msec - uint16_t start_symbol; - float tc_factor; - - 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; - dmrs_type = dlsch0->harq_processes[harq_pid]->dmrsConfigType; + + uint8_t is_cw0_active = dlsch0->harq_processes[harq_pid]->status; + uint16_t nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols; + uint16_t start_symbol = dlsch0->harq_processes[harq_pid]->start_symbol; + uint8_t dmrs_type = dlsch0->harq_processes[harq_pid]->dmrsConfigType; + + uint8_t nb_re_dmrs; if (dmrs_type==NFAPI_NR_DMRS_TYPE1) { nb_re_dmrs = 6*dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups; } @@ -944,6 +904,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, nb_re_dmrs = 4*dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups; } + uint8_t is_cw1_active = 0; if(dlsch1) is_cw1_active = dlsch1->harq_processes[harq_pid]->status; @@ -1174,7 +1135,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, 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_slot_rx); + LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ decoded in %d \n", frame_rx, nr_slot_rx, ret); LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS); if(ret<dlsch0->max_ldpc_iterations+1){ @@ -1206,53 +1167,29 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, } } - // TODO CRC check for CW0 - - // Check CRC for CW 0 - /*if (ret == (1+dlsch0->max_turbo_iterations)) { - *dlsch_errors=*dlsch_errors+1; - if(dlsch0->rnti != 0xffff){ - LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : DLSCH CW0 in error (rv %d,round %d, mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,nr_slot_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->round, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); - } - } else { - if(dlsch0->rnti != 0xffff){ - LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : Received DLSCH CW0 (rv %d,round %d, mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,nr_slot_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->round, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); - } - if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)){ - int j; - LOG_D(PHY,"dlsch harq_pid %d (rx): \n",dlsch0->current_harq_pid); - - for (j=0; j<dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS>>3; j++) - LOG_T(PHY,"%x.",dlsch0->harq_processes[dlsch0->current_harq_pid]->b[j]); - LOG_T(PHY,"\n"); - }*/ - if (ue->mac_enabled == 1) { - uint16_t bw_scaling = get_bw_scaling(ue->frame_parms.N_RB_DL); - /* Time Alignment procedure // - UE processing capability 1 // - Setting the TA update to be applied after the reception of the TA command // - Timing adjustment computed according to TS 38.213 section 4.2 // - Durations of N1 and N2 symbols corresponding to PDSCH and PUSCH are // computed according to sections 5.3 and 6.4 of TS 38.214 */ - factor_mu = 1 << numerology; - N_TA_max = 3846 * bw_scaling / factor_mu; + const int numerology = ue->frame_parms.numerology_index; + const int ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; + const int nb_prefix_samples = ue->frame_parms.nb_prefix_samples; + const int samples_per_subframe = ue->frame_parms.samples_per_subframe; + const int slots_per_frame = ue->frame_parms.slots_per_frame; + const int slots_per_subframe = ue->frame_parms.slots_per_subframe; + + const double tc_factor = 1.0 / samples_per_subframe; + const uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); + + const int Ta_max = 3846; // Max value of 12 bits TA Command + const double N_TA_max = Ta_max * bw_scaling * tc_factor; /* PDSCH decoding time N_1 for processing capability 1 */ + int N_1; if (ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition == pdsch_dmrs_pos0) N_1 = pdsch_N_1_capability_1[numerology][1]; else if (ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition == pdsch_dmrs_pos1 || ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition == 2) // TODO set to pdsch_dmrs_pos2 when available @@ -1261,12 +1198,12 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, N_1 = pdsch_N_1_capability_1[numerology][3]; /* PUSCH preapration time N_2 for processing capability 1 */ - N_2 = pusch_N_2_timing_capability_1[numerology][1]; - mapping_type_dl = ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[0]->mappingType; - mapping_type_ul = ue->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; + const int N_2 = pusch_N_2_timing_capability_1[numerology][1]; /* d_1_1 depending on the number of PDSCH symbols allocated */ - d = 0; // TODO number of overlapping symbols of the scheduling PDCCH and the scheduled PDSCH + const int d = 0; // TODO number of overlapping symbols of the scheduling PDCCH and the scheduled PDSCH + int d_1_1 = 0; + mappingType_t mapping_type_dl = ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[0]->mappingType; if (mapping_type_dl == typeA) if (nb_symb_sch + start_symbol < 7) d_1_1 = 7 - (nb_symb_sch + start_symbol); @@ -1281,22 +1218,26 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, } /* d_2_1 */ + int d_2_1; + mappingType_t mapping_type_ul = ue->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; if (mapping_type_ul == typeB && start_symbol != 0) d_2_1 = 0; else d_2_1 = 1; + /* d_2_2 */ + const double d_2_2 = 0.0; // set to 0 because there is only 1 BWP: TODO this should corresponds to the switching time as defined in TS 38.133 + /* N_t_1 time duration in msec of N_1 symbols corresponding to a PDSCH reception time // N_t_2 time duration in msec of N_2 symbols corresponding to a PUSCH preparation time */ - N_t_1 = (N_1 + d_1_1) * (ofdm_symbol_size + nb_prefix_samples) / factor_mu; - N_t_2 = (N_2 + d_2_1) * (ofdm_symbol_size + nb_prefix_samples) / factor_mu; + double N_t_1 = (N_1 + d_1_1) * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; + double N_t_2 = (N_2 + d_2_1) * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; if (N_t_2 < d_2_2) N_t_2 = d_2_2; /* Time alignment procedure */ - // N_t_1 + N_t_2 + N_TA_max is in unit of Ts, therefore must be converted to Tc // N_t_1 + N_t_2 + N_TA_max must be in msec - tc_factor = 64 * 0.509 * 10e-7; - ul_tx_timing_adjustment = 1 + ceil(slots_per_subframe*((N_t_1 + N_t_2 + N_TA_max)*tc_factor + 0.5)/t_subframe); + const double t_subframe = 1.0; // subframe duration of 1 msec + const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe); if (ul_time_alignment->apply_ta == 1){ ul_time_alignment->ta_slot = (nr_slot_rx + ul_tx_timing_adjustment) % slots_per_frame; @@ -1310,13 +1251,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY,"Frame %d slot %d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n", frame_rx, nr_slot_rx, ul_time_alignment->ta_frame, ul_time_alignment->ta_slot); } } - - /*ue->total_TBS[eNB_id] = ue->total_TBS[eNB_id] + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; - ue->total_received_bits[eNB_id] = ue->total_TBS[eNB_id] + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; - }*/ - - // TODO CRC check for CW1 - } } @@ -1714,15 +1648,14 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // looking for pbch only in slot where it is supposed to be if (slot_ssb) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN); LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); for (int i=1; i<4; i++) { nr_slot_fep(ue, proc, (ue->symbol_offset+i)%(fp->symbols_per_slot), - nr_slot_rx, - 0, - 0); + nr_slot_rx); #if UE_TIMING_TRACE start_meas(&ue->dlsch_channel_estimation_stats); @@ -1753,31 +1686,29 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, LOG_D(PHY, "Doing N0 measurements in %s\n", __FUNCTION__); nr_ue_rrc_measurements(ue, proc, nr_slot_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_OUT); } } if ((frame_rx%64 == 0) && (nr_slot_rx==0)) { - printf("============================================\n"); + LOG_I(PHY,"============================================\n"); LOG_I(PHY,"Harq round stats for Downlink: %d/%d/%d/%d DLSCH errors: %d\n",ue->dl_stats[0],ue->dl_stats[1],ue->dl_stats[2],ue->dl_stats[3],ue->dl_stats[4]); - printf("============================================\n"); + LOG_I(PHY,"============================================\n"); } #ifdef NR_PDCCH_SCHED - nr_gold_pdcch(ue, 0, 2); LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_IN); for (uint16_t l=0; l<nb_symb_pdcch; l++) { #if UE_TIMING_TRACE start_meas(&ue->ofdm_demod_stats); #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); nr_slot_fep(ue, proc, l, - nr_slot_rx, - 0, - 0); + nr_slot_rx); dci_cnt = 0; for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) { @@ -1795,7 +1726,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, coreset_nb_rb); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); #if UE_TIMING_TRACE stop_meas(&ue->ofdm_demod_stats); #endif @@ -1803,6 +1733,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); } } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_OUT); if (dci_cnt > 0) { @@ -1818,28 +1749,22 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, } if (dlsch) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_IN); 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; LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); //to update from pdsch config - for (int i=0;i<4;i++) if (((1<<i)&dlsch0_harq->dlDmrsSymbPos) > 0) {symb_dmrs=i;break;} - AssertFatal(symb_dmrs>=0,"no dmrs in 0..3\n"); - LOG_D(PHY,"Initializing dmrs for slot %d DMRS mask %x\n", nr_slot_rx, dlsch0_harq->dlDmrsSymbPos); - nr_gold_pdsch(ue, nr_slot_rx, 0); - for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){ nr_slot_fep(ue, proc, m, //to be updated from higher layer - nr_slot_rx, - 0, - 0); + nr_slot_rx); } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_OUT); } } else { LOG_D(PHY,"[UE %d] Frame %d, nr_slot_rx %d: No DCIs found\n", ue->Mod_id, frame_rx, nr_slot_rx); @@ -1853,7 +1778,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for C-RNTI int ret_pdsch = 0; if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1) { - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN); ret_pdsch = nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1862,6 +1787,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NULL); nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT); } // do procedures for SI-RNTI @@ -1910,7 +1836,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // deactivate dlsch once dlsch proc is done ue->dlsch_p[gNB_id]->active = 0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_OUT); } @@ -2139,19 +2064,19 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t } else { - LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources\n", __FUNCTION__, frame_tx, nr_slot_tx); - nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx); + nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx); + LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources : %d\n", __FUNCTION__, frame_tx, nr_slot_tx,nr_prach); } - if (nr_prach == 1) { + if (nr_prach == GENERATE_PREAMBLE) { if (ue->mac_enabled == 1) { int16_t pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id); - int16_t ra_preamble_rx_power = (int16_t)(10*log10(pow(10, (double)(prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER)/10) + pow(10, (double)(pathloss)/10))); + int16_t ra_preamble_rx_power = (int16_t)(prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER - pathloss + 30); ue->tx_power_dBm[nr_slot_tx] = min(nr_get_Pcmax(mod_id), ra_preamble_rx_power); - LOG_I(PHY,"[UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n", + LOG_D(PHY,"DEBUG [UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d dB, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n", mod_id, frame_tx, nr_slot_tx, @@ -2190,18 +2115,15 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t if (ue->mac_enabled == 1) nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); - } else if (nr_prach == 2) { - + } else if (nr_prach == WAIT_CONTENTION_RESOLUTION) { + LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id); + ue->UE_mode[gNB_id] = RA_WAIT_CR; + } else if (nr_prach == RA_SUCCEEDED) { LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id); - ue->UE_mode[gNB_id] = PUSCH; - - } else if(nr_prach == 3){ - + } else if(nr_prach == RA_FAILED){ LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id); - ue->UE_mode[gNB_id] = PRACH; - } 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 edb070f8735c479614fc10bb1362501e078976d1..f69a78a935b8c8cb2c7284ba46f825b6c0110a27 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -40,6 +40,8 @@ #include <openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h> #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h" +#include <openair1/PHY/impl_defs_nr.h> +#include <common/utils/nr/nr_common.h> #ifndef NO_RAT_NR @@ -54,10 +56,172 @@ #endif +/* TS 36.213 Table 9.2.3-3: Mapping of values for one HARQ-ACK bit to sequences */ +static const int sequence_cyclic_shift_1_harq_ack_bit[2] +/* HARQ-ACK Value 0 1 */ +/* Sequence cyclic shift */ = { 0, 6 } +; + +/* TS 36.213 Table 9.2.5-2: Mapping of values for two HARQ-ACK bits and positive SR to sequences */ +static const int sequence_cyclic_shift_2_harq_ack_bits_positive_sr[4] +/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ +/* Sequence cyclic shift */ = { 1, 4, 10, 7 } +; + uint8_t nr_is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); +static const uint16_t scheduling_request_periodicity[NB_SR_PERIOD] += { 0, 0, 1, 2, 4, 5, 8, 10, 16, 20, 40, 80, 160, 320, 640 } +; + +/* TS 38.213 9.2.5.2 UE procedure for multiplexing HARQ-ACK/SR and CSI in a PUCCH */ +/* this is a counter of number of pucch format 4 per subframe */ +static int nb_pucch_format_4_in_subframes[LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] = { 0 } ; + +/* TS 36.213 Table 9.2.5.2-1: Code rate corresponding to higher layer parameter PUCCH-F2-maximum-coderate, */ +/* or PUCCH-F3-maximum-coderate, or PUCCH-F4-maximum-coderate */ +/* add one additional element set to 0 for parsing the array until this end */ +/* stored values are code rates * 100 */ +//static const int code_rate_r_time_100[8] = { (0.08 * 100), (0.15 * 100), (0.25*100), (0.35*100), (0.45*100), (0.60*100), (0.80*100), 0 } ; + +/* TS 38.213 Table 9.2.3-4: Mapping of values for two HARQ-ACK bits to sequences */ +static const int sequence_cyclic_shift_2_harq_ack_bits[4] +/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ +/* Sequence cyclic shift */ = { 0, 3, 9, 6 } +; + +/* TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4 */ +static const int nb_symbols_excluding_dmrs[NB_SYMBOL_MINUS_FOUR][2][2] += { +/* No additional DMRS Additional DMRS */ +/* PUCCH length No hopping hopping No hopping hopping */ +/* index 0 1 0 1 */ +/* 4 */ {{ 3 , 2 } , { 3 , 2 }}, +/* 5 */ {{ 3 , 3 } , { 3 , 3 }}, +/* 6 */ {{ 4 , 4 } , { 4 , 4 }}, +/* 7 */ {{ 5 , 5 } , { 5 , 5 }}, +/* 8 */ {{ 6 , 6 } , { 6 , 6 }}, +/* 9 */ {{ 7 , 7 } , { 7 , 7 }}, +/* 10 */ {{ 8 , 8 } , { 6 , 6 }}, +/* 11 */ {{ 9 , 9 } , { 7 , 7 }}, +/* 12 */ {{ 10 , 10 } , { 8 , 8 }}, +/* 13 */ {{ 11 , 11 } , { 9 , 9 }}, +/* 14 */ {{ 12 , 12 } , { 10 , 10 }}, +} +; + + +/* TS 36.213 Table 9.2.5-1: Mapping of values for one HARQ-ACK bit and positive SR to sequences */ +static const int sequence_cyclic_shift_1_harq_ack_bit_positive_sr[2] +/* HARQ-ACK Value 0 1 */ +/* Sequence cyclic shift */ = { 3, 9 } +; + +static float RSRP_meas_mapping_nr[98] += { + -140, + -139, + -138, + -137, + -136, + -135, + -134, + -133, + -132, + -131, + -130, + -129, + -128, + -127, + -126, + -125, + -124, + -123, + -122, + -121, + -120, + -119, + -118, + -117, + -116, + -115, + -114, + -113, + -112, + -111, + -110, + -109, + -108, + -107, + -106, + -105, + -104, + -103, + -102, + -101, + -100, + -99, + -98, + -97, + -96, + -95, + -94, + -93, + -92, + -91, + -90, + -89, + -88, + -87, + -86, + -85, + -84, + -83, + -82, + -81, + -80, + -79, + -78, + -77, + -76, + -75, + -74, + -73, + -72, + -71, + -70, + -69, + -68, + -67, + -66, + -65, + -64, + -63, + -62, + -61, + -60, + -59, + -58, + -57, + -56, + -55, + -54, + -53, + -52, + -51, + -50, + -49, + -48, + -47, + -46, + -45, + -44, + -43 + } + ; + long binary_search_float_nr( float elements[], @@ -202,6 +366,30 @@ void nr_generate_pucch3_4(int32_t **txdataF, * *********************************************************************/ +/* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ +const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE] += +{ +/* format first symbol Number of symbols PRB offset nb index for set of initial CS */ +/* 0 */ { pucch_format0_nr, 12, 2, 0, 2, { 0, 3, 0, 0 } }, +/* 1 */ { pucch_format0_nr, 12, 2, 0, 3, { 0, 4, 8, 0 } }, +/* 2 */ { pucch_format0_nr, 12, 2, 3, 3, { 0, 4, 8, 0 } }, +/* 3 */ { pucch_format1_nr, 10, 4, 0, 2, { 0, 6, 0, 0 } }, +/* 4 */ { pucch_format1_nr, 10, 4, 0, 4, { 0, 3, 6, 9 } }, +/* 5 */ { pucch_format1_nr, 10, 4, 2, 4, { 0, 3, 6, 9 } }, +/* 6 */ { pucch_format1_nr, 10, 4, 4, 4, { 0, 3, 6, 9 } }, +/* 7 */ { pucch_format1_nr, 4, 10, 0, 2, { 0, 6, 0, 0 } }, +/* 8 */ { pucch_format1_nr, 4, 10, 0, 4, { 0, 3, 6, 9 } }, +/* 9 */ { pucch_format1_nr, 4, 10, 2, 4, { 0, 3, 6, 9 } }, +/* 10 */ { pucch_format1_nr, 4, 10, 4, 4, { 0, 3, 6, 9 } }, +/* 11 */ { pucch_format1_nr, 0, 14, 0, 2, { 0, 6, 0, 0 } }, +/* 12 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, +/* 13 */ { pucch_format1_nr, 0, 14, 2, 4, { 0, 3, 6, 9 } }, +/* 14 */ { pucch_format1_nr, 0, 14, 4, 4, { 0, 3, 6, 9 } }, +/* 15 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, +} +; + bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t *proc, bool reset_harq) { uint8_t sr_payload = 0; @@ -236,6 +424,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ /* update current context */ + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig) + AssertFatal(1==0,"0 > %d.%d csi_MeasConfig is not null\n",frame_tx,nr_slot_tx); int subframe_number = proc->nr_slot_rx / ue->frame_parms.slots_per_subframe; nb_pucch_format_4_in_subframes[subframe_number] = 0; /* reset pucch format 4 counter at current rx position */ @@ -246,7 +439,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ pucch_resource_indicator = ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack.pucch_resource_indicator; } - LOG_D(PHY, "PUCCH: %d.%d dl_harq_pid = %d, pucch_resource_indicator = %d\n", frame_tx, nr_slot_tx, dl_harq_pid, pucch_resource_indicator); + LOG_D(PHY, "PUCCH: %d.%d bwp_id %ld dl_harq_pid = %d, pucch_resource_indicator = %d\n", frame_tx, nr_slot_tx, bwp_id,dl_harq_pid, pucch_resource_indicator); /* Part - I * Collect feedback that should be transmitted at this nr_slot_tx : @@ -281,61 +474,80 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ri_status = ((ue->cqi_report_config[gNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) && (nr_is_ri_TXOp(ue,proc,gNB_id) == 1)); - - NR_CSI_MeasConfig_t *csi_MeasConfig = mac->scg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; - - uint16_t report_slot_csi =csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; - - //if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){ - if (report_slot_csi == proc->nr_slot_tx) - csi_status = get_csi_nr(mac, ue, gNB_id, &csi_payload); - else - csi_status = 0; - //} - - O_CSI = cqi_status + ri_status + csi_status; - /* Part - II */ - /* if payload is empty or only negative SR -> no pucch transmission */ - - if(O_ACK == 0) { - N_UCI = O_SR + O_CSI; - if ((N_UCI == 0) || ((O_CSI == 0) && (sr_payload == 0))) { /* TS 38.213 9.2.4 UE procedure for reporting SR */ - NR_TST_PHY_PRINTF("PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx); - LOG_D(PHY,"PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx); - return (FALSE); - } - else { - /* a resource set and a resource should be find according to payload size */ - pucch_resource_set = find_pucch_resource_set( mac, gNB_id, N_UCI); - if (pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) { - pucch_resource_indicator = 0; - pucch_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set]->resourceList.list.array[pucch_resource_indicator][0]; /* get the first resource of the set */ + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig&& + mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup) { + NR_CSI_MeasConfig_t *csi_MeasConfig = mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + + uint16_t report_slot_csi =csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; + + //if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){ + if (report_slot_csi == proc->nr_slot_tx) + csi_status = get_csi_nr(mac, ue, gNB_id, &csi_payload); + else + csi_status = 0; + //} + + O_CSI = cqi_status + ri_status + csi_status; + + /* Part - II */ + /* if payload is empty or only negative SR -> no pucch transmission */ + + if(O_ACK == 0) { + N_UCI = O_SR + O_CSI; + if ((N_UCI == 0) || ((O_CSI == 0) && (sr_payload == 0))) { /* TS 38.213 9.2.4 UE procedure for reporting SR */ + NR_TST_PHY_PRINTF("PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx); + LOG_D(PHY,"PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx); + return (FALSE); } else { - LOG_W(PHY,"PUCCH no resource set found for CSI at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); - O_CSI = 0; - csi_payload = 0; - } - - if (O_CSI == 0) { - /* only SR has to be send */ - /* in this case there is no DCI related to PUCCH parameters so pucch resource should be get from sr configuration */ - /* TS 38.213 9.2.4 UE procedure for reporting SR */ - pucch_resource_set = 0; /* force it to a valid value */ - if (ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id] != NULL) { - pucch_resource_id = ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id]->resource; - } - else { - LOG_E(PHY,"PUCCH No scheduling request configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); - return(FALSE); - } + /* a resource set and a resource should be find according to payload size */ + pucch_resource_set = find_pucch_resource_set( mac, gNB_id, N_UCI); + if (pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) { + pucch_resource_indicator = 0; + pucch_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set]->resourceList.list.array[pucch_resource_indicator][0]; /* get the first resource of the set */ + } + else { + LOG_W(PHY,"PUCCH no resource set found for CSI at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); + O_CSI = 0; + csi_payload = 0; + } + + if (O_CSI == 0) { + /* only SR has to be send */ + /* in this case there is no DCI related to PUCCH parameters so pucch resource should be get from sr configuration */ + /* TS 38.213 9.2.4 UE procedure for reporting SR */ + pucch_resource_set = 0; /* force it to a valid value */ + if (ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id] != NULL) { + pucch_resource_id = ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id]->resource; + } + else { + LOG_E(PHY,"PUCCH No scheduling request configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); + return(FALSE); + } + } } } } - else { - N_UCI = O_SR + O_ACK + O_CSI; - } + + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig) + AssertFatal(1==0,"6 > %d.%d csi_MeasConfig is not null\n",frame_tx,nr_slot_tx); + + + N_UCI = O_SR + O_ACK + O_CSI; + if (N_UCI ==0) return(TRUE); + + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig) + AssertFatal(1==0,"5 > %d.%d csi_MeasConfig is not null\n",frame_tx,nr_slot_tx); /* Part - III */ /* Choice PUCCH format and its related parameters */ @@ -343,8 +555,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ uint8_t starting_symbol_index=0; uint8_t nb_symbols_total = 0; uint8_t nb_symbols = 0; - uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */ - uint16_t second_hop = 0; /* second part for pucch for hopping */ + uint16_t startingPRB = 0;; /* it can be considered as first hop on case of pucch hopping */ + uint16_t secondHopPRB = 0; /* second part for pucch for hopping */ uint8_t nb_of_prbs = 0; int m_0 = 0; /* format 0 only */ int m_CS = 0; /* for all format except for format 0 */ @@ -355,35 +567,40 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ int occ_Index = 0; NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack; - + int BWPsize,BWPstart; if (select_pucch_resource(ue, mac, gNB_id, N_UCI, pucch_resource_indicator, &initial_pucch_id, &pucch_resource_set, &pucch_resource_id, harq_status) == TRUE) { /* use of initial pucch configuration provided by system information 1 */ /***********************************************************************/ if (initial_pucch_id != NB_INITIAL_PUCCH_RESOURCE) { + LOG_I(MAC,"Selecting INITIAL PUCCH Resource\n"); format = initial_pucch_resource[initial_pucch_id].format; starting_symbol_index = initial_pucch_resource[initial_pucch_id].startingSymbolIndex; nb_symbols_total = initial_pucch_resource[initial_pucch_id].nrofSymbols; int N_CS = initial_pucch_resource[initial_pucch_id].nb_CS_indexes; /* see TS 38213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ + BWPsize = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, + MAX_BWP_SIZE); + BWPstart = NRRIV2PRBOFFSET(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, + MAX_BWP_SIZE); int RB_BWP_offset; if (initial_pucch_id == 15) { - RB_BWP_offset = ue->systemInformationBlockType1_nr.N_BWP_SIZE/4; + RB_BWP_offset =BWPsize/4; } else { RB_BWP_offset = initial_pucch_resource[initial_pucch_id].PRB_offset; } if (initial_pucch_id/8 == 0) { - starting_prb = RB_BWP_offset + (initial_pucch_id/N_CS); - second_hop = ue->systemInformationBlockType1_nr.N_BWP_SIZE - 1 - RB_BWP_offset - (initial_pucch_id/N_CS); + startingPRB = RB_BWP_offset + (initial_pucch_id/N_CS); + secondHopPRB = BWPsize - 1 - RB_BWP_offset - (initial_pucch_id/N_CS); m_0 = initial_pucch_resource[initial_pucch_id].initial_CS_indexes[initial_pucch_id%N_CS]; } else if (initial_pucch_id/8 == 1) { - starting_prb = RB_BWP_offset + (initial_pucch_id/N_CS); - second_hop = ue->systemInformationBlockType1_nr.N_BWP_SIZE - 1 - RB_BWP_offset - ((initial_pucch_id - 8)/N_CS); + startingPRB = RB_BWP_offset + (initial_pucch_id/N_CS); + secondHopPRB = BWPsize - 1 - RB_BWP_offset - ((initial_pucch_id - 8)/N_CS); m_0 = initial_pucch_resource[initial_pucch_id].initial_CS_indexes[(initial_pucch_id - 8)%N_CS]; } if ((ue->UE_mode[gNB_id] != PUSCH) && (O_ACK > 1)) { @@ -392,26 +609,56 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ LOG_W(PHY,"PUCCH ue is not expected to generate more than one HARQ-ACK at AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx); } NR_TST_PHY_PRINTF("PUCCH common configuration with index %d \n", initial_pucch_id); + startingPRB += BWPstart; + secondHopPRB += BWPstart; } /* use dedicated pucch resource configuration */ /**********************************************/ 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 != NULL) - || (mac->scg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook != 1)) { + if (mac->cg && + mac->cg->physicalCellGroupConfig && + (mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL || + mac->cg->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); } - else if (mac->scg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { + else if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup && + mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { 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 = select_resource_by_id(pucch_resource_id, mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup); + NR_PUCCH_Config_t *pucch_Config; + if (bwp_id>0 && + mac->ULbwp[bwp_id-1] && + mac->ULbwp[bwp_id-1]->bwp_Dedicated && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup) + pucch_Config = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup; + else if (bwp_id==0 && + mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { + pucch_Config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; + BWPsize = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE); + BWPstart = NRRIV2PRBOFFSET(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE); + } + + else AssertFatal(1==0,"no pucch_Config\n"); + pucch_resource = select_resource_by_id(pucch_resource_id, pucch_Config); format = pucch_resource->format.present; nb_symbols_total = get_nb_symbols_pucch(pucch_resource, format); starting_symbol_index = get_starting_symb_idx(pucch_resource, format); - starting_prb = pucch_resource->startingPRB; - second_hop = starting_prb; + startingPRB = BWPstart + pucch_resource->startingPRB; + secondHopPRB = pucch_resource->intraSlotFrequencyHopping ? (BWPstart+*pucch_resource->secondHopPRB) : startingPRB; if (format==pucch_format1_nr) time_domain_occ = pucch_resource->format.choice.format1->timeDomainOCC; if (format==pucch_format4_nr) { @@ -452,7 +699,9 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ int O_CRC = 0; nb_symbols = nb_symbols_total; /* by default, it can be reduced due to symbols reserved for dmrs */ - pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[pucch_resource_id]; + pucch_resource = format>1 ? + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[pucch_resource_id]: + 0; switch(format) { case pucch_format0_nr: @@ -600,8 +849,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ NR_TST_PHY_PRINTF("PUCCH ( format : %d ) ( modulation : %s ) ( nb prb : %d ) ( nb symbols total: %d ) ( nb symbols : %d ) ( max code rate*100 : %d ) ( starting_symbol_index : %d ) \n", format, (Q_m == BITS_PER_SYMBOL_QPSK ? " QPSK " : " BPSK "), nb_of_prbs, nb_symbols_total, nb_symbols, max_code_rate, starting_symbol_index); - NR_TST_PHY_PRINTF("PUCCH ( starting_prb : %d ) ( second_hop : %d ) ( m_0 : %d ) ( m_CS : %d ) ( time_domain_occ %d ) (occ_length : %d ) ( occ_Index : %d ) \n", - starting_prb, second_hop, m_0, m_CS, time_domain_occ, occ_length, occ_Index); + NR_TST_PHY_PRINTF("PUCCH ( startingPRB : %d ) ( secondHopPRB : %d ) ( m_0 : %d ) ( m_CS : %d ) ( time_domain_occ %d ) (occ_length : %d ) ( occ_Index : %d ) \n", + startingPRB (absolute), secondHopPRB (absolute), m_0, m_CS, time_domain_occ, occ_length, occ_Index); /* Part - IV */ /* Generate PUCCH signal according to its format and parameters */ @@ -630,17 +879,27 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ switch(format) { case pucch_format0_nr: { + int pucch_GroupHopping = mac->ULbwp[bwp_id-1] ? + mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping: + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->pucch_GroupHopping; + int hoppingId = mac->ULbwp[bwp_id-1] ? + mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId[0]: + (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->hoppingId? + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->hoppingId[0]: + mac->physCellId); nr_generate_pucch0(ue,ue->common_vars.txdataF, - &ue->frame_parms, - 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_slot_tx, - (uint8_t)m_0, - (uint8_t)m_CS, - nb_symbols_total, - starting_symbol_index, - starting_prb); + &ue->frame_parms, + pucch_GroupHopping, + hoppingId, + tx_amp, + nr_slot_tx, + (uint8_t)m_0, + (uint8_t)m_CS, + nb_symbols_total, + starting_symbol_index, + startingPRB, + secondHopPRB + ); break; } case pucch_format1_nr: @@ -654,8 +913,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ (uint8_t)m_0, nb_symbols_total, starting_symbol_index, - starting_prb, - second_hop, + startingPRB, + secondHopPRB, (uint8_t)time_domain_occ, (uint8_t)N_UCI); break; @@ -675,7 +934,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ nb_symbols_total, starting_symbol_index, nb_of_prbs, - starting_prb, + startingPRB, (uint8_t)N_UCI); break; } @@ -694,8 +953,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ nb_symbols_total, starting_symbol_index, nb_of_prbs, - starting_prb, - second_hop, + startingPRB, + secondHopPRB, (uint8_t)N_UCI, (uint8_t)occ_length, (uint8_t)occ_Index); @@ -751,9 +1010,13 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t int V_DAI_m_DL = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); - if (mac->DLbwp[0] == NULL) return 0; - if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0] == 2) { + + if (mac->DLbwp[0] && + mac->DLbwp[0]->bwp_Dedicated && + mac->DLbwp[0]->bwp_Dedicated->pdsch_Config && + mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup && + mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0] == 2) { two_transport_blocks = TRUE; number_of_code_word = 2; } @@ -788,7 +1051,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t LOG_E(PHY,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); } else if (harq_status->send_harq_status == 0) { - LOG_D(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); + LOG_E(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); } else { @@ -830,7 +1093,9 @@ 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 == NULL) { + if (mac->cg != NULL && + mac->cg->physicalCellGroupConfig != NULL && + mac->cg->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); @@ -943,12 +1208,30 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 //*resource_set_id = MAX_NB_OF_PUCCH_RESOURCE_SETS; //*resource_id = MAX_NB_OF_PUCCH_RESOURCES; - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) { + if ((bwp_id ==0 && + mac->cg == NULL) || + (bwp_id == 0 && + mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) || + (mac->ULbwp[bwp_id-1] && + mac->ULbwp[bwp_id-1]->bwp_Dedicated && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) + ){ /* No resource set has been already configured so pucch_configCommon from Sib1 should be used in this case */ if (ue->UE_mode[gNB_id] != PUSCH) { - *initial_pucch_id = mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon[0]; + *initial_pucch_id = *mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->pucch_ResourceCommon; if (*initial_pucch_id >= NB_INITIAL_PUCCH_RESOURCE) { LOG_E(PHY,"PUCCH Invalid initial resource index : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); *initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE; @@ -965,8 +1248,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 int n_CCE_0 = harq_status->n_CCE; int N_CCE_0 = harq_status->N_CCE; if (N_CCE_0 == 0) { - LOG_E(PHY,"PUCCH No compatible pucch format found : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); - return (FALSE); + AssertFatal(1==0,"PUCCH No compatible pucch format found : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); } int r_PUCCH = ((2 * n_CCE_0)/N_CCE_0) + (2 * delta_PRI); *initial_pucch_id = r_PUCCH; @@ -1008,19 +1290,30 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 if (resource_set_found == TRUE) { if (pucch_resource_indicator < MAX_PUCCH_RESOURCE_INDICATOR) { // Verify that the value of pucch_resource_indicator is valid - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.count <= pucch_resource_indicator) + struct NR_PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList; + struct NR_PUCCH_Config__resourceToAddModList *resourceToAddModList; + if (bwp_id > 0 && mac->ULbwp[bwp_id-1]) { + AssertFatal(mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList!=NULL,"mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList is null\n"); + resourceSetToAddModList = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList; + resourceToAddModList = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList; + } + else if (bwp_id == 0 && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList!=NULL) { + resourceSetToAddModList = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList; + resourceToAddModList = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceToAddModList; + } + if (resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.count <= pucch_resource_indicator) { LOG_E(PHY, "Value of pucch_resource_indicator is out of bounds! Possibly due to a false DCI. \n"); return (FALSE); } /* check if resource indexing by pucch_resource_indicator of this set is compatible */ - if ((ready_pucch_resource_id == TRUE) || (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0] != MAX_NB_OF_PUCCH_RESOURCES)) { + if ((ready_pucch_resource_id == TRUE) || (resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0] != MAX_NB_OF_PUCCH_RESOURCES)) { if (ready_pucch_resource_id == TRUE) { current_resource_id = *resource_id; } else { - int R_PUCCH = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.count; + int R_PUCCH = resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.count; /* is it the first resource and its size exceeds 8 */ if ((pucch_resource_set_id == 0) && (R_PUCCH > MAX_NB_OF_PUCCH_RESOURCES_PER_SET_NOT_0)) { @@ -1042,22 +1335,13 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 current_resource_id = r_PUCCH; } else { - if (pucch_resource_set_id !=0 ) - current_resource_id = 3; //TBC mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0]; - else - current_resource_id = 1; + current_resource_id = resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0]; } } - /*uint8_t pucch_resource_count = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList.list.count; - for (uint8_t i=0; i<pucch_resource_count; i++) { - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList.list.array[i]->pucch_ResourceId == current_resource_id) - pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList.list.array[i]; - }*/ - - pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[current_resource_id]; + pucch_resource = resourceToAddModList->list.array[current_resource_id]; if (pucch_resource != NULL) { - format_pucch = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[current_resource_id]->format.present; + format_pucch = resourceToAddModList->list.array[current_resource_id]->format.present; nb_symbols_for_tx = get_nb_symbols_pucch(pucch_resource, format_pucch); if (check_pucch_format(mac, gNB_id, format_pucch, nb_symbols_for_tx, uci_size) == TRUE) { @@ -1122,10 +1406,24 @@ int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size) */ /* look for the first resource set which supports uci_size number of bits for payload */ while (pucch_resource_set_id < MAX_NB_OF_PUCCH_RESOURCE_SETS) { - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL) { - //pucch_max_pl_bits = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->maxPayloadMinus1; - if (uci_size <= 2) { //TBC rrc (((pucch_max_pl_bits != NULL) ? *pucch_max_pl_bits : 1706) + 1)) { - //NR_TST_PHY_PRINTF("PUCCH found resource set %d max bits %d\n", pucch_resource_set_id, pucch_max_pl_bits); + if ((bwp_id>0 && + mac->ULbwp[bwp_id-1] && + mac->ULbwp[bwp_id-1]->bwp_Dedicated && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL) || + (bwp_id==0 && + mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL)) { + if (uci_size <= 2) { pucch_resource_set_id = 0; return (pucch_resource_set_id); break; @@ -1322,7 +1620,7 @@ uint16_t get_nr_csi_bitlen(NR_UE_MAC_INST_t *mac) { uint16_t nb_ssbri_cri = 0; uint16_t cri_ssbri_bitlen = 0; - NR_CSI_MeasConfig_t *csi_MeasConfig = mac->scg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_CSI_MeasConfig_t *csi_MeasConfig = mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[0]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; uint16_t nb_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h index 9b53331f503c9c7fb34b860b1834dba1982b5e58..97d8d73282ba024b42224063847e93c0595ce652 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h @@ -60,214 +60,12 @@ /************** VARIABLES *****************************************/ -float RSRP_meas_mapping_nr[98] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { - -140, - -139, - -138, - -137, - -136, - -135, - -134, - -133, - -132, - -131, - -130, - -129, - -128, - -127, - -126, - -125, - -124, - -123, - -122, - -121, - -120, - -119, - -118, - -117, - -116, - -115, - -114, - -113, - -112, - -111, - -110, - -109, - -108, - -107, - -106, - -105, - -104, - -103, - -102, - -101, - -100, - -99, - -98, - -97, - -96, - -95, - -94, - -93, - -92, - -91, - -90, - -89, - -88, - -87, - -86, - -85, - -84, - -83, - -82, - -81, - -80, - -79, - -78, - -77, - -76, - -75, - -74, - -73, - -72, - -71, - -70, - -69, - -68, - -67, - -66, - -65, - -64, - -63, - -62, - -61, - -60, - -59, - -58, - -57, - -56, - -55, - -54, - -53, - -52, - -51, - -50, - -49, - -48, - -47, - -46, - -45, - -44, - -43 - } - #endif - ; - -/* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ -const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= -{ -/* format first symbol Number of symbols PRB offset nb index for set of initial CS */ -/* 0 */ { pucch_format0_nr, 12, 2, 0, 2, { 0, 3, 0, 0 } }, -/* 1 */ { pucch_format0_nr, 12, 2, 0, 3, { 0, 4, 8, 0 } }, -/* 2 */ { pucch_format0_nr, 12, 2, 3, 3, { 0, 4, 8, 0 } }, -/* 3 */ { pucch_format1_nr, 10, 4, 0, 2, { 0, 6, 0, 0 } }, -/* 4 */ { pucch_format1_nr, 10, 4, 0, 4, { 0, 3, 6, 9 } }, -/* 5 */ { pucch_format1_nr, 10, 4, 2, 4, { 0, 3, 6, 9 } }, -/* 6 */ { pucch_format1_nr, 10, 4, 4, 4, { 0, 3, 6, 9 } }, -/* 7 */ { pucch_format1_nr, 4, 10, 0, 2, { 0, 6, 0, 0 } }, -/* 8 */ { pucch_format1_nr, 4, 10, 0, 4, { 0, 3, 6, 9 } }, -/* 9 */ { pucch_format1_nr, 4, 10, 2, 4, { 0, 3, 6, 9 } }, -/* 10 */ { pucch_format1_nr, 4, 10, 4, 4, { 0, 3, 6, 9 } }, -/* 11 */ { pucch_format1_nr, 0, 14, 0, 2, { 0, 6, 0, 0 } }, -/* 12 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, -/* 13 */ { pucch_format1_nr, 0, 14, 2, 4, { 0, 3, 6, 9 } }, -/* 14 */ { pucch_format1_nr, 0, 14, 4, 4, { 0, 3, 6, 9 } }, -/* 15 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, -} -#endif -; - -/* TS 36.213 Table 9.2.3-3: Mapping of values for one HARQ-ACK bit to sequences */ -const int sequence_cyclic_shift_1_harq_ack_bit[2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value 0 1 */ -/* Sequence cyclic shift */ = { 0, 6 } -#endif -; - -/* TS 38.213 Table 9.2.3-4: Mapping of values for two HARQ-ACK bits to sequences */ -const int sequence_cyclic_shift_2_harq_ack_bits[4] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ -/* Sequence cyclic shift */ = { 0, 3, 9, 6 } -#endif -; - -/* TS 36.213 Table 9.2.5-1: Mapping of values for one HARQ-ACK bit and positive SR to sequences */ -const int sequence_cyclic_shift_1_harq_ack_bit_positive_sr[2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value 0 1 */ -/* Sequence cyclic shift */ = { 3, 9 } -#endif -; - -/* TS 36.213 Table 9.2.5-2: Mapping of values for two HARQ-ACK bits and positive SR to sequences */ -const int sequence_cyclic_shift_2_harq_ack_bits_positive_sr[4] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ -/* Sequence cyclic shift */ = { 1, 4, 10, 7 } -#endif -; - -/* TS 36.213 Table 9.2.5.2-1: Code rate corresponding to higher layer parameter PUCCH-F2-maximum-coderate, */ -/* or PUCCH-F3-maximum-coderate, or PUCCH-F4-maximum-coderate */ -/* add one additional element set to 0 for parsing the array until this end */ -/* stored values are code rates * 100 */ -const int code_rate_r_time_100[8] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { (0.08 * 100), (0.15 * 100), (0.25*100), (0.35*100), (0.45*100), (0.60*100), (0.80*100), 0 } -#endif -; - #define NB_SYMBOL_MINUS_FOUR (11) #define I_PUCCH_NO_ADDITIONAL_DMRS (0) #define I_PUCCH_ADDITIONAL_DMRS (1) #define I_PUCCH_NO_HOPPING (0) #define I_PUCCH_HOPING (1) -/* TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4 */ -const int nb_symbols_excluding_dmrs[NB_SYMBOL_MINUS_FOUR][2][2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { -/* No additional DMRS Additional DMRS */ -/* PUCCH length No hopping hopping No hopping hopping */ -/* index 0 1 0 1 */ -/* 4 */ {{ 3 , 2 } , { 3 , 2 }}, -/* 5 */ {{ 3 , 3 } , { 3 , 3 }}, -/* 6 */ {{ 4 , 4 } , { 4 , 4 }}, -/* 7 */ {{ 5 , 5 } , { 5 , 5 }}, -/* 8 */ {{ 6 , 6 } , { 6 , 6 }}, -/* 9 */ {{ 7 , 7 } , { 7 , 7 }}, -/* 10 */ {{ 8 , 8 } , { 6 , 6 }}, -/* 11 */ {{ 9 , 9 } , { 7 , 7 }}, -/* 12 */ {{ 10 , 10 } , { 8 , 8 }}, -/* 13 */ {{ 11 , 11 } , { 9 , 9 }}, -/* 14 */ {{ 12 , 12 } , { 10 , 10 }}, -} -#endif -; - -/* TS 38.213 9.2.5.2 UE procedure for multiplexing HARQ-ACK/SR and CSI in a PUCCH */ -/* this is a counter of number of pucch format 4 per subframe */ -int nb_pucch_format_4_in_subframes[LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { 0 } -#endif -; /*************** FUNCTIONS ****************************************/ diff --git a/openair1/SIMULATION/LTE_PHY/common_sim.h b/openair1/SIMULATION/LTE_PHY/common_sim.h index 796a576aed8d2974a76c42b495a6938d988909ff..5e0be3de895bcfce53c3e643643f498e2a08eb8f 100644 --- a/openair1/SIMULATION/LTE_PHY/common_sim.h +++ b/openair1/SIMULATION/LTE_PHY/common_sim.h @@ -46,13 +46,13 @@ void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastAc } double squareRoot(time_stats_t *ptr) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials - pow((double)ptr->diff/ptr->trials*timeBase,2)); } void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf("%-43s %6.2f us (%d trials)\n", txt, (double)ptr->diff/ptr->trials*timeBase, @@ -69,7 +69,7 @@ void printStatIndent(time_stats_t *ptr, char *txt) { } void printStatIndent2(time_stats_t *ptr, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf(" |__ %-34s %6.2f us (%3d trials)\n", txt, ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, @@ -77,7 +77,7 @@ void printStatIndent2(time_stats_t *ptr, char *txt) { } void printStatIndent3(time_stats_t *ptr, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf(" |__ %-30s %6.2f us (%3d trials)\n", txt, ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 667913d377f9253b7f9ae08d5f2bab289a53125b..895545428234d896ea27e97d0ccc49ba13f1836c 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -65,11 +65,14 @@ void feptx_ofdm(RU_t *ru, int frame, int subframe); void feptx_prec(RU_t *ru, int frame, int subframe); double cpuf; -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) //#define MCS_COUNT 23//added for PHY abstraction #include <openair1/SIMULATION/LTE_PHY/common_sim.h> int otg_enabled=0; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; + /*the following parameters are used to control the processing times calculations*/ double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */ double t_rx_max = -1000000000; /*!< \brief initial max process time for rx */ @@ -1179,7 +1182,7 @@ int main(int argc, char **argv) { DS_TDL, forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[0]->random_channel); reset_meas(&eNB2UE[0]->interp_time); @@ -1193,7 +1196,7 @@ int main(int argc, char **argv) { DS_TDL, forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[n]->random_channel); reset_meas(&eNB2UE[n]->interp_time); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c index a585e8efc6971136895b0bba2ec1d9a22ae4eb8f..3b4e6782dac3b254bd9ae2dded483c7ed7f0c2e4 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c @@ -988,7 +988,7 @@ int main(int argc, char **argv) N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); if(num_rounds>1) { for(n=1; n<8; n++) @@ -999,7 +999,7 @@ int main(int argc, char **argv) N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); } if (eNB2UE[0]==NULL) { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c index 5973f80b55a59f662490e960cb5f295e3ae2267b..bd164150c598a260610f90a2f83ffe87a1ca7c2c 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c @@ -834,7 +834,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); if(num_rounds>1) { for(n=1; n<4; n++) @@ -845,7 +845,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); } if (eNB2UE[0]==NULL) { diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index b1f4d933b3b5e393b2f2e5bc1e91294f1282ea08..78fd1a293e9c7fd7679ab050250e98f58a18efa2 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -1290,7 +1290,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[0]->random_channel); reset_meas(&eNB2UE[0]->interp_time); @@ -1303,7 +1303,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[n]->random_channel); reset_meas(&eNB2UE[n]->interp_time); } diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c index 00ad03c52dc8f0ffb038fe2b98328087bd6787e2..71286faafb45835a64da2a1c215bcfb780a4e889 100644 --- a/openair1/SIMULATION/LTE_PHY/pbchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c @@ -386,7 +386,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); if (interf1>-20) eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, @@ -396,7 +396,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 4, - 0); + 0, 0); if (interf2>-20) eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, @@ -406,7 +406,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 8, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index 004eb24243bff7b6ab4272568e2281737f4e3364..bd2c2d66b9653f7daa9f71985df875c5f7cd0dc4 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -708,7 +708,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); L1_rxtx_proc_t *proc_rxtx = (subframe == 0)? &eNB->proc.L1_proc: &eNB->proc.L1_proc_tx; eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,N_RB_DL,0); UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0); diff --git a/openair1/SIMULATION/LTE_PHY/prachsim.c b/openair1/SIMULATION/LTE_PHY/prachsim.c index c997aa763938e820663134271fbe5d260754c87e..229764a8935cb064c1a736bb9961aa48f4dcb696 100644 --- a/openair1/SIMULATION/LTE_PHY/prachsim.c +++ b/openair1/SIMULATION/LTE_PHY/prachsim.c @@ -343,7 +343,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), 0.0, delay, - 0); + 0, 0); if (UE2eNB==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c index 127bfcb533c76a0496541db4ee763e38c278566d..083a756afb259beeb509f68aef383c4e2aa11dd3 100644 --- a/openair1/SIMULATION/LTE_PHY/pucchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c @@ -323,7 +323,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), 0.0, 0, - 0); + 0, 0); if (UE2eNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/scansim.c b/openair1/SIMULATION/LTE_PHY/scansim.c index 5ceeee7f2f5d5d16575183e05cb2d5185186ed1e..839d30a8dea5332f4497c533b5aba9205ad4ddc6 100644 --- a/openair1/SIMULATION/LTE_PHY/scansim.c +++ b/openair1/SIMULATION/LTE_PHY/scansim.c @@ -335,7 +335,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/syncsim.c b/openair1/SIMULATION/LTE_PHY/syncsim.c index 80598b37e46d481a5b7668402edce62c64f8d365..e8ee7d3d5e8b086a1804867772a2cffcf367bc94 100644 --- a/openair1/SIMULATION/LTE_PHY/syncsim.c +++ b/openair1/SIMULATION/LTE_PHY/syncsim.c @@ -724,7 +724,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (interf1>-20) eNB2UE1 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx, @@ -733,7 +733,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (interf2>-20) eNB2UE2 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx, @@ -742,7 +742,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 80beee4bed789249b134ef24ebd914f248895827..c6049bc31d9e3a9b4aa10e7899dad725b1c88801 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -57,7 +57,7 @@ #include "executables/split_headers.h" double cpuf; -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) //#define MCS_COUNT 23//added for PHY abstraction #include <openair1/SIMULATION/LTE_PHY/common_sim.h> channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; @@ -70,6 +70,9 @@ node_desc_t *ue_data[NUMBER_OF_UE_MAX]; extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16]; //extern char* namepointer_chMag ; int xforms=0; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; + FD_lte_phy_scope_enb *form_enb; char title[255]; @@ -734,7 +737,7 @@ int main(int argc, char **argv) { 30e-9, forgetting_factor, delay, - 0); + 0, 0); // set Doppler UE2eNB->max_Doppler = maxDoppler; diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 00983553d8ff287582ac089b55f4877e8c642ffc..12b0b1d1f0adb5a21b7f29370d690d02083e25cd 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -339,7 +339,7 @@ int main(int argc, char **argv) 61.44e6, //N_RB2sampling_rate(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, - 0, 0, 0); + 0, 0, 0, 0); if (gNB2UE == NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 3a989566d22583c722e3a1e23c2b159928bc08fd..d53041aa749b14c9108d353613e655cacea5a539 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -63,7 +63,7 @@ //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "PHY/NR_REFSIG/ptrs_nr.h" #include "NR_RRCReconfiguration.h" -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" #include <openair2/LAYER2/MAC/mac_vars.h> @@ -83,16 +83,23 @@ uint16_t sf_ahead=4 ; uint16_t sl_ahead=0; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; +msc_interface_t msc_interface; + // dummy functions int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const int8_t channel, - const uint8_t* pduP, - const sdu_size_t pdu_len) +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len) { return 0; } @@ -173,7 +180,9 @@ int nr_derive_key(int alg_type, uint8_t alg_id, } void config_common(int Mod_idP, - int pdsch_AntennaPorts, + int ssb_SubcarrierOffset, + int pdsch_AntennaPorts, + int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc ); @@ -204,6 +213,7 @@ int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } openair0_config_t openair0_cfg[MAX_CARDS]; void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex,int8_t *ptrs_arg); void update_dmrs_config(NR_CellGroupConfig_t *scg,PHY_VARS_NR_UE *ue, int8_t* dmrs_arg); +extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration /* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs from command line of dlsim, does not search for CCE/PUCCH occasion but simply sets to 0 */ @@ -267,7 +277,7 @@ int main(int argc, char **argv) //float psnr; float eff_tp_check = 0.7; uint8_t snrRun; - uint32_t TBS; + uint32_t TBS = 0; int **txdata; double **s_re,**s_im,**r_re,**r_im; //double iqim = 0.0; @@ -296,7 +306,7 @@ int main(int argc, char **argv) //uint8_t frame_mod4,num_pdcch_symbols = 0; - SCM_t channel_model=AWGN;//Rayleigh1_anticorr; + SCM_t channel_model = AWGN; // AWGN Rayleigh1 Rayleigh1_anticorr; NB_UE_INST = 1; //double pbch_sinr; @@ -455,7 +465,7 @@ int main(int argc, char **argv) case 'y': n_tx=atoi(optarg); - if ((n_tx==0) || (n_tx>2)) { + if ((n_tx==0) || (n_tx>4)) {//extend gNB to support n_tx = 4 printf("Unsupported number of tx antennas %d\n",n_tx); exit(-1); } @@ -465,7 +475,7 @@ int main(int argc, char **argv) case 'z': n_rx=atoi(optarg); - if ((n_rx==0) || (n_rx>2)) { + if ((n_rx==0) || (n_rx>4)) {//extend UE to support n_tx = 4 printf("Unsupported number of rx antennas %d\n",n_rx); exit(-1); } @@ -600,7 +610,8 @@ int main(int argc, char **argv) InitSinLUT(); get_softmodem_params()->phy_test = 1; - + get_softmodem_params()->do_ra = 0; + if (snr1set==0) snr1 = snr0+10; init_dlsch_tpool(dlsch_threads); @@ -673,20 +684,26 @@ int main(int argc, char **argv) rrc.carrier.servingcellconfigcommon = calloc(1,sizeof(*rrc.carrier.servingcellconfigcommon)); NR_ServingCellConfigCommon_t *scc = rrc.carrier.servingcellconfigcommon; + NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); NR_CellGroupConfig_t *secondaryCellGroup=calloc(1,sizeof(*secondaryCellGroup)); prepare_scc(rrc.carrier.servingcellconfigcommon); - uint64_t ssb_bitmap; + uint64_t ssb_bitmap = 1; fill_scc(rrc.carrier.servingcellconfigcommon,&ssb_bitmap,N_RB_DL,N_RB_DL,mu,mu); - + ssb_bitmap = 1;// Enable only first SSB with index ssb_indx=0 fix_scc(scc,ssb_bitmap); - fill_default_secondaryCellGroup(scc, - secondaryCellGroup, - 0, - 1, - n_tx, - 0); + prepare_scd(scd); + fill_default_secondaryCellGroup(scc, + scd, + secondaryCellGroup, + 0, + 1, + n_tx, + 0); + + /* RRC parameter validation for secondaryCellGroup */ + fix_scd(scd); /* -U option modify DMRS */ if(modify_dmrs) { update_dmrs_config(secondaryCellGroup, NULL,dmrs_arg); @@ -702,9 +719,9 @@ int main(int argc, char **argv) AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); + rrc_mac_config_req_gNB(0,0,n_tx,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + rrc_mac_config_req_gNB(0,0,n_tx,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); phy_init_nr_gNB(gNB,0,0); N_RB_DL = gNB->frame_parms.N_RB_DL; NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info; @@ -752,12 +769,12 @@ int main(int argc, char **argv) gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model, - fs, + fs/1e6,//sampling frequency in MHz bw, 30e-9, 0, 0, - 0); + 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -767,28 +784,28 @@ int main(int argc, char **argv) frame_length_complex_samples = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; //frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; - s_re = malloc(2*sizeof(double*)); - s_im = malloc(2*sizeof(double*)); - r_re = malloc(2*sizeof(double*)); - r_im = malloc(2*sizeof(double*)); - txdata = malloc(2*sizeof(int*)); - - for (i=0; i<2; i++) { + s_re = malloc(n_tx*sizeof(double*)); + s_im = malloc(n_tx*sizeof(double*)); + r_re = malloc(n_rx*sizeof(double*)); + r_im = malloc(n_rx*sizeof(double*)); + txdata = malloc(n_tx*sizeof(int*)); + for (i=0; i<n_tx; i++) { s_re[i] = malloc(frame_length_complex_samples*sizeof(double)); bzero(s_re[i],frame_length_complex_samples*sizeof(double)); s_im[i] = malloc(frame_length_complex_samples*sizeof(double)); bzero(s_im[i],frame_length_complex_samples*sizeof(double)); + printf("Allocating %d samples for txdata\n",frame_length_complex_samples); + txdata[i] = malloc(frame_length_complex_samples*sizeof(int)); + bzero(txdata[i],frame_length_complex_samples*sizeof(int)); + } + + for (i=0; i<n_rx; i++) { r_re[i] = malloc(frame_length_complex_samples*sizeof(double)); bzero(r_re[i],frame_length_complex_samples*sizeof(double)); r_im[i] = malloc(frame_length_complex_samples*sizeof(double)); bzero(r_im[i],frame_length_complex_samples*sizeof(double)); - - printf("Allocating %d samples for txdata\n",frame_length_complex_samples); - txdata[i] = malloc(frame_length_complex_samples*sizeof(int)); - bzero(txdata[i],frame_length_complex_samples*sizeof(int)); - } if (pbch_file_fd!=NULL) { @@ -803,6 +820,7 @@ int main(int argc, char **argv) PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE*)); PHY_vars_UE_g[0][0] = UE; memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS)); + UE->frame_parms.nb_antennas_rx = n_rx; if (run_initial_sync==1) UE->is_synchronized = 0; else {UE->is_synchronized = 1; UE->UE_mode[0]=PUSCH;} @@ -821,7 +839,7 @@ int main(int argc, char **argv) init_nr_ue_transport(UE,0); nr_gold_pbch(UE); - nr_gold_pdcch(UE,0,2); + nr_gold_pdcch(UE,0); nr_l2_init_ue(NULL); UE_mac = get_mac_inst(0); @@ -848,7 +866,8 @@ int main(int argc, char **argv) // generate signal AssertFatal(input_fd==NULL,"Not ready for input signal file\n"); gNB->pbch_configured = 1; - gNB->ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; + gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; + gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0; //Configure UE rrc.carrier.MIB = (uint8_t*) malloc(4); @@ -872,7 +891,7 @@ int main(int argc, char **argv) scheduled_response.CC_id = 0; scheduled_response.frame = frame; scheduled_response.slot = slot; - scheduled_response.thread_id = UE_proc.thread_id; + scheduled_response.thread_id = 0; nr_ue_phy_config_request(&UE_mac->phy_config); //NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels; @@ -974,16 +993,16 @@ int main(int argc, char **argv) printf("[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); } if (run_initial_sync) - nr_common_signal_procedures(gNB,frame,slot); + nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[0].ssb_pdu); else - phy_procedures_gNB_TX(gNB,frame,slot,0); + phy_procedures_gNB_TX(gNB,frame,slot,1); int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP; if (n_trials==1) { - LOG_M("txsigF0.m","txsF0", &gNB->common_vars.txdataF[0][txdataF_offset],frame_parms->samples_per_slot_wCP,1,1); + LOG_M("txsigF0.m","txsF0=", &gNB->common_vars.txdataF[0][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); if (gNB->frame_parms.nb_antennas_tx>1) - LOG_M("txsigF1.m","txsF1", &gNB->common_vars.txdataF[1][txdataF_offset],frame_parms->samples_per_slot_wCP,1,1); + LOG_M("txsigF1.m","txsF1=", &gNB->common_vars.txdataF[1][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); } int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); if (n_trials==1) printf("tx_offset %d, txdataF_offset %d \n", tx_offset,txdataF_offset); @@ -1007,45 +1026,79 @@ int main(int argc, char **argv) } if (n_trials==1) { - LOG_M("txsig0.m","txs0", &txdata[0][tx_offset],frame_parms->get_samples_slot_timestamp(slot,frame_parms,0),1,1); - if (gNB->frame_parms.nb_antennas_tx>1) - LOG_M("txsig1.m","txs1", &txdata[1][tx_offset],frame_parms->get_samples_slot_timestamp(slot,frame_parms,0),1,1); + char filename[100];//LOG_M + for (aa=0;aa<n_tx;aa++) { + sprintf(filename,"txsig%d.m", aa);//LOG_M + LOG_M(filename,"txs", &txdata[aa][tx_offset+frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0],6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples),1,1); + } } 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); - - // if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev)); + int txlev[n_tx]; + int txlev_sum = 0; + int l_ofdm = 6; + for (aa=0; aa<n_tx; aa++) { + txlev[aa] = signal_energy(&txdata[aa][tx_offset+l_ofdm*frame_parms->ofdm_symbol_size + (l_ofdm-1)*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + txlev_sum += txlev[aa]; + if (n_trials==1) printf("txlev[%d] = %d (%f dB) txlev_sum %d\n",aa,txlev[aa],10*log10((double)txlev[aa]),txlev_sum); + } for (i=(frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)); i<(frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0)); i++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { - r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]); - r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]); + s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]); + s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]); } } + double ts = 1.0/(frame_parms->subcarrier_spacing * frame_parms->ofdm_symbol_size); - //AWGN - sigma2_dB = 10 * log10((double)txlev * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize))) - SNR; + //Compute AWGN variance + sigma2_dB = 10 * log10((double)txlev_sum * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize))) - SNR; sigma2 = pow(10, sigma2_dB/10); - if (n_trials==1) printf("sigma2 %f (%f dB), txlev %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize)); + if (n_trials==1) printf("sigma2 %f (%f dB), txlev_sum %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev_sum),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize)); + + for (aa=0; aa<n_rx; aa++) { + bzero(r_re[aa],frame_length_complex_samples*sizeof(double)); + bzero(r_im[aa],frame_length_complex_samples*sizeof(double)); + } + // Apply MIMO Channel + if (channel_model != AWGN) multipath_tv_channel(gNB2UE, + s_re, + s_im, + r_re, + r_im, + frame_length_complex_samples, + 0); + for (i=frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); i<frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0); i++) { - for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { - ((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); - ((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); + for (int aa_rx=0; aa_rx<n_rx; aa_rx++) { + + if (channel_model == AWGN) { + // sum up signals from different Tx antennas + r_re[aa_rx][i] = 0; + r_im[aa_rx][i] = 0; + for (aa=0; aa<n_tx; aa++) { + r_re[aa_rx][i] += s_re[aa][i]; + r_im[aa_rx][i] += s_im[aa][i]; + } + } + // Add Gaussian noise + ((short*) UE->common_vars.rxdata[aa_rx])[2*i] = (short) ((r_re[aa_rx][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); + ((short*) UE->common_vars.rxdata[aa_rx])[2*i+1] = (short) ((r_im[aa_rx][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); /* Add phase noise if enabled */ if (pdu_bit_map & 0x1) { - phase_noise(ts, &((short*) UE->common_vars.rxdata[aa])[2*i], - &((short*) UE->common_vars.rxdata[aa])[2*i+1]); + phase_noise(ts, &((short*) UE->common_vars.rxdata[aa_rx])[2*i], + &((short*) UE->common_vars.rxdata[aa_rx])[2*i+1]); } } } @@ -1085,10 +1138,10 @@ int main(int argc, char **argv) available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2); printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); } - + for (i = 0; i < available_bits; i++) { - - if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) || + + if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) || ((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0))) { if(errors_scrambling == 0) { @@ -1097,7 +1150,7 @@ int main(int argc, char **argv) } errors_scrambling++; } - + } for (i = 0; i < TBS; i++) { @@ -1225,12 +1278,16 @@ int main(int argc, char **argv) } }*/ - for (i = 0; i < 2; i++) { + free_channel_desc_scm(gNB2UE); + + for (i = 0; i < n_tx; i++) { free(s_re[i]); free(s_im[i]); + free(txdata[i]); + } + for (i = 0; i < n_rx; i++) { free(r_re[i]); free(r_im[i]); - free(txdata[i]); } free(s_re); diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h index 906636d56fec982fd56f2f4d95936ba9ffd6c422..8d4acd1af1f2b2726a6885f8f6e53d34b284e7aa 100644 --- a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h @@ -149,13 +149,13 @@ void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present=NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139; scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139=0; scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig=NR_RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet; - *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=2; + *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=6; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->startSymbolAndLength=55; - *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->k2=2; + *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->k2=6; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->startSymbolAndLength=69; - *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->k2=2; + *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->k2=6; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->startSymbolAndLength=55; *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[3]->k2=33; @@ -222,6 +222,7 @@ void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap); void prepare_scc(NR_ServingCellConfigCommon_t *scc); +void prepare_scd(NR_ServingCellConfig_t *scd); ngap_gNB_config_t ngap_config; uint32_t ngap_generate_gNB_id(void) {return 0;} void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) { return;} diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 7b845c5bd381ff976f306248d6a9a1f6c19f56b4..c24a841c4bbf028e1be84a37b199217a840ed6bb 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -66,6 +66,7 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3}; uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3}; uint64_t get_softmodem_optmask(void) {return 0;} +softmodem_params_t *get_softmodem_params(void) {return 0;} void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} @@ -101,8 +102,8 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, //gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED; gNB->mac_enabled = 1; - fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); - fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); + fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); if (mu>2) fp->nr_band = 257; else fp->nr_band = 78; fp->threequarter_fs= 0; @@ -119,7 +120,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, int main(int argc, char **argv) { char c; - int i,aa;//,l; + int i,aa,start_symbol; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; double cfo=0; uint8_t snr1set=0; @@ -426,29 +427,28 @@ int main(int argc, char **argv) switch (mu) { case 1: - scs = 30000; - if (N_RB_DL == 217) { - fs = 122.88e6; - bw = 80e6; - - } - else if (N_RB_DL == 245) { - fs = 122.88e6; - bw = 90e6; - } - else if (N_RB_DL == 273) { - fs = 122.88e6; - bw = 100e6; - } - else if (N_RB_DL == 106) { - fs = 61.44e6; - bw = 40e6; - } - else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); - break; - - + scs = 30000; + frame_parms->Lmax = 8; + if (N_RB_DL == 217) { + fs = 122.88e6; + bw = 80e6; + } + else if (N_RB_DL == 245) { + fs = 122.88e6; + bw = 90e6; + } + else if (N_RB_DL == 273) { + fs = 122.88e6; + bw = 100e6; + } + else if (N_RB_DL == 106) { + fs = 61.44e6; + bw = 40e6; + } + else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); + break; case 3: + frame_parms->Lmax = 64; scs = 120000; if (N_RB_DL == 66) { fs = 122.88e6; @@ -457,6 +457,7 @@ int main(int argc, char **argv) else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); break; } + // cfo with respect to sub-carrier spacing eps = cfo/scs; @@ -479,7 +480,7 @@ int main(int argc, char **argv) 300e-9, 0, 0, - 0); + 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -510,7 +511,6 @@ int main(int argc, char **argv) printf("Allocating %d samples for txdata\n",frame_length_complex_samples); txdata[i] = malloc(frame_length_complex_samples*sizeof(int)); bzero(r_re[i],frame_length_complex_samples*sizeof(int)); - } if (pbch_file_fd!=NULL) { @@ -536,60 +536,68 @@ int main(int argc, char **argv) } nr_gold_pbch(UE); + // generate signal if (input_fd==NULL) { - gNB->pbch_configured = 1; - - gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33; - for (int slot=0;slot<frame_parms->slots_per_frame;slot++) { - for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) - memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t)); - - nr_common_signal_procedures (gNB,frame,slot); - - for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) { - if (cyclic_prefix_type == 1) { - PHY_ofdm_mod(gNB->common_vars.txdataF[aa], - &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - frame_parms->ofdm_symbol_size, - 12, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); - } else { - /* nr_normal_prefix_mod(gNB->common_vars.txdataF[aa], - &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - 14, - frame_parms);*/ - PHY_ofdm_mod(gNB->common_vars.txdataF[aa], - (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - frame_parms->ofdm_symbol_size, - 1, - frame_parms->nb_prefix_samples0, - CYCLIC_PREFIX); - - apply_nr_rotation(frame_parms, - (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - slot, - 0, - 1, - frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0); - PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size], - (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], - frame_parms->ofdm_symbol_size, - 13, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); - apply_nr_rotation(frame_parms, - (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], - slot, - 1, - 13, - frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); - } - } + for (i=0; i<frame_parms->Lmax; i++) { + if((SSB_positions >> i) & 0x01) { + + gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33; + gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i; + + start_symbol = nr_get_ssb_start_symbol(frame_parms,i); + int slot = start_symbol/14; + + for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) + memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t)); + + nr_common_signal_procedures (gNB,frame,slot,gNB->ssb[i].ssb_pdu); + + for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) { + if (cyclic_prefix_type == 1) { + PHY_ofdm_mod(gNB->common_vars.txdataF[aa], + &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + frame_parms->ofdm_symbol_size, + 12, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + } else { + /*nr_normal_prefix_mod(gNB->common_vars.txdataF[aa], + &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + 14, + frame_parms);*/ + PHY_ofdm_mod(gNB->common_vars.txdataF[aa], + (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples0, + CYCLIC_PREFIX); + + apply_nr_rotation(frame_parms, + (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + slot, + 0, + 1, + frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0); + + PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size], + (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], + frame_parms->ofdm_symbol_size, + 13, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + + apply_nr_rotation(frame_parms, + (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], + slot, + 1, + 13, + frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); + } + } + } } - LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1); if (gNB->frame_parms.nb_antennas_tx>1) LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1); @@ -598,9 +606,9 @@ int main(int argc, char **argv) printf("Reading %d samples from file to antenna buffer %d\n",frame_length_complex_samples,0); UE->UE_fo_compensation = 1; // perform fo compensation when samples from file are used if (fread(txdata[0], - sizeof(int32_t), - frame_length_complex_samples, - input_fd) != frame_length_complex_samples) { + sizeof(int32_t), + frame_length_complex_samples, + input_fd) != frame_length_complex_samples) { printf("error reading from file\n"); //exit(-1); } @@ -684,17 +692,14 @@ int main(int argc, char **argv) UE->rx_offset=0; uint8_t ssb_index = 0; while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb - frame_parms->ssb_index = ssb_index; - UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms); + UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index); - int ssb_slot = (ssb_index>>1)+(n_hf*frame_parms->slots_per_frame); + int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1)); for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) { nr_slot_fep(UE, &proc, i%frame_parms->symbols_per_slot, - ssb_slot, - 0, - 0); + ssb_slot); nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf); @@ -718,7 +723,7 @@ int main(int argc, char **argv) payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte); for (i=0;i<3;i++){ - payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); + payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); } //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte); //printf("ret %d\n", payload_ret); diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 8bd54ec345bddd6d2690077e1f9ab37a0b0f27b7..26c151818873dbe3485d89aee0a965c4b77f0749 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -37,6 +37,7 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "PHY/phy_vars_nr_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" +#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" @@ -47,6 +48,7 @@ #include "OCG_vars.h" #include <openair2/LAYER2/MAC/mac_vars.h> #include <openair2/RRC/LTE/rrc_vars.h> +#include <openair2/RRC/NR_UE/rrc_defs.h> //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" @@ -65,10 +67,12 @@ extern uint16_t prach_root_sequence_map0_3[838]; openair0_config_t openair0_cfg[MAX_CARDS]; //uint8_t nfapi_mode=0; uint16_t sl_ahead = 0; +msc_interface_t msc_interface; //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); /* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ +msc_interface_t msc_interface; uint64_t get_softmodem_optmask(void) {return 0;} softmodem_params_t *get_softmodem_params(void) {return 0;} int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } @@ -130,7 +134,18 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( return 0; } -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return 0;} +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len) +{ + return 0; +} void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { @@ -165,7 +180,7 @@ int main(int argc, char **argv){ double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0; double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs, bw; - int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; + int i, l, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0; uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0; uint8_t frame = 1, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol; @@ -205,7 +220,7 @@ int main(int argc, char **argv){ randominit(0); - while ((c = getopt (argc, argv, "hHaA:Cc:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) { + while ((c = getopt (argc, argv, "hHaA:Cc:l:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) { switch (c) { case 'a': printf("Running AWGN simulation\n"); @@ -218,6 +233,10 @@ int main(int argc, char **argv){ config_index = atoi(optarg); break; + case 'l': + loglvl = atoi(optarg); + break; + case 'r': msg1_frequencystart = atoi(optarg); break; @@ -465,7 +484,10 @@ int main(int argc, char **argv){ nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions); - uint64_t absoluteFrequencyPointA = (mu==1 ? 640000 : 2070833); + uint64_t absoluteFrequencyPointA = to_nrarfcn(frame_parms->nr_band, + frame_parms->dl_CarrierFreq, + frame_parms->numerology_index, + frame_parms->N_RB_UL*(180e3)*(1 << frame_parms->numerology_index)); uint8_t subframe = slot/frame_parms->slots_per_subframe; @@ -655,7 +677,7 @@ int main(int argc, char **argv){ DS_TDL, 0.0, delay, - 0); + 0, 0); if (UE2gNB==NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -793,7 +815,17 @@ int main(int argc, char **argv){ } } - + for (l = 0; l < frame_parms->symbols_per_slot; l++) { + for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { + nr_slot_fep_ul(frame_parms, + ru->common.rxdata[aa], + ru->common.rxdataF[aa], + l, + slot, + ru->N_TA_offset); + } + } + rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot); gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion]; @@ -816,7 +848,8 @@ int main(int argc, char **argv){ LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1); LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); - LOG_M("ru_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1); + LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1); + LOG_M("ru_prach_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1); LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1); LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1); #endif diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 8d79633a6fb7543b2a4961ab8515211febf13f1a..4cef1213c9787b9f6c60d9062f6aa579605aba42 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -418,7 +418,7 @@ int main(int argc, char **argv) printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO); } - UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0); + UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0, 0); if (UE2gNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 6f2af73a1dd33241c23c75c0aef41c00a285a0a4..f84e5536833f893e717ae4bbcb5b88c2f4ab2e15 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -364,7 +364,7 @@ int main(int argc, char **argv) 61.44e6, //N_RB2sampling_rate(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, - 0,0,0); + 0,0,0, 0); if (gNB2UE == NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 35d642e7b3a3b7a3789c0d3a9d36118b7cee5777..920994810dc8e4126a2d45998d5cc1b3eb1e6f1b 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -57,7 +57,7 @@ #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "common/utils/threadPool/thread-pool.h" #include "PHY/NR_REFSIG/ptrs_nr.h" -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" #include <openair2/LAYER2/MAC/mac_vars.h> @@ -81,10 +81,25 @@ uint16_t sl_ahead=0; double cpuf; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; +msc_interface_t msc_interface; + +extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration + +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len) +{ + return 0; +} - -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, - const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; } int generate_dlsch_header(unsigned char *mac_header, unsigned char num_sdus, unsigned short *sdu_lengths, @@ -592,7 +607,7 @@ int main(int argc, char **argv) sampling_frequency, bandwidth, DS_TDL, - 0, 0, 0); + 0, 0, 0, 0); if (UE2gNB == NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -619,8 +634,8 @@ int main(int argc, char **argv) frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) - frame_parms->nb_antennas_tx = n_tx; - frame_parms->nb_antennas_rx = n_rx; + //frame_parms->nb_antennas_tx = n_tx; + //frame_parms->nb_antennas_rx = n_rx; frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = N_RB_UL; frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; @@ -638,6 +653,7 @@ int main(int argc, char **argv) rrc.carrier.servingcellconfigcommon = calloc(1,sizeof(*rrc.carrier.servingcellconfigcommon)); NR_ServingCellConfigCommon_t *scc = rrc.carrier.servingcellconfigcommon; + NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); NR_CellGroupConfig_t *secondaryCellGroup=calloc(1,sizeof(*secondaryCellGroup)); prepare_scc(rrc.carrier.servingcellconfigcommon); uint64_t ssb_bitmap; @@ -645,7 +661,10 @@ int main(int argc, char **argv) fix_scc(scc,ssb_bitmap); + prepare_scd(scd); + fill_default_secondaryCellGroup(scc, + scd, secondaryCellGroup, 0, 1, @@ -654,13 +673,16 @@ int main(int argc, char **argv) // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); + /* RRC parameter validation for secondaryCellGroup */ + fix_scd(scd); + AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); + rrc_mac_config_req_gNB(0,0,n_tx,n_rx,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + rrc_mac_config_req_gNB(0,0,1,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); phy_init_nr_gNB(gNB,0,0); N_RB_DL = gNB->frame_parms.N_RB_DL; @@ -1065,70 +1087,69 @@ int main(int argc, char **argv) } - nr_fill_ulsch(gNB,frame,slot,pusch_pdu); + //nr_fill_ulsch(gNB,frame,slot,pusch_pdu); // Not needed as its its already filled as apart of "nr_schedule_response(Sched_INFO);" for (int i=0;i<(TBS/8);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff; 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); - - - if (n_trials==1) { - LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1); - LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,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); + // 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); + + + if (n_trials==1) { + LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1); + LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,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); } else n_trials = 1; if (input_fd == NULL ) { - sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;; - sigma = pow(10,sigma_dB/10); + sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;; + sigma = pow(10,sigma_dB/10); - if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double)frame_parms->ofdm_symbol_size/(12*nb_rb)); + if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double) + frame_parms->ofdm_symbol_size/(12*nb_rb)); - for (i=0; i<slot_length; i++) { - for (int aa=0; aa<1; aa++) { - s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]); - s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]); - } - } - + for (i=0; i<slot_length; i++) { + for (int aa=0; aa<frame_parms->nb_antennas_rx; aa++) { + s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]); + s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]); + } + } - if (UE2gNB->max_Doppler == 0) { - multipath_channel(UE2gNB,s_re,s_im,r_re,r_im, - slot_length,0,(n_trials==1)?1:0); - } else { - multipath_tv_channel(UE2gNB,s_re,s_im,r_re,r_im, - 2*slot_length,0); - } - for (i=0; i<slot_length; i++) { - for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) { - ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point - ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); + + if (UE2gNB->max_Doppler == 0) { + multipath_channel(UE2gNB, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials==1)?1:0); + } else { + multipath_tv_channel(UE2gNB, s_re, s_im, r_re, r_im, 2*slot_length, 0); + } + for (i=0; i<slot_length; i++) { + for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) { + ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point + ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); /* Add phase noise if enabled */ if (pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { phase_noise(ts, &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)], &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1]); } - } - } + } + } - } + } /*End input_fd */ if(pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { @@ -1149,7 +1170,6 @@ int main(int argc, char **argv) gNB->UL_INFO.rx_ind.number_of_pdus = 0; gNB->UL_INFO.crc_ind.number_crcs = 0; - start_meas(&gNB->phy_proc_rx); phy_procedures_gNB_common_RX(gNB, frame, slot); phy_procedures_gNB_uespec_RX(gNB, frame, slot); @@ -1181,7 +1201,6 @@ int main(int argc, char **argv) LOG_M("rxsigF0_llr.m","rxsF0_llr", &gNB->pusch_vars[0]->llr[0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0); } - start_meas(&gNB->phy_proc_rx); //////////////////////////////////////////////////////////// if (gNB->ulsch[0][0]->last_iteration_cnt >= diff --git a/openair1/SIMULATION/TOOLS/DOC/arch.md b/openair1/SIMULATION/TOOLS/DOC/arch.md new file mode 100644 index 0000000000000000000000000000000000000000..30be337829d05000d6cfa42c5174c0bbd323d55a --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/arch.md @@ -0,0 +1,9 @@ +# Channel simulation source files + +1. [random_channel.c](../random_channel.c) +1. [sim.h](../sim.h) + + + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md new file mode 100644 index 0000000000000000000000000000000000000000..be2b987b409ed98363d516da1a11617b28409b65 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md @@ -0,0 +1,13 @@ +# OAI channel simulation feature + +oai includes a channel simulation feature that any component can use to alter time domain samples of a RF channel by applying pre-defined models as defined, for example, in 3GPP TR 36.873 or TR 38.901 + +Definition, configuration and run-time modification of a channel model are implemented in common code included in UEs, gNb, eNB and used when running with the rfsimulator or the L1 simulator. Phy simulators are also using channel simulation but configuration is done via dedicated command line options. The rfsimulator is the only option to get access to all the configurations and run-time modifications features of oai channel simulation. + +## Documentation + +* [runtime usage](rtusage.md) +* [developer usage](devusage.md) +* [module architecture](arch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/openair1/SIMULATION/TOOLS/DOC/devusage.md b/openair1/SIMULATION/TOOLS/DOC/devusage.md new file mode 100644 index 0000000000000000000000000000000000000000..8fa6b3fe7a4761c4a969d2072d784a10a874548a --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/devusage.md @@ -0,0 +1,7 @@ +### channel simulation developer usage + + +[Configuring the channel simulation](rtusage.md) + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/DOC/rtusage.md b/openair1/SIMULATION/TOOLS/DOC/rtusage.md new file mode 100644 index 0000000000000000000000000000000000000000..37fc62b496e9aa9769de4e2285f481c5f7ebe2d1 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/rtusage.md @@ -0,0 +1,69 @@ +## configuring the channel simulation +Oai channel simulation is using the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify some channel model parameters + +All channel simulation parameters are defined in the `channelmod` section. Most parameters are specific to a channel model and are only used by the rfsimulator. + +### global parameters + +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `max_chan` | integer | `25` | Maximum number of channel model that can be defined in the system. Must be greater than the number of model definitions in the model list loaded at init time. | +| `modellist` | character string | `DefaultChannelList` | Name of the channel models list to load at init time. | + +### Model lists + +Several model lists can be defined in the oai configuration file. One, defined by the `modellist` parameter is loaded at init time. In the configuration file each model list item describes a channel model using a group of parameters: + +| parameter name | type | default | description | +|:---:|:---:|:---:|:----| +| `model name` | character string | mandatory |name of the model, as used in the code to retrieve a model definition| +| `type` | | `AWGN` | name of the channel modelization algorithm applied on rf signal. The list of available model types can be listed via the [telnet server](../../telnetsrv/DOC/telnetsrv.md) or by entering an invalid type name | +| `ploss_dB` | real (float) | | path loss of the channel, in dB | +| `noise_power_dB` | real (double) | | noise of the channel in dB | +| `forgetfact` | real (double) | | | +| `offset` | integer | | | +| `ds_tdl` | real double | | | + +Channel simulation parameters can also be specified on the command line: + +```bash +./lte-softmodem -O ../../../ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --noS1 --rfsim --rfsimulator.options chanmod --rfsimulator.serveraddr enb --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120 +``` +### Using the telnet server to modify channel simulator parameters +The telnet server includes a `channelmod` command which can be used to dynamically modify some channel model parameters. This command is only available when channel simulation is enabled (via `rfsimulator.options chanmod` option when running the rfsimulator. `channelmod` command has its own help: + +``` +$ telnet 127.0.0.1 9090 +Trying 127.0.0.1... +Connected to 127.0.0.1. +Escape character is '^]'. + +softmodem_enb> help +..................................... + module 6 = channelmod: + channelmod help + channelmod show <predef,current> + channelmod modify <channelid> <param> <value> + module 7 = rfsimu: + rfsimu setmodel <model name> <model type> +softmodem_enb> channelmod help +channelmod commands can be used to display or modify channel models parameters +channelmod show predef: display predefined model algorithms available in oai +channelmod show current: display the currently used models in the running executable +channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value + <model index> specifies the model, the show current model command can be used to list the current models indexes + <param name> can be one of "riceanf", "aoa", "randaoa", "ploss", "noise_power_dB", "offset", "forgetf" +softmodem_enb> + +``` + + + + + + + +The [rfsimulator documentation](../../../../targets/ARCH/rfsimulator/README.md ) has also some specific information when using the channel simulation via this tool. + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c index d344992586f85025abe01b356ccb021ba41a25b0..c68ce737580b6ec7ae36763e6138adebbb3f82ce 100644 --- a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c +++ b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c @@ -48,9 +48,9 @@ void multipath_tv_channel(channel_desc_t *desc, printf("[TV CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d max_doppler %g\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length, desc->max_Doppler); #endif - tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex)); - rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex)); - H_t= (double complex ** *) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **)); + tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex *)); + rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex *)); + H_t= (double complex ***) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **)); // tv_H_t = (double complex *) malloc(length*sizeof(double complex)); rx_temp= (double complex *) calloc(length,sizeof(double complex)); @@ -63,10 +63,10 @@ void multipath_tv_channel(channel_desc_t *desc, } for(i=0; i<desc->nb_tx*desc->nb_rx; i++) { - H_t[i] = (double complex **) malloc(length*sizeof(double complex *)); + H_t[i] = (double complex **)malloc(desc->nb_taps*sizeof(double complex *)); - for(j=0; j<length; j++) { - H_t[i][j] = (double complex *) calloc (desc->nb_taps,sizeof(double complex)); + for(j=0; j<desc->nb_taps; j++) { + H_t[i][j] = (double complex *)calloc(length,sizeof(double complex)); } } @@ -116,7 +116,7 @@ void multipath_tv_channel(channel_desc_t *desc, free(rx); for(i=0; i<desc->nb_rx*desc->nb_tx; i++) { - for(j=0; j<length; j++) { + for(j=0; j<desc->nb_taps; j++) { free(H_t[i][j]); } @@ -131,14 +131,29 @@ void multipath_tv_channel(channel_desc_t *desc, void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length){ int i,j,p,l,k; - double *alpha,*phi_rad,pi=acos(-1),*w_Hz; + double *alpha,***phi_rad,pi=acos(-1),***w_Hz; alpha = (double *)calloc(desc->nb_paths,sizeof(double)); - phi_rad = (double *)calloc(desc->nb_paths,sizeof(double)); - w_Hz = (double *)calloc(desc->nb_paths,sizeof(double)); + phi_rad = (double ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **)); + w_Hz = (double ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **)); - for(i=0; i<desc->nb_paths; i++) { - w_Hz[i]=desc->max_Doppler*cos(frand_a_b(0,2*pi)); - phi_rad[i]=frand_a_b(0,2*pi); + for(i=0; i<desc->nb_tx*desc->nb_rx; i++) { + phi_rad[i] = (double **) malloc(desc->nb_taps*sizeof(double *)); + w_Hz[i] = (double **) malloc(desc->nb_taps*sizeof(double *)); + for(j=0; j<desc->nb_taps; j++) { + phi_rad[i][j] = (double *) malloc(desc->nb_paths*sizeof(double)); + w_Hz[i][j] = (double *) malloc(desc->nb_paths*sizeof(double)); + } + } + + for(i=0; i<desc->nb_tx*desc->nb_rx; i++) { + for (j = 0; j<desc->nb_taps; j++) { + for(k=0; k<desc->nb_paths; k++) { + w_Hz[i][j][k] = desc->max_Doppler*cos(frand_a_b(0,2*M_PI)); + phi_rad[i][j][k] = frand_a_b(0,2*M_PI); + //printf("w_hz[%d][%d][%d]=f_d*cos(theta) = %f\n",i,j,k,w_Hz[i][j][k]); + //printf("phi_rad[%d][%d][%d] = %f\n",i,j,k,phi_rad[i][j][k]); + } + } } if(desc->ricean_factor == 1) { @@ -153,44 +168,34 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length){ } } - /* - // This is the code when we only consider a SISO case - for(i=0;i<length;i++) - { - for(j=0;j<desc->nb_taps;j++) - { - for(p=0;p<desc->nb_paths;p++) - { - H[i][j] += sqrt(desc->amps[j]/2)*alpha[p]*cexp(-I*(2*pi*w_Hz[p]*i*(1/(desc->sampling_rate*1e6))+phi_rad[p])); - } - } - } - for(j=0;j<desc->nb_paths;j++) - { - phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi); - } - */ - - // if MIMO + // SISO or MIMO for (i=0; i<desc->nb_rx; i++) { for(j=0; j<desc->nb_tx; j++) { - for(k=0; k<length; k++) { - for(l=0; l<desc->nb_taps; l++) { - H[i+(j*desc->nb_rx)][k][l] = 0; - + for(k=0; k<desc->nb_taps; k++) { + for(l=0; l<length; l++) { for(p=0; p<desc->nb_paths; p++) { - H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[l]/2)*alpha[p]*cexp(I*(2*pi*w_Hz[p]*k*(1/(desc->sampling_rate*1e6))+phi_rad[p])); + H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[k])*alpha[p]*cexp(I*(2*pi*w_Hz[i+(j*desc->nb_rx)][k][p]*l*(1/(desc->sampling_rate*1e6))+phi_rad[i+(j*desc->nb_rx)][k][p])); } } - } - - for(j=0; j<desc->nb_paths; j++) { - phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi); + //printf("H[tx%d][rx%d][k%d] = %f+j%f \n",j,i,k,creal(H[i+(j*desc->nb_rx)][k][0]),cimag(H[i+(j*desc->nb_rx)][k][0])); } } } - + //accumlate the phase + /*for(k=0; k<desc->nb_taps; k++) { + * for(j=0; j<desc->nb_paths; j++) { + * desc->random_phase[k][j] = fmod(2*pi*w_Hz[k][j]*(length-1)*(1/(desc->sampling_rate*1e6))+phi_rad[k][j],2*pi); + * } + * }*/ free(alpha); + for(i=0; i<desc->nb_rx*desc->nb_tx; i++) { + for (j=0; j<desc->nb_taps; j++) { + free(w_Hz[i][j]); + free(phi_rad[i][j]); + } + free(w_Hz[i]); + free(phi_rad[i]); + } free(w_Hz); free(phi_rad); } @@ -203,7 +208,7 @@ void tv_conv(double complex **h, double complex *x, double complex *y, uint32_t for(i=0; i<((int)nb_samples-dd); i++) { for(j=0; j<nb_taps; j++) { if(i>j) - y[i+dd] += creal(h[i][j])*creal(x[i-j])-cimag(h[i][j])*cimag(x[i-j]) + I*(creal(h[i][j])*cimag(x[i-j])+cimag(h[i][j])*creal(x[i-j])); + y[i+dd] += creal(h[j][i])*creal(x[i-j])-cimag(h[j][i])*cimag(x[i-j]) + I*(creal(h[j][i])*cimag(x[i-j])+cimag(h[j][i])*creal(x[i-j])); } } } diff --git a/openair1/SIMULATION/TOOLS/phase_noise.c b/openair1/SIMULATION/TOOLS/phase_noise.c index 5958a0ccdd566ba032021baa9182fb394db6daf1..6cc24f23db15fa7571926a2bc685b89e3894ec04 100644 --- a/openair1/SIMULATION/TOOLS/phase_noise.c +++ b/openair1/SIMULATION/TOOLS/phase_noise.c @@ -26,6 +26,7 @@ #include "sim.h" +static uint16_t LUTSin[ResolSinCos+1]; /* linear phase noise model */ void phase_noise(double ts, int16_t * InRe, int16_t * InIm) { diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 8c063fadc093540a0bb3474adef65e241df3dbf3..4e26d9a9547226a748f9d9b39d8a7e10ce8fa5ec 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -50,7 +50,7 @@ static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt) static telnetshell_cmddef_t channelmod_cmdarray[] = { {"help","",channelmod_print_help}, {"show","<predef,current>",channelmod_show_cmd}, - {"modify","<channelid> <param> <value>",channelmod_modify_cmd}, + {"modify","<channelid> <param> <value>",channelmod_modify_cmd}, {"","",NULL}, }; @@ -61,14 +61,17 @@ static telnetshell_vardef_t channelmod_vardef[] = { static double snr_dB=25; static double sinr_dB=0; static unsigned int max_chan; -static channel_desc_t** defined_channels; +static channel_desc_t **defined_channels; +static char modellist_name[MAX_OPTNAME_SIZE]= {0}; + + void fill_channel_desc(channel_desc_t *chan_desc, uint8_t nb_tx, uint8_t nb_rx, uint8_t nb_taps, uint8_t channel_length, double *amps, - double *delays, + double *delays, struct complex **R_sqrt, double Td, double sampling_rate, @@ -136,8 +139,10 @@ void fill_channel_desc(channel_desc_t *chan_desc, if (R_sqrt == NULL) { chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_NTAPS ; + for (i = 0; i<nb_taps; i++) { - chan_desc->R_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); + chan_desc->R_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); + for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].y = 0.0; @@ -145,7 +150,7 @@ void fill_channel_desc(channel_desc_t *chan_desc, } } else { chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *)); - + for (i = 0; i<nb_taps; i++) { //chan_desc->R_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); //chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0]; @@ -175,224 +180,229 @@ void fill_channel_desc(channel_desc_t *chan_desc, double mbsfn_delays[] = {0,.03,.15,.31,.37,1.09,12.490,12.52,12.64,12.80,12.86,13.58,27.49,27.52,27.64,27.80,27.86,28.58}; double mbsfn_amps_dB[] = {0,-1.5,-1.4,-3.6,-0.6,-7.0,-10,-11.5,-11.4,-13.6,-10.6,-17.0,-20,-21.5,-21.4,-23.6,-20.6,-27}; -double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250}; +double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250}; double scm_c_amps_dB[] = {0.00, -2.22, -3.98, -1.86, -4.08, -5.84, -1.08, -3.30, -5.06, -9.08, -11.30, -13.06, -15.14, -17.36, -19.12, -20.64, -22.85, -24.62}; double tdl_a_delays[] = {0.0000, - 0.3819, - 0.4025, - 0.5868, - 0.4610, - 0.5375, - 0.6708, - 0.5750, - 0.7618, - 1.5375, - 1.8978, - 2.2242, - 2.1718, - 2.4942, - 2.5119, - 3.0582, - 4.0810, - 4.4579, - 4.5695, - 4.7966, - 5.0066, - 5.3043, - 9.6586}; + 0.3819, + 0.4025, + 0.5868, + 0.4610, + 0.5375, + 0.6708, + 0.5750, + 0.7618, + 1.5375, + 1.8978, + 2.2242, + 2.1718, + 2.4942, + 2.5119, + 3.0582, + 4.0810, + 4.4579, + 4.5695, + 4.7966, + 5.0066, + 5.3043, + 9.6586 + }; double tdl_a_amps_dB[] = {-13.4, - 0, - -2.2, - -4, - -6, - -8.2, - -9.9, - -10.5, - -7.5, - -15.9, - -6.6, - -16.7, - -12.4, - -15.2, - -10.8, - -11.3, - -12.7, - -16.2, - -18.3, - -18.9, - -16.6, - -19.9, - -29.7}; -#define TDL_A_PATHS 23 + 0, + -2.2, + -4, + -6, + -8.2, + -9.9, + -10.5, + -7.5, + -15.9, + -6.6, + -16.7, + -12.4, + -15.2, + -10.8, + -11.3, + -12.7, + -16.2, + -18.3, + -18.9, + -16.6, + -19.9, + -29.7 + }; double tdl_b_delays[] = {0.0000, - 0.1072, - 0.2155, - 0.2095, - 0.2870, - 0.2986, - 0.3752, - 0.5055, - 0.3681, - 0.3697, - 0.5700, - 0.5283, - 1.1021, - 1.2756, - 1.5474, - 1.7842, - 2.0169, - 2.8294, - 3.0219, - 3.6187, - 4.1067, - 4.2790, - 4.7834}; + 0.1072, + 0.2155, + 0.2095, + 0.2870, + 0.2986, + 0.3752, + 0.5055, + 0.3681, + 0.3697, + 0.5700, + 0.5283, + 1.1021, + 1.2756, + 1.5474, + 1.7842, + 2.0169, + 2.8294, + 3.0219, + 3.6187, + 4.1067, + 4.2790, + 4.7834 + }; double tdl_b_amps_dB[] = {0, - -2.2, - -4, - -3.2, - -9.8, - -1.2, - -3.4, - -5.2, - -7.6, - -3, - -8.9, - -9, - -4.8, - -5.7, - -7.5, - -1.9, - -7.6, - -12.2, - -9.8, - -11.4, - -14.9, - -9.2, - -11.3}; -#define TDL_B_PATHS 23 + -2.2, + -4, + -3.2, + -9.8, + -1.2, + -3.4, + -5.2, + -7.6, + -3, + -8.9, + -9, + -4.8, + -5.7, + -7.5, + -1.9, + -7.6, + -12.2, + -9.8, + -11.4, + -14.9, + -9.2, + -11.3 + }; double tdl_c_delays[] = {0, - 0.2099, - 0.2219, - 0.2329, - 0.2176, - 0.6366, - 0.6448, - 0.6560, - 0.6584, - 0.7935, - 0.8213, - 0.9336, - 1.2285, - 1.3083, - 2.1704, - 2.7105, - 4.2589, - 4.6003, - 5.4902, - 5.6077, - 6.3065, - 6.6374, - 7.0427, - 8.6523}; + 0.2099, + 0.2219, + 0.2329, + 0.2176, + 0.6366, + 0.6448, + 0.6560, + 0.6584, + 0.7935, + 0.8213, + 0.9336, + 1.2285, + 1.3083, + 2.1704, + 2.7105, + 4.2589, + 4.6003, + 5.4902, + 5.6077, + 6.3065, + 6.6374, + 7.0427, + 8.6523 + }; double tdl_c_amps_dB[] = {-4.4, - -1.2, - -3.5, - -5.2, - -2.5, - 0, - -2.2, - -3.9, - -7.4, - -7.1, - -10.7, - -11.1, - -5.1, - -6.8, - -8.7, - -13.2, - -13.9, - -13.9, - -15.8, - -17.1, - -16, - -15.7, - -21.6, - -22.8}; -#define TDL_C_PATHS 24 + -1.2, + -3.5, + -5.2, + -2.5, + 0, + -2.2, + -3.9, + -7.4, + -7.1, + -10.7, + -11.1, + -5.1, + -6.8, + -8.7, + -13.2, + -13.9, + -13.9, + -15.8, + -17.1, + -16, + -15.7, + -21.6, + -22.8 + }; double tdl_d_delays[] = {//0, - 0, - 0.035, - 0.612, - 1.363, - 1.405, - 1.804, - 2.596, - 1.775, - 4.042, - 7.937, - 9.424, - 9.708, - 12.525}; + 0, + 0.035, + 0.612, + 1.363, + 1.405, + 1.804, + 2.596, + 1.775, + 4.042, + 7.937, + 9.424, + 9.708, + 12.525 +}; double tdl_d_amps_dB[] = {//-0.2, -//-13.5, - -.00147, - -18.8, - -21, - -22.8, - -17.9, - -20.1, - -21.9, - -22.9, - -27.8, - -23.6, - -24.8, - -30.0, - -27.7}; - -#define TDL_D_PATHS 13 + //-13.5, + -.00147, + -18.8, + -21, + -22.8, + -17.9, + -20.1, + -21.9, + -22.9, + -27.8, + -23.6, + -24.8, + -30.0, + -27.7 + }; + #define TDL_D_RICEAN_FACTOR .046774 double tdl_e_delays[] = {0, - 0.5133, - 0.5440, - 0.5630, - 0.5440, - 0.7112, - 1.9092, - 1.9293, - 1.9589, - 2.6426, - 3.7136, - 5.4524, - 12.0034, - 20.6519}; + 0.5133, + 0.5440, + 0.5630, + 0.5440, + 0.7112, + 1.9092, + 1.9293, + 1.9589, + 2.6426, + 3.7136, + 5.4524, + 12.0034, + 20.6519 + }; double tdl_e_amps_dB[] = {//-0.03, - //-22.03, - -.00433, - -15.8, - -18.1, - -19.8, - -22.9, - -22.4, - -18.6, - -20.8, - -22.6, - -22.3, - -25.6, - -20.2, - -29.8, - -29.2}; - -#define TDL_E_PATHS 14 + //-22.03, + -.00433, + -15.8, + -18.1, + -19.8, + -22.9, + -22.4, + -18.6, + -20.8, + -22.6, + -22.3, + -25.6, + -20.2, + -29.8, + -29.2 + }; + #define TDL_E_RICEAN_FACTOR 0.0063096 double epa_delays[] = { 0,.03,.07,.09,.11,.19,.41}; @@ -494,31 +504,101 @@ struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap}; //Rayleigh1_orth_eff_ch_TM4 +void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS_TDL, channel_desc_t *chan_desc ) { + int nb_rx=chan_desc-> nb_rx; + int nb_tx=chan_desc-> nb_tx; + int tdl_pathsby3 = tdl_paths/3; + + if ((tdl_paths%3)>0) + tdl_pathsby3++; + + chan_desc->nb_taps = tdl_paths; + chan_desc->Td = tdl_delays[tdl_paths-1]*DS_TDL; + printf("last path (%d) at %f * %e = %e\n",tdl_paths-1,tdl_delays[tdl_paths-1],DS_TDL,chan_desc->Td); + chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + + 1 + + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); + printf("TDL : %f Ms/s, nb_taps %d, Td %e, channel_length %d\n",chan_desc->sampling_rate,tdl_paths,chan_desc->Td,chan_desc->channel_length); + double sum_amps = 0; + chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); + + for (int i = 0; i<chan_desc->nb_taps; i++) { + chan_desc->amps[i] = pow(10,.1*tdl_amps_dB[i]); + sum_amps += chan_desc->amps[i]; + } + + for (int i = 0; i<chan_desc->nb_taps; i++) { + chan_desc->amps[i] /= sum_amps; + tdl_delays[i] *= DS_TDL; + } + + chan_desc->delays = tdl_delays; + chan_desc->aoa = 0; + chan_desc->random_aoa = 0; + chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); + chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); + chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *)); + + for (int i = 0; i<nb_tx*nb_rx; i++) + chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); + + for (int i = 0; i<nb_tx*nb_rx; i++) + chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); + + for (int i = 0; i<chan_desc->nb_taps; i++) + chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex)); + + chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); + + if (nb_tx==2 && nb_rx==2) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0]; + } else if (nb_tx==2 && nb_rx==1) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0]; + } else if (nb_tx==1 && nb_rx==2) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; + } else { + for (int i = 0; i<(tdl_pathsby3); i++) { + chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); + + for (int j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { + chan_desc->R_sqrt[i][j].x = 1.0; + chan_desc->R_sqrt[i][j].y = 0.0; + } + + LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); + } + } +} + channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, double sampling_rate, double channel_bandwidth, - double DS_TDL, + double DS_TDL, double forgetting_factor, int32_t channel_offset, - double path_loss_dB) { + double path_loss_dB, + float noise_power_dB) { channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); - for(int i=0; i<max_chan;i++) { - if (defined_channels[i] == NULL) { - defined_channels[i]=chan_desc; - chan_desc->chan_idx=i; - break; - } - else { - AssertFatal(i<(max_chan-1), - "No more channel descriptors available, increase channelmod.max_chan parameter above %u\n",max_chan); - } + + for(int i=0; i<max_chan; i++) { + if (defined_channels[i] == NULL) { + defined_channels[i]=chan_desc; + chan_desc->chan_idx=i; + break; + } else { + AssertFatal(i<(max_chan-1), + "No more channel descriptors available, increase channelmod.max_chan parameter above %u\n",max_chan); + } } + uint16_t i,j; double sum_amps; double aoa,ricean_factor,Td,maxDoppler; - int channel_length,nb_taps; chan_desc->modelid = channel_model; chan_desc->nb_tx = nb_tx; @@ -530,13 +610,13 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->path_loss_dB = path_loss_dB; chan_desc->first_run = 1; chan_desc->ip = 0.0; + chan_desc->noise_power_dB = noise_power_dB; LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model); - int tdl_paths=0; - double tdl_ricean_factor = 1; double *tdl_amps_dB; double *tdl_delays; + /* Spatial Channel Models (SCM) channel model from TR 38.901 Section 7.7.2 */ switch (channel_model) { case SCM_A: LOG_W(OCM,"channel model not yet supported\n"); @@ -554,7 +634,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -592,10 +673,11 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; i<6; i++) chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; } else { - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); - + for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].y = 0.0; @@ -615,6 +697,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -652,7 +735,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; i<6; i++) chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; } else { - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -666,99 +750,41 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } break; - - case TDL_A: - case TDL_B: - case TDL_C: - case TDL_D: - case TDL_E: - if (channel_model == TDL_A) { - tdl_paths=TDL_A_PATHS; - tdl_delays=tdl_a_delays; - tdl_amps_dB=tdl_a_amps_dB; - }else if (channel_model == TDL_B) { - tdl_paths=TDL_B_PATHS; - tdl_delays=tdl_b_delays; - tdl_amps_dB=tdl_b_amps_dB; - } - else if (channel_model == TDL_C) { - tdl_paths=TDL_C_PATHS; - tdl_delays=tdl_c_delays; - tdl_amps_dB=tdl_c_amps_dB; - printf("Initializing TDL_C channel with %d paths\n",TDL_C_PATHS); - } else if (channel_model == TDL_D) { - tdl_paths=TDL_D_PATHS; - tdl_delays=tdl_d_delays; - tdl_amps_dB=tdl_d_amps_dB; - tdl_ricean_factor = TDL_D_RICEAN_FACTOR; - } else if (channel_model == TDL_E) { - tdl_paths=TDL_E_PATHS-1; - tdl_delays=tdl_e_delays+1; - tdl_amps_dB=tdl_e_amps_dB; - tdl_ricean_factor = TDL_E_RICEAN_FACTOR; - } - - int tdl_pathsby3 = tdl_paths/3; - if ((tdl_paths%3)>0) tdl_pathsby3++; - - chan_desc->nb_taps = tdl_paths; - chan_desc->Td = tdl_delays[tdl_paths-1]*DS_TDL; - printf("last path (%d) at %f * %e = %e\n",tdl_paths-1,tdl_delays[tdl_paths-1],DS_TDL,chan_desc->Td); - chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); - printf("TDL : %f Ms/s, nb_taps %d, Td %e, channel_length %d\n",chan_desc->sampling_rate,tdl_paths,chan_desc->Td,chan_desc->channel_length); - sum_amps = 0; - chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - - for (i = 0; i<chan_desc->nb_taps; i++) { - chan_desc->amps[i] = pow(10,.1*tdl_amps_dB[i]); - sum_amps += chan_desc->amps[i]; - } - - for (i = 0; i<chan_desc->nb_taps; i++) { - chan_desc->amps[i] /= sum_amps; - tdl_delays[i] *= DS_TDL; - } - chan_desc->delays = tdl_delays; - chan_desc->ricean_factor = tdl_ricean_factor; - chan_desc->aoa = 0; - chan_desc->random_aoa = 0; - chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); - chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); - chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *)); - - for (i = 0; i<nb_tx*nb_rx; i++) - chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); + /* tapped delay line (TDL) channel model from TR 38.901 Section 7.7.2 */ +#define tdl_m(MoDel)\ + DevAssert(sizeof(tdl_ ## MoDel ## _amps_dB) == sizeof(tdl_ ## MoDel ## _delays)); \ + tdl_paths=sizeof(tdl_ ## MoDel ## _amps_dB)/sizeof(*tdl_ ## MoDel ## _amps_dB);\ + tdl_delays=tdl_ ## MoDel ## _delays;\ + tdl_amps_dB=tdl_ ## MoDel ## _amps_dB - for (i = 0; i<nb_tx*nb_rx; i++) - chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); - - for (i = 0; i<chan_desc->nb_taps; i++) - chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex)); - - chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); + case TDL_A: + chan_desc->ricean_factor = 1; + tdl_m(a); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; - if (nb_tx==2 && nb_rx==2) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0]; - } else if (nb_tx==2 && nb_rx==1) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0]; - } else if (nb_tx==1 && nb_rx==2) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; - } else { - for (i = 0; i<(tdl_pathsby3); i++) { - chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); + case TDL_B: + chan_desc->ricean_factor = 1; + tdl_m(b); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; - for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { - chan_desc->R_sqrt[i][j].x = 1.0; - chan_desc->R_sqrt[i][j].y = 0.0; - } + case TDL_C: + chan_desc->ricean_factor = 1; + tdl_m(c); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; - LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); - } - } + case TDL_D: + chan_desc->ricean_factor = TDL_D_RICEAN_FACTOR; + tdl_m(d); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; + case TDL_E: + chan_desc->ricean_factor = TDL_E_RICEAN_FACTOR; + tdl_m(e); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); break; case EPA: @@ -768,6 +794,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -786,7 +813,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; i<nb_tx*nb_rx; i++) chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); - + for (i = 0; i<nb_tx*nb_rx; i++) chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); @@ -801,6 +828,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -822,6 +850,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -867,7 +896,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); } }*/ - break; + break; case EPA_high: chan_desc->nb_taps = 7; @@ -876,6 +905,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -929,7 +959,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -984,6 +1015,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*eva_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1017,7 +1049,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; - for (i = 0; i<6; i++) { + + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { @@ -1038,6 +1071,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*etu_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1071,6 +1105,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -1092,6 +1127,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; i<chan_desc->nb_taps; i++) { chan_desc->amps[i] = pow(10,.1*mbsfn_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1119,6 +1155,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex *)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -1185,11 +1222,11 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, 1); break; - case Rayleigh1: + case Rayleigh1://MIMO Test uses Rayleigh1 nb_taps = 1; Td = 0; channel_length = 1; - ricean_factor = 1; + ricean_factor = 0.0; aoa = .03; maxDoppler = 0; fill_channel_desc(chan_desc,nb_tx, @@ -1628,38 +1665,65 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->nb_paths = 10; return(chan_desc); -} - +} /* channel_desc_t *new_channel_desc_scm */ + +channel_desc_t *find_channel_desc_fromname( char *modelname ) { + for(int i=0; i<max_chan; i++) { + if (defined_channels[i] != NULL) { + if (strcmp(defined_channels[i]->model_name,modelname) == 0) + return defined_channels[i]; + } + } + + LOG_E(OCM,"Model %s not found \n", modelname); + return NULL; +} /* channel_desc_t * new_channel_desc_fromconfig */ + + + void free_channel_desc_scm(channel_desc_t *ch) { // Must be made cleanly, a lot of leaks... - defined_channels[ch->chan_idx]=NULL; + if (max_chan != 0) defined_channels[ch->chan_idx]=NULL; if(ch->free_flags&CHANMODEL_FREE_AMPS) free(ch->amps); - for (int i = 0; i<ch->nb_tx*ch->nb_rx; i++) { + + for (int i = 0; i<ch->nb_tx*ch->nb_rx; i++) { free(ch->ch[i]); free(ch->chF[i]); } - + for (int i = 0; i<ch->nb_taps; i++) { - free(ch->a[i]); - } + free(ch->a[i]); + } + if(ch->free_flags&CHANMODEL_FREE_DELAY) - free(ch->delays); + free(ch->delays); + if(ch->free_flags&CHANMODEL_FREE_RSQRT_6) - for (int i = 0; i<6; i++) - free(ch->R_sqrt[i]); + for (int i = 0; i<6; i++) + free(ch->R_sqrt[i]); + if(ch->free_flags&CHANMODEL_FREE_RSQRT_NTAPS) - for (int i = 0; i<ch->nb_taps;i++) - free(ch->R_sqrt[i]); - free(ch->R_sqrt); - free(ch->ch); + for (int i = 0; i<ch->nb_taps; i++) + free(ch->R_sqrt[i]); + + free(ch->R_sqrt); + free(ch->ch); free(ch->chF); - free(ch->a); - free(ch); + free(ch->a); + free(ch->model_name); + free(ch); } void set_channeldesc_owner(channel_desc_t *cdesc, uint32_t module_id) { - cdesc->module_id=module_id; + cdesc->module_id=module_id; +} + +void set_channeldesc_name(channel_desc_t *cdesc,char *modelname) { + if(cdesc->model_name != NULL) + free(cdesc->model_name); + + cdesc->model_name=strdup(modelname); } int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { @@ -1780,14 +1844,14 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { desc->ch[aarx+(aatx*desc->nb_rx)][k].x += s*desc->a[l][aarx+(aatx*desc->nb_rx)].x; desc->ch[aarx+(aatx*desc->nb_rx)][k].y += s*desc->a[l][aarx+(aatx*desc->nb_rx)].y; - // printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]); + // printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]); } //nb_taps #ifdef DEBUG_CH printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y); #endif } //channel_length - } + } } //aatx } //aarx @@ -1799,7 +1863,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { return (0); } - + double N_RB2sampling_rate(uint16_t N_RB) { double sampling_rate; @@ -1848,128 +1912,144 @@ double N_RB2channel_bandwidth(uint16_t N_RB) { break; default: - LOG_E(PHY,"Unknown N_PRB\n"); + LOG_E(OCM,"Unknown N_PRB\n"); return(-1); } + return(channel_bandwidth); -} +} + - static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt ) { - prnt("channelmod commands can be used to display or modify channel models parameters\n"); - prnt("channelmod show predef: display predefined model algorithms available in oai\n"); - prnt("channelmod show current: display the currently used models in the running executable\n"); - prnt("channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value\n"); - prnt(" <model index> specifies the model, the show current model command can be used to list the current models indexes\n"); - prnt(" <param name> can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"offset\", \"forgetf\"\n"); - return CMDSTATUS_FOUND; + prnt("channelmod commands can be used to display or modify channel models parameters\n"); + prnt("channelmod show predef: display predefined model algorithms available in oai\n"); + prnt("channelmod show current: display the currently used models in the running executable\n"); + prnt("channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value\n"); + prnt(" <model index> specifies the model, the show current model command can be used to list the current models indexes\n"); + prnt(" <param name> can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"noise_power_dB\", \"offset\", \"forgetf\"\n"); + return CMDSTATUS_FOUND; } static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_t prnt) { - char *module_id_str[]=MODULEID_STR_INIT; - if (cd->module_id != 0) { - prnt("model owner: %s\n",module_id_str[cd->module_id]); - } - prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); - prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", - cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); - prnt("max Doppler: %lf path loss: %lf rchannel offset: %i forget factor; %lf\n", - cd->max_Doppler, cd->path_loss_dB, cd->channel_offset, cd->forgetting_factor); - prnt("Initial phase: %lf nb_path: %i \n", - cd->ip, cd->nb_paths); - for (int i=0; i<cd->nb_taps ; i++) { - prnt("taps: %i lin. ampli. : %lf delay: %lf \n",i,cd->amps[i], cd->delays[i]); - } + char *module_id_str[]=MODULEID_STR_INIT; + prnt("model owner: %s\n",(cd->module_id != 0)?module_id_str[cd->module_id]:"not set"); + prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); + prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", + cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); + prnt("max Doppler: %lf path loss: %lf noise: %lf rchannel offset: %i forget factor; %lf\n", + cd->max_Doppler, cd->path_loss_dB, cd->noise_power_dB, cd->channel_offset, cd->forgetting_factor); + prnt("Initial phase: %lf nb_path: %i \n", + cd->ip, cd->nb_paths); + + for (int i=0; i<cd->nb_taps ; i++) { + prnt("taps: %i lin. ampli. : %lf delay: %lf \n",i,cd->amps[i], cd->delays[i]); + } } - - + + static int channelmod_show_cmd(char *buff, int debug, telnet_printfunc_t prnt) { - char *subcmd=NULL; + char *subcmd=NULL; int s = sscanf(buff,"%ms\n",&subcmd); if (s>0) { if ( strcmp(subcmd,"predef") == 0) { for (int i=0; channelmod_names[i].name != NULL ; i++) { prnt(" %i %s\n", i, map_int_to_str(channelmod_names,i )); - } + } } else if ( strcmp(subcmd,"current") == 0) { for (int i=0; i < max_chan ; i++) { - if (defined_channels[i] != NULL) { - prnt("model %i %s: \n----------------\n", i, map_int_to_str(channelmod_names,defined_channels[i]->modelid)); - display_channelmodel(defined_channels[i],debug,prnt); + if (defined_channels[i] != NULL) { + prnt("model %i %s type %s: \n----------------\n", i, (defined_channels[i]->model_name !=NULL)?defined_channels[i]->model_name:"(no name set)", + map_int_to_str(channelmod_names,defined_channels[i]->modelid)); + display_channelmodel(defined_channels[i],debug,prnt); } } } else { - channelmod_print_help(buff, debug, prnt); + channelmod_print_help(buff, debug, prnt); } - free(subcmd); + + free(subcmd); } + return CMDSTATUS_FOUND; } - + static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt) { - char *param=NULL, *value=NULL; + char *param=NULL, *value=NULL; int cd_id= -1; int s = sscanf(buff,"%i %ms %ms \n",&cd_id,¶m, &value); + if (cd_id<0 || cd_id >= max_chan) { - prnt("ERROR, %i: Channel model id outof range (0-%i)\n",cd_id,max_chan-1); - return CMDSTATUS_FOUND; + prnt("ERROR, %i: Channel model id outof range (0-%i)\n",cd_id,max_chan-1); + return CMDSTATUS_FOUND; } + if (defined_channels[cd_id]==NULL) { - prnt("ERROR, %i: Channel model has not been set\n",cd_id); - return CMDSTATUS_FOUND; - } - + prnt("ERROR, %i: Channel model has not been set\n",cd_id); + return CMDSTATUS_FOUND; + } + if (s==3) { if ( strcmp(param,"riceanf") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl > 1) - prnt("ERROR: ricean factor range: 0 to 1, %lf is outof range\n",dbl); - else - defined_channels[cd_id]->ricean_factor=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl > 1) + prnt("ERROR: ricean factor range: 0 to 1, %lf is outof range\n",dbl); + else + defined_channels[cd_id]->ricean_factor=dbl; } else if ( strcmp(param,"aoa") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl >6.28) - prnt("ERROR: angle of arrival range: 0 to 2*Pi, %lf is outof range\n",dbl); - else - defined_channels[cd_id]->aoa=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl >6.28) + prnt("ERROR: angle of arrival range: 0 to 2*Pi, %lf is outof range\n",dbl); + else + defined_channels[cd_id]->aoa=dbl; } else if ( strcmp(param,"randaoa") == 0) { - int i = atoi(value); - if (i!=0 && i!=1) - prnt("ERROR: randaoa is a boolean, must be 0 or 1\n"); - else - defined_channels[cd_id]->random_aoa=i; + int i = atoi(value); + + if (i!=0 && i!=1) + prnt("ERROR: randaoa is a boolean, must be 0 or 1\n"); + else + defined_channels[cd_id]->random_aoa=i; } else if ( strcmp(param,"ploss") == 0) { - double dbl = atof(value); - defined_channels[cd_id]->path_loss_dB=dbl; + double dbl = atof(value); + defined_channels[cd_id]->path_loss_dB=dbl; + } else if ( strcmp(param,"noise_power_dB") == 0) { + double dbl = atof(value); + defined_channels[cd_id]->noise_power_dB=dbl; } else if ( strcmp(param,"offset") == 0) { - int i = atoi(value); - defined_channels[cd_id]->channel_offset=i; + int i = atoi(value); + defined_channels[cd_id]->channel_offset=i; } else if ( strcmp(param,"forgetf") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl > 1) - prnt("ERROR: forgetting factor range: 0 to 1 (disable variation), %lf is outof range\n",dbl); - else - defined_channels[cd_id]->forgetting_factor=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl > 1) + prnt("ERROR: forgetting factor range: 0 to 1 (disable variation), %lf is outof range\n",dbl); + else + defined_channels[cd_id]->forgetting_factor=dbl; } else { - prnt("ERROR: %s, unknown channel parameter\n",param); - return CMDSTATUS_FOUND; + prnt("ERROR: %s, unknown channel parameter\n",param); + return CMDSTATUS_FOUND; } - display_channelmodel(defined_channels[cd_id],debug,prnt); - free(param); - free(value); - random_channel(defined_channels[cd_id],false); + + display_channelmodel(defined_channels[cd_id],debug,prnt); + free(param); + free(value); + random_channel(defined_channels[cd_id],false); } - return CMDSTATUS_FOUND; + + return CMDSTATUS_FOUND; } - -int modelid_fromname(char *modelname) { - int modelid=map_str_to_int(channelmod_names,modelname); - if (modelid < 0) - LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modelname); + +int modelid_fromstrtype(char *modeltype) { + int modelid=map_str_to_int(channelmod_names,modeltype); + + if (modelid < 0) + LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modeltype); + return modelid; } @@ -1983,18 +2063,61 @@ double channelmod_get_sinr_dB(void) { void init_channelmod(void) { paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC; - int ret = config_get( channelmod_params,sizeof(channelmod_params)/sizeof(paramdef_t),CHANNELMOD_SECTION); + int numparams=sizeof(channelmod_params)/sizeof(paramdef_t); + int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION); AssertFatal(ret >= 0, "configuration couldn't be performed"); - defined_channels=calloc(max_chan,sizeof( channel_desc_t*)); + defined_channels=calloc(max_chan,sizeof( channel_desc_t *)); AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan); - /* look for telnet server, if it is loaded, add the channel modeling commands to it */ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); if (addcmd != NULL) { addcmd("channelmod",channelmod_vardef,channelmod_cmdarray); } -} +} /* init_channelmod */ + + +int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) { + paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC; + paramlist_def_t channel_list; + memset(&channel_list,0,sizeof(paramlist_def_t)); + memcpy(channel_list.listname,modellist_name,sizeof(channel_list.listname)-1); + int numparams = sizeof(achannel_params)/sizeof(paramdef_t); + config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION); + AssertFatal(channel_list.numelt>0, "List %s.%s not found in config file\n",CHANNELMOD_SECTION,channel_list.listname); + int pindex_NAME = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NAME_PNAME); + int pindex_DT = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_DT_PNAME ); + int pindex_FF = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_FF_PNAME ); + int pindex_CO = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_CO_PNAME ); + int pindex_PL = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_PL_PNAME ); + int pindex_NP = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NP_PNAME ); + int pindex_TYPE = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_TYPE_PNAME); + + for (int i=0; i<channel_list.numelt; i++) { + int modid = modelid_fromstrtype( *(channel_list.paramarray[i][pindex_TYPE].strptr) ); + + if (modid <0) { + LOG_E(OCM,"Valid channel model types:\n"); + + for (int m=0; channelmod_names[i].name != NULL ; m++) { + printf(" %s ", map_int_to_str(channelmod_names,m )); + } + + AssertFatal(0, "\n Choose a valid model type\n"); + } + + channel_desc_t *channeldesc_p = new_channel_desc_scm(nb_tx,nb_rx,modid,sampling_rate,channel_bandwidth, + *(channel_list.paramarray[i][pindex_DT].dblptr), *(channel_list.paramarray[i][pindex_FF].dblptr), + *(channel_list.paramarray[i][pindex_CO].iptr), *(channel_list.paramarray[i][pindex_PL].dblptr), + *(channel_list.paramarray[i][pindex_NP].dblptr) ); + AssertFatal( (channeldesc_p!= NULL), "Could not allocate channel %s type %s \n",*(channel_list.paramarray[i][pindex_NAME].strptr), *(channel_list.paramarray[i][pindex_TYPE].strptr)); + channeldesc_p->model_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr)); + LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr), + *(channel_list.paramarray[i][pindex_TYPE].strptr), modellist_name); + } /* for loop on channel_list */ + + return channel_list.numelt; +} /* load_channelist */ #ifdef RANDOM_CHANNEL_MAIN #define sampling_rate 5.0 diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 55a78e977866ec9ed63a1a73c4e47c4c597352f6..7696f9202f8a0cd0c4ad7f444a7223a45b7cf5ee 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -89,6 +89,7 @@ typedef struct { double path_loss_dB; ///additional delay of channel in samples. int32_t channel_offset; + float noise_power_dB; ///This parameter (0...1) allows for simple 1st order temporal variation. 0 means a new channel every call, 1 means keep channel constant all the time double forgetting_factor; ///needs to be set to 1 for the first call, 0 otherwise. @@ -106,8 +107,10 @@ typedef struct { unsigned int chan_idx; /// id of the channel modeling algorithm int modelid; - /// identifies channel descriptor owner (the module which created this descriptor) + /// identifies channel descriptor owner (the module which created this descriptor channelmod_moduleid_t module_id; + /// name of this descriptor,used for model created from config file at init time + char *model_name; /// flags to properly trigger memory free unsigned int free_flags; } channel_desc_t; @@ -241,12 +244,37 @@ typedef enum { #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CHANNELMOD_SECTION "channelmod" + +/* global channel modelization parameters */ +#define CHANNELMOD_MODELLIST_PARANAME "modellist" + +#define CHANNELMOD_HELP_MODELLIST "<list name> channel list name in config file describing the model type and its parameters\n" #define CHANNELMOD_PARAMS_DESC { \ - {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ - {"sinr_dB", NULL, 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ - {"max_chan, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ + {"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ + {"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 60 },\ } +/* parameters for one model */ +#define CHANNELMOD_MODEL_NAME_PNAME "model_name" +#define CHANNELMOD_MODEL_TYPE_PNAME "type" +#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB" +#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB" +#define CHANNELMOD_MODEL_FF_PNAME "forgetfact" +#define CHANNELMOD_MODEL_CO_PNAME "offset" +#define CHANNELMOD_MODEL_DT_PNAME "ds_tdl" + +#define CHANNELMOD_MODEL_PARAMS_DESC { \ + {CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:-50, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\ + {CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\ +} + #include "platform_constants.h" typedef struct { @@ -275,12 +303,17 @@ typedef struct { channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, - double sampling_rate, + double sampling_rate, double channel_bandwidth, - double TDL_DS, + double TDL_DS, double forgetting_factor, int32_t channel_offset, - double path_loss_dB); + double path_loss_dB, + float noise_power_dB); + +channel_desc_t *find_channel_desc_fromname( char *modelname ); + + /** \brief free memory allocated for a model descriptor \param ch points to the model, which cannot be used after calling this fuction @@ -293,6 +326,12 @@ void free_channel_desc_scm(channel_desc_t *ch); \param module_id identifies the channel model. should be define as a macro in simu.h */ void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_id); +/** +\brief This function set a model name to a model descriptor, can be later used to identify a allocated channel model +\param cdesc points to the model descriptor +\param module_name is the C string to use as model name for the channel pointed by cdesc +*/ +void set_channeldesc_name(channel_desc_t *cdesc,char *modelname); /** \fn void random_channel(channel_desc_t *desc) \brief This routine generates a random channel response (time domain) according to a tapped delay line model. \param desc Pointer to the channel descriptor @@ -452,11 +491,11 @@ void multipath_tv_channel(channel_desc_t *desc, /**@} */ /**@} */ -int modelid_fromname(char *modelname); +int modelid_fromstrtype(char *modeltype); double channelmod_get_snr_dB(void); double channelmod_get_sinr_dB(void); void init_channelmod(void) ; - +int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ; double N_RB2sampling_rate(uint16_t N_RB); double N_RB2channel_bandwidth(uint16_t N_RB); @@ -468,7 +507,6 @@ double N_RB2channel_bandwidth(uint16_t N_RB); */ //look-up table for the sine (cosine) function #define ResolSinCos 100 -uint16_t LUTSin[ResolSinCos+1]; void InitSinLUT( void ); void phase_noise(double ts, int16_t * InRe, int16_t * InIm); diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 9e341f9bcbc87c2a19f1e28ba7d994b31153f96a..6b1c6d94954582f0347caa77711702ea3e0b4eba 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -24,10 +24,13 @@ MESSAGE_DEF(F1AP_CU_SCTP_REQ , MESSAGE_PRIORITY_MED, f1ap_cu_setup_req_t /* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/ MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) +MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_acknowledge_t , f1ap_gnb_cu_configuration_update_acknowledge) +MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_failure_t , f1ap_gnb_cu_configuration_update_failure) /* F1AP -> eNB_DU or eNB_CU_RRC -> F1AP application layer messages */ MESSAGE_DEF(F1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, f1ap_setup_resp_t , f1ap_setup_resp) MESSAGE_DEF(F1AP_SETUP_FAILURE , MESSAGE_PRIORITY_MED, f1ap_setup_failure_t , f1ap_setup_failure) +MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_t , f1ap_gnb_cu_configuration_update) /* MAC -> F1AP messages */ MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_initial_ul_rrc_message_t , f1ap_initial_ul_rrc_message) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index d83f9cb71d74c9f00ba6ef2a6d7ee32e1665103a..ecfde8d38bdb2d2f558a757a3e0a6d9f416d36c9 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -31,6 +31,9 @@ #define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req #define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp +#define F1AP_GNB_CU_CONFIGURATION_UPDATE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update +#define F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update_acknowledge +#define F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update_failure #define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure #define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message @@ -55,6 +58,8 @@ // Note this should be 512 from maxval in 38.473 #define F1AP_MAX_NB_CELLS 2 +#define F1AP_MAX_NO_OF_TNL_ASSOCIATIONS 32 +#define F1AP_MAX_NO_UE_ID 1024 typedef struct f1ap_net_ip_address_s { unsigned ipv4:1; unsigned ipv6:1; @@ -98,7 +103,7 @@ typedef struct f1ap_setup_req_s { // Served Cell Information /* Tracking area code */ - uint16_t tac[F1AP_MAX_NB_CELLS]; + uint32_t tac[F1AP_MAX_NB_CELLS]; /* Mobile Country Codes * Mobile Network Codes @@ -174,6 +179,24 @@ typedef struct f1ap_setup_req_s { } f1ap_setup_req_t; +typedef struct served_cells_to_activate_s { + /// mcc of DU cells + uint16_t mcc; + /// mnc of DU cells + uint16_t mnc; + /// mnc digit length of DU cells + uint8_t mnc_digit_length; + // NR Global Cell Id + uint64_t nr_cellid; + /// NRPCI + uint16_t nrpci; + /// num SI messages per DU cell + uint8_t num_SI; + /// SI message containers (up to 21 messages per cell) + uint8_t *SI_container[21]; + int SI_container_length[21]; +} served_cells_to_activate_t; + typedef struct f1ap_setup_resp_s { /* Connexion id used between SCTP/F1AP */ uint16_t cnx_id; @@ -189,29 +212,62 @@ typedef struct f1ap_setup_resp_s { char *gNB_CU_name; /// number of DU cells to activate uint16_t num_cells_to_activate; //0< num_cells_to_activate <= 512; - /// mcc of DU cells - uint16_t mcc[F1AP_MAX_NB_CELLS]; - /// mnc of DU cells - uint16_t mnc[F1AP_MAX_NB_CELLS]; - /// mnc digit length of DU cells - uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; - // NR Global Cell Id - uint64_t nr_cellid[F1AP_MAX_NB_CELLS]; - /// NRPCI - uint16_t nrpci[F1AP_MAX_NB_CELLS]; - /// num SI messages per DU cell - uint8_t num_SI[F1AP_MAX_NB_CELLS]; - /// SI message containers (up to 21 messages per cell) - uint8_t *SI_container[F1AP_MAX_NB_CELLS][21]; - int SI_container_length[F1AP_MAX_NB_CELLS][21]; + served_cells_to_activate_t cells_to_activate[F1AP_MAX_NB_CELLS]; } f1ap_setup_resp_t; +typedef struct f1ap_gnb_cu_configuration_update_s { + /* Connexion id used between SCTP/F1AP */ + uint16_t cnx_id; + + /* SCTP association id */ + int32_t assoc_id; + + /* Number of SCTP streams used for a mme association */ + uint16_t sctp_in_streams; + uint16_t sctp_out_streams; + + /// string holding gNB_CU_name + char *gNB_CU_name; + /// number of DU cells to activate + uint16_t num_cells_to_activate; //0< num_cells_to_activate/mod <= 512; + served_cells_to_activate_t cells_to_activate[F1AP_MAX_NB_CELLS]; +} f1ap_gnb_cu_configuration_update_t; + typedef struct f1ap_setup_failure_s { uint16_t cause; uint16_t time_to_wait; uint16_t criticality_diagnostics; } f1ap_setup_failure_t; +typedef struct f1ap_gnb_cu_configuration_update_acknowledge_s { + uint16_t num_cells_failed_to_be_activated; + uint16_t mcc[F1AP_MAX_NB_CELLS]; + uint16_t mnc[F1AP_MAX_NB_CELLS]; + uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; + uint64_t nr_cellid[F1AP_MAX_NB_CELLS]; + uint16_t cause[F1AP_MAX_NB_CELLS]; + int have_criticality; + uint16_t criticality_diagnostics; + uint16_t noofTNLAssociations_to_setup; + uint16_t have_port[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; + in_addr_t tl_address[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; // currently only IPv4 supported + uint16_t noofTNLAssociations_failed; + in_addr_t tl_address_failed[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; // currently only IPv4 supported + uint16_t cause_failed[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; + uint16_t noofDedicatedSIDeliveryNeededUEs; + uint32_t gNB_CU_ue_id[F1AP_MAX_NO_UE_ID]; + uint16_t ue_mcc[F1AP_MAX_NO_UE_ID]; + uint16_t ue_mnc[F1AP_MAX_NO_UE_ID]; + uint8_t ue_mnc_digit_length[F1AP_MAX_NO_UE_ID]; + uint64_t ue_nr_cellid[F1AP_MAX_NO_UE_ID]; +} f1ap_gnb_cu_configuration_update_acknowledge_t; + +typedef struct f1ap_gnb_cu_configuration_update_failure_s { + uint16_t cause; + uint16_t time_to_wait; + uint16_t criticality_diagnostics; +} f1ap_gnb_cu_configuration_update_failure_t; + typedef struct f1ap_dl_rrc_message_s { uint32_t gNB_CU_ue_id; diff --git a/openair2/COMMON/gtpv1_u_messages_def.h b/openair2/COMMON/gtpv1_u_messages_def.h index 86103dd91151b910a930814211c7119631b4e451..e5ce496701ad552f1431e6c3d5df622f934f1499 100644 --- a/openair2/COMMON/gtpv1_u_messages_def.h +++ b/openair2/COMMON/gtpv1_u_messages_def.h @@ -33,4 +33,5 @@ MESSAGE_DEF(GTPV1U_ENB_S1_REQ, MESSAGE_PRIORITY_MED, Gtpv1uS1Req, gtpv MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_req_t, NRGtpv1uDeleteTunnelReq) MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_resp_t, NRGtpv1uDeleteTunnelResp) -MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq) +MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq) +MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq) diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h index 8fde34300060ffc4264b40e24ca30b1098a56b83..63911d46cbad97c70d97d079fd3707b3bc45478b 100644 --- a/openair2/COMMON/gtpv1_u_messages_types.h +++ b/openair2/COMMON/gtpv1_u_messages_types.h @@ -44,6 +44,7 @@ #define GTPV1U_GNB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelReq #define GTPV1U_GNB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelResp #define GTPV1U_GNB_NG_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uNGReq +#define GTPV1U_GNB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uTunnelDataReq #define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF @@ -175,11 +176,15 @@ typedef struct gtpv1u_enb_end_marker_ind_s { typedef struct { in_addr_t enb_ip_address_for_S1u_S12_S4_up; tcp_udp_port_t enb_port_for_S1u_S12_S4_up; + char addrStr[256]; + char portStr[256]; } Gtpv1uS1Req; typedef struct { in_addr_t gnb_ip_address_for_NGu_up; tcp_udp_port_t gnb_port_for_NGu_up; + char addrStr[256]; + char portStr[256]; } Gtpv1uNGReq; typedef struct gtpv1u_gnb_create_tunnel_req_s { rnti_t rnti; @@ -210,4 +215,12 @@ typedef struct gtpv1u_gnb_delete_tunnel_resp_s { teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted } gtpv1u_gnb_delete_tunnel_resp_t; +typedef struct gtpv1u_gnb_tunnel_data_req_s { + uint8_t *buffer; + uint32_t length; + uint32_t offset; ///< start of message offset in buffer + rnti_t rnti; + pdusessionid_t pdusession_id; +} gtpv1u_gnb_tunnel_data_req_t; + #endif /* GTPV1_U_MESSAGES_TYPES_H_ */ diff --git a/openair2/COMMON/mac_messages_types.h b/openair2/COMMON/mac_messages_types.h index f42813ecb0a4f2496d385a144b594a0efac3b0cd..a9336a58a999817c90f7bbe571134d9d29f57e54 100644 --- a/openair2/COMMON/mac_messages_types.h +++ b/openair2/COMMON/mac_messages_types.h @@ -30,6 +30,7 @@ #define MAC_MESSAGES_TYPES_H_ #include <LTE_DRX-Config.h> +#include "OCTET_STRING.h" //-------------------------------------------------------------------------------------------// // Defines to access message fields. @@ -143,6 +144,7 @@ typedef struct NRRrcMacCcchDataInd_s { uint16_t rnti; uint32_t sdu_size; uint8_t sdu[CCCH_SDU_SIZE]; + OCTET_STRING_t *du_to_cu_rrc_container; uint8_t gnb_index; int CC_id; } NRRrcMacCcchDataInd; diff --git a/openair2/COMMON/pdcp_messages_def.h b/openair2/COMMON/pdcp_messages_def.h index b148ae0e1f79174b4dc2ad3ca4e8339e1fbfc43a..59d47eb81b992c660c4d9b47a3e19724edf01189 100644 --- a/openair2/COMMON/pdcp_messages_def.h +++ b/openair2/COMMON/pdcp_messages_def.h @@ -33,4 +33,5 @@ MESSAGE_DEF(RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataIn MESSAGE_DEF(RRC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcPcchDataReq, rrc_pcch_data_req) // gNB +MESSAGE_DEF(NR_RRC_DCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, NRRrcDcchDataReq, nr_rrc_dcch_data_req) MESSAGE_DEF(NR_RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcDcchDataInd, nr_rrc_dcch_data_ind) diff --git a/openair2/COMMON/pdcp_messages_types.h b/openair2/COMMON/pdcp_messages_types.h index daf8ba7cac9eb8b0175d4298da3e361db7694954..0390fd80f440dc8af4c02971991085d2ec89799a 100644 --- a/openair2/COMMON/pdcp_messages_types.h +++ b/openair2/COMMON/pdcp_messages_types.h @@ -36,6 +36,7 @@ #define RRC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_pcch_data_req // gNB +#define NR_RRC_DCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_dcch_data_req #define NR_RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_dcch_data_ind //-------------------------------------------------------------------------------------------// @@ -64,6 +65,20 @@ typedef struct RrcDcchDataInd_s { uint8_t eNB_index; // LG: needed in UE } RrcDcchDataInd; +typedef struct NRRrcDcchDataReq_s { + uint32_t frame; + uint8_t gnb_flag; + rb_id_t rb_id; + uint32_t muip; + uint32_t confirmp; + uint32_t sdu_size; + uint8_t *sdu_p; + uint8_t mode; + uint16_t rnti; + uint8_t module_id; + uint8_t gNB_index; +} NRRrcDcchDataReq; + typedef struct NRRrcDcchDataInd_s { uint32_t frame; uint8_t dcch_index; diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 3915f12bb9afeeba231a45240474f4307db97b1b..be6927ec37da1c1888928ea19aae5ce7ab2ad70c 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -90,6 +90,7 @@ #define NUMBER_OF_NR_DLSCH_MAX 2//16 #define NUMBER_OF_NR_ULSCH_MAX 2//16 #define NUMBER_OF_NR_SCH_STATS_MAX 16 +#define NUMBER_OF_NR_UCI_STATS_MAX 16 #define NUMBER_OF_NR_PUCCH_MAX 16 #define NUMBER_OF_NR_SR_MAX 16 #define NUMBER_OF_NR_PDCCH_MAX 16 diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 02f878ee2e2e9c788e156bf827e89e792bc1aca9..64c42eaf0eb8cc7bb7187ea85dcc310493229bd9 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -42,6 +42,7 @@ #include "LTE_SL-DiscResourcePool-r12.h" #include "NR_RACH-ConfigCommon.h" #include "NR_ServingCellConfigCommon.h" +#include "NR_ServingCellConfig.h" //-------------------------------------------------------------------------------------------// // Messages for RRC logging #if defined(DISABLE_ITTI_XER_PRINT) @@ -405,8 +406,10 @@ typedef struct NRRrcConfigurationReq_s { uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; NR_ServingCellConfigCommon_t *scc; + NR_ServingCellConfig_t *scd; int ssb_SubcarrierOffset; int pdsch_AntennaPorts; + int pusch_AntennaPorts; int pusch_TargetSNRx10; int pucch_TargetSNRx10; } gNB_RrcConfigurationReq; diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h index 9db5d61a11693ca899811628d9eb18d7592f716d..d6dd6e3b6f1f0a986258668835998c89b42cc4dc 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h @@ -51,8 +51,6 @@ typedef struct { pthread_mutex_t *mutex; } mac_stats_updates_context_t; -/*Array holding the last stats reports for each eNB. Used for continuous reporting*/ -mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB]; /*Functions to initialize and destroy the struct required for the *continuous stats update report*/ diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h index 5f6432732f486e1842068fa5b33e76e8a548f26c..a9236af80b601b030dae7ad67e09926eed3dddd5 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h @@ -49,8 +49,6 @@ typedef struct /*To Be Extended*/ }rrc_meas_stats; -/* RRC CMI statistics */ -rrc_meas_stats * meas_stats; /* FLEXRAN AGENT-RRC Interface */ diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index d05fe7ac26d314bac5c80f5d7f8872597fa399bc..ee7b26ff1aa94804c64f304aaee624de02fe7412 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -57,6 +57,7 @@ #include "enb_paramdef.h" #include "proto_agent.h" #include "executables/thread-common.h" +#include <openair3/ocp-gtpu/gtp_itf.h> extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw); extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw); @@ -2058,7 +2059,9 @@ int RCconfig_gtpu(void ) { IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = enb_port_for_S1U; - itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address); + sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", enb_port_for_S1U); + itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for S1U\n"); @@ -3142,21 +3145,21 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { rrc_eNB_carrier_data_t *carrier = &RC.rrc[i]->carrier[0]; // identify local index of cell j by nr_cellid, plmn identity and physical cell ID LOG_I(ENB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", - j,i,RC.rrc[i]->nr_cellid,resp->nr_cellid[j]); + j,i,RC.rrc[i]->nr_cellid,resp->cells_to_activate[j].nr_cellid); - if (RC.rrc[i]->nr_cellid == resp->nr_cellid[j] && - (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && - resp->nrpci[j] == carrier->physCellId)) { + if (RC.rrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid && + (check_plmn_identity(carrier, resp->cells_to_activate[j].mcc, resp->cells_to_activate[j].mnc, resp->cells_to_activate[j].mnc_digit_length)>0 && + resp->cells_to_activate[j].nrpci == carrier->physCellId)) { // copy system information and decode it - for (si_ind=0; si_ind<resp->num_SI[j]; si_ind++) { + for (si_ind=0; si_ind<resp->cells_to_activate[j].num_SI; si_ind++) { //printf("SI %d size %d: ", si_ind, resp->SI_container_length[j][si_ind]); //for (int n=0;n<resp->SI_container_length[j][si_ind];n++) // printf("%02x ",resp->SI_container[j][si_ind][n]); //printf("\n"); extract_and_decode_SI(i, si_ind, - resp->SI_container[j][si_ind], - resp->SI_container_length[j][si_ind]); + resp->cells_to_activate[j].SI_container[si_ind], + resp->cells_to_activate[j].SI_container_length[si_ind]); } // perform MAC/L1 common configuration diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index abb5b57e0cbb58626de2dec1686aa75da6e4e1e9..1af59eab87c82ab4906b644816ba75ba2dbbf7ef 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -648,18 +648,6 @@ error: * ************************************ */ -int sort_ue_config(const void *a, const void *b) { - const Protocol__FlexUeConfig *fa = a; - const Protocol__FlexUeConfig *fb = b; - - if (fa->rnti < fb->rnti) - return -1; - else if (fa->rnti < fb->rnti) - return 1; - - return 0; -} - int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexHeader *header = NULL; diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index ae690c712496621ef0e1cd1dc69958ec11474966..18d32421dd10f49030121c4ccddd17d8c56dd4c0 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -70,7 +70,6 @@ typedef struct { pthread_mutex_t *mutex; } stats_updates_context_t; -stats_updates_context_t stats_context[NUM_MAX_ENB]; /********************************** * FlexRAN protocol messages helper diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c index 0d1c52096dce1bc277a217c0dac5e93ce60f8144..568a0e32cc91b73ff74c03e5112767a0c7891237 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -30,7 +30,7 @@ #include "common/utils/LOG/log.h" flexran_agent_channel_t *agent_channel[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; -flexran_agent_channel_instance_t channel_instance; +static flexran_agent_channel_instance_t channel_instance; int flexran_agent_channel_id = 0; int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { diff --git a/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c b/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c new file mode 100644 index 0000000000000000000000000000000000000000..a5eb8507128f5a93e1207f2cec379fa3047ece91 --- /dev/null +++ b/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c @@ -0,0 +1,33 @@ +#include <stdint.h> +#include <openair2/COMMON/platform_constants.h> +#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h> +pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; +uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + +uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/38473-g31.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/38473-g31.asn new file mode 100644 index 0000000000000000000000000000000000000000..c821c520103780434b33e149df6fe38d455c24e4 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/38473-g31.asn @@ -0,0 +1,10721 @@ +-- ASN1START +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +F1AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Descriptions (0)} + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode + +FROM F1AP-CommonDataTypes + Reset, + ResetAcknowledge, + F1SetupRequest, + F1SetupResponse, + F1SetupFailure, + GNBDUConfigurationUpdate, + GNBDUConfigurationUpdateAcknowledge, + GNBDUConfigurationUpdateFailure, + GNBCUConfigurationUpdate, + GNBCUConfigurationUpdateAcknowledge, + GNBCUConfigurationUpdateFailure, + UEContextSetupRequest, + UEContextSetupResponse, + UEContextSetupFailure, + UEContextReleaseCommand, + UEContextReleaseComplete, + UEContextModificationRequest, + UEContextModificationResponse, + UEContextModificationFailure, + UEContextModificationRequired, + UEContextModificationConfirm, + ErrorIndication, + UEContextReleaseRequest, + DLRRCMessageTransfer, + ULRRCMessageTransfer, + GNBDUResourceCoordinationRequest, + GNBDUResourceCoordinationResponse, + PrivateMessage, + UEInactivityNotification, + InitialULRRCMessageTransfer, + SystemInformationDeliveryCommand, + Paging, + Notify, + WriteReplaceWarningRequest, + WriteReplaceWarningResponse, + PWSCancelRequest, + PWSCancelResponse, + PWSRestartIndication, + PWSFailureIndication, + GNBDUStatusIndication, + RRCDeliveryReport, + UEContextModificationRefuse, + F1RemovalRequest, + F1RemovalResponse, + F1RemovalFailure, + NetworkAccessRateReduction, + TraceStart, + DeactivateTrace, + DUCURadioInformationTransfer, + CUDURadioInformationTransfer, + BAPMappingConfiguration, + BAPMappingConfigurationAcknowledge, + GNBDUResourceConfiguration, + GNBDUResourceConfigurationAcknowledge, + IABTNLAddressRequest, + IABTNLAddressResponse, + IABUPConfigurationUpdateRequest, + IABUPConfigurationUpdateResponse, + IABUPConfigurationUpdateFailure, + ResourceStatusRequest, + ResourceStatusResponse, + ResourceStatusFailure, + ResourceStatusUpdate, + AccessAndMobilityIndication, + ReferenceTimeInformationReportingControl, + ReferenceTimeInformationReport, + AccessSuccess, + CellTrafficTrace, + PositioningMeasurementRequest, + PositioningMeasurementResponse, + PositioningMeasurementFailure, + PositioningAssistanceInformationControl, + PositioningAssistanceInformationFeedback, + PositioningMeasurementReport, + PositioningMeasurementAbort, + PositioningMeasurementFailureIndication, + PositioningMeasurementUpdate, + TRPInformationRequest, + TRPInformationResponse, + TRPInformationFailure, + PositioningInformationRequest, + PositioningInformationResponse, + PositioningInformationFailure, + PositioningActivationRequest, + PositioningActivationResponse, + PositioningActivationFailure, + PositioningDeactivation, + PositioningInformationUpdate, + E-CIDMeasurementInitiationRequest, + E-CIDMeasurementInitiationResponse, + E-CIDMeasurementInitiationFailure, + E-CIDMeasurementFailureIndication, + E-CIDMeasurementReport, + E-CIDMeasurementTerminationCommand + + + +FROM F1AP-PDU-Contents + id-Reset, + id-F1Setup, + id-gNBDUConfigurationUpdate, + id-gNBCUConfigurationUpdate, + id-UEContextSetup, + id-UEContextRelease, + id-UEContextModification, + id-UEContextModificationRequired, + id-ErrorIndication, + id-UEContextReleaseRequest, + id-DLRRCMessageTransfer, + id-ULRRCMessageTransfer, + id-GNBDUResourceCoordination, + id-privateMessage, + id-UEInactivityNotification, + id-InitialULRRCMessageTransfer, + id-SystemInformationDeliveryCommand, + id-Paging, + id-Notify, + id-WriteReplaceWarning, + id-PWSCancel, + id-PWSRestartIndication, + id-PWSFailureIndication, + id-GNBDUStatusIndication, + id-RRCDeliveryReport, + id-F1Removal, + id-NetworkAccessRateReduction, + id-TraceStart, + id-DeactivateTrace, + id-DUCURadioInformationTransfer, + id-CUDURadioInformationTransfer, + id-BAPMappingConfiguration, + id-GNBDUResourceConfiguration, + id-IABTNLAddressAllocation, + id-IABUPConfigurationUpdate, + id-resourceStatusReportingInitiation, + id-resourceStatusReporting, + id-accessAndMobilityIndication, + id-ReferenceTimeInformationReportingControl, + id-ReferenceTimeInformationReport, + id-accessSuccess, + id-cellTrafficTrace, + id-PositioningMeasurementExchange, + id-PositioningAssistanceInformationControl, + id-PositioningAssistanceInformationFeedback, + id-PositioningMeasurementReport, + id-PositioningMeasurementAbort, + id-PositioningMeasurementFailureIndication, + id-PositioningMeasurementUpdate, + id-TRPInformationExchange, + id-PositioningInformationExchange, + id-PositioningActivation, + id-PositioningDeactivation, + id-PositioningInformationUpdate, + id-E-CIDMeasurementInitiation, + id-E-CIDMeasurementFailureIndication, + id-E-CIDMeasurementReport, + id-E-CIDMeasurementTermination + + +FROM F1AP-Constants + + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +F1AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + choice-extension ProtocolIE-SingleContainer { { F1AP-PDU-ExtIEs} } +} + +F1AP-PDU-ExtIEs F1AP-PROTOCOL-IES ::= { -- this extension is not used + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURES F1AP-ELEMENTARY-PROCEDURE ::= { + F1AP-ELEMENTARY-PROCEDURES-CLASS-1 | + F1AP-ELEMENTARY-PROCEDURES-CLASS-2, + ... +} + + +F1AP-ELEMENTARY-PROCEDURES-CLASS-1 F1AP-ELEMENTARY-PROCEDURE ::= { + reset | + f1Setup | + gNBDUConfigurationUpdate | + gNBCUConfigurationUpdate | + uEContextSetup | + uEContextRelease | + uEContextModification | + uEContextModificationRequired | + writeReplaceWarning | + pWSCancel | + gNBDUResourceCoordination | + f1Removal | + bAPMappingConfiguration | + gNBDUResourceConfiguration | + iABTNLAddressAllocation | + iABUPConfigurationUpdate | + resourceStatusReportingInitiation | + positioningMeasurementExchange | + tRPInformationExchange | + positioningInformationExchange | + positioningActivation | + e-CIDMeasurementInitiation, + ... +} + +F1AP-ELEMENTARY-PROCEDURES-CLASS-2 F1AP-ELEMENTARY-PROCEDURE ::= { + errorIndication | + uEContextReleaseRequest | + dLRRCMessageTransfer | + uLRRCMessageTransfer | + uEInactivityNotification | + privateMessage | + initialULRRCMessageTransfer | + systemInformationDelivery | + paging | + notify | + pWSRestartIndication | + pWSFailureIndication | + gNBDUStatusIndication | + rRCDeliveryReport | + networkAccessRateReduction | + traceStart | + deactivateTrace | + dUCURadioInformationTransfer | + cUDURadioInformationTransfer | + resourceStatusReporting | + accessAndMobilityIndication | + referenceTimeInformationReportingControl| + referenceTimeInformationReport | + accessSuccess | + cellTrafficTrace | + positioningAssistanceInformationControl | + positioningAssistanceInformationFeedback | + positioningMeasurementReport | + positioningMeasurementAbort | + positioningMeasurementFailureIndication | + positioningMeasurementUpdate | + positioningDeactivation | + e-CIDMeasurementFailureIndication | + e-CIDMeasurementReport | + e-CIDMeasurementTermination | + positioningInformationUpdate, + ... +} +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +reset F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Reset + SUCCESSFUL OUTCOME ResetAcknowledge + PROCEDURE CODE id-Reset + CRITICALITY reject +} + +f1Setup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1SetupRequest + SUCCESSFUL OUTCOME F1SetupResponse + UNSUCCESSFUL OUTCOME F1SetupFailure + PROCEDURE CODE id-F1Setup + CRITICALITY reject +} + +gNBDUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUConfigurationUpdate + SUCCESSFUL OUTCOME GNBDUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBDUConfigurationUpdateFailure + PROCEDURE CODE id-gNBDUConfigurationUpdate + CRITICALITY reject +} + +gNBCUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBCUConfigurationUpdate + SUCCESSFUL OUTCOME GNBCUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBCUConfigurationUpdateFailure + PROCEDURE CODE id-gNBCUConfigurationUpdate + CRITICALITY reject +} + +uEContextSetup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextSetupRequest + SUCCESSFUL OUTCOME UEContextSetupResponse + UNSUCCESSFUL OUTCOME UEContextSetupFailure + PROCEDURE CODE id-UEContextSetup + CRITICALITY reject +} + +uEContextRelease F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseCommand + SUCCESSFUL OUTCOME UEContextReleaseComplete + PROCEDURE CODE id-UEContextRelease + CRITICALITY reject +} + +uEContextModification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequest + SUCCESSFUL OUTCOME UEContextModificationResponse + UNSUCCESSFUL OUTCOME UEContextModificationFailure + PROCEDURE CODE id-UEContextModification + CRITICALITY reject +} + +uEContextModificationRequired F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequired + SUCCESSFUL OUTCOME UEContextModificationConfirm + UNSUCCESSFUL OUTCOME UEContextModificationRefuse + PROCEDURE CODE id-UEContextModificationRequired + CRITICALITY reject +} + +writeReplaceWarning F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE WriteReplaceWarningRequest + SUCCESSFUL OUTCOME WriteReplaceWarningResponse + PROCEDURE CODE id-WriteReplaceWarning + CRITICALITY reject +} + +pWSCancel F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSCancelRequest + SUCCESSFUL OUTCOME PWSCancelResponse + PROCEDURE CODE id-PWSCancel + CRITICALITY reject +} + +errorIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-ErrorIndication + CRITICALITY ignore +} + +uEContextReleaseRequest F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseRequest + PROCEDURE CODE id-UEContextReleaseRequest + CRITICALITY ignore +} + + +initialULRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InitialULRRCMessageTransfer + PROCEDURE CODE id-InitialULRRCMessageTransfer + CRITICALITY ignore +} + +dLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DLRRCMessageTransfer + PROCEDURE CODE id-DLRRCMessageTransfer + CRITICALITY ignore +} + +uLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ULRRCMessageTransfer + PROCEDURE CODE id-ULRRCMessageTransfer + CRITICALITY ignore +} + + +uEInactivityNotification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEInactivityNotification + PROCEDURE CODE id-UEInactivityNotification + CRITICALITY ignore +} + +gNBDUResourceCoordination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceCoordinationRequest + SUCCESSFUL OUTCOME GNBDUResourceCoordinationResponse + PROCEDURE CODE id-GNBDUResourceCoordination + CRITICALITY reject +} + +privateMessage F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-privateMessage + CRITICALITY ignore +} + +systemInformationDelivery F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SystemInformationDeliveryCommand + PROCEDURE CODE id-SystemInformationDeliveryCommand + CRITICALITY ignore +} + + +paging F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Paging + PROCEDURE CODE id-Paging + CRITICALITY ignore +} + +notify F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Notify + PROCEDURE CODE id-Notify + CRITICALITY ignore +} + +networkAccessRateReduction F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE NetworkAccessRateReduction + PROCEDURE CODE id-NetworkAccessRateReduction + CRITICALITY ignore +} + + +pWSRestartIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSRestartIndication + PROCEDURE CODE id-PWSRestartIndication + CRITICALITY ignore +} + +pWSFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSFailureIndication + PROCEDURE CODE id-PWSFailureIndication + CRITICALITY ignore +} + +gNBDUStatusIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUStatusIndication + PROCEDURE CODE id-GNBDUStatusIndication + CRITICALITY ignore +} + + +rRCDeliveryReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RRCDeliveryReport + PROCEDURE CODE id-RRCDeliveryReport + CRITICALITY ignore +} + +f1Removal F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1RemovalRequest + SUCCESSFUL OUTCOME F1RemovalResponse + UNSUCCESSFUL OUTCOME F1RemovalFailure + PROCEDURE CODE id-F1Removal + CRITICALITY reject +} + +traceStart F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TraceStart + PROCEDURE CODE id-TraceStart + CRITICALITY ignore +} + +deactivateTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DeactivateTrace + PROCEDURE CODE id-DeactivateTrace + CRITICALITY ignore +} + +dUCURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DUCURadioInformationTransfer + PROCEDURE CODE id-DUCURadioInformationTransfer + CRITICALITY ignore +} + +cUDURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CUDURadioInformationTransfer + PROCEDURE CODE id-CUDURadioInformationTransfer + CRITICALITY ignore +} + +bAPMappingConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE BAPMappingConfiguration + SUCCESSFUL OUTCOME BAPMappingConfigurationAcknowledge + PROCEDURE CODE id-BAPMappingConfiguration + CRITICALITY reject +} + +gNBDUResourceConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceConfiguration + SUCCESSFUL OUTCOME GNBDUResourceConfigurationAcknowledge + PROCEDURE CODE id-GNBDUResourceConfiguration + CRITICALITY reject +} + +iABTNLAddressAllocation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABTNLAddressRequest + SUCCESSFUL OUTCOME IABTNLAddressResponse + PROCEDURE CODE id-IABTNLAddressAllocation + CRITICALITY reject +} + +iABUPConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABUPConfigurationUpdateRequest + SUCCESSFUL OUTCOME IABUPConfigurationUpdateResponse + UNSUCCESSFUL OUTCOME IABUPConfigurationUpdateFailure + PROCEDURE CODE id-IABUPConfigurationUpdate + CRITICALITY reject +} + +resourceStatusReportingInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusRequest + SUCCESSFUL OUTCOME ResourceStatusResponse + UNSUCCESSFUL OUTCOME ResourceStatusFailure + PROCEDURE CODE id-resourceStatusReportingInitiation + CRITICALITY reject +} + +resourceStatusReporting F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusUpdate + PROCEDURE CODE id-resourceStatusReporting + CRITICALITY ignore +} + +accessAndMobilityIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessAndMobilityIndication + PROCEDURE CODE id-accessAndMobilityIndication + CRITICALITY ignore +} + +referenceTimeInformationReportingControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReportingControl + PROCEDURE CODE id-ReferenceTimeInformationReportingControl + CRITICALITY ignore +} + +referenceTimeInformationReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReport + PROCEDURE CODE id-ReferenceTimeInformationReport + CRITICALITY ignore +} + +accessSuccess F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessSuccess + PROCEDURE CODE id-accessSuccess + CRITICALITY ignore +} + +cellTrafficTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellTrafficTrace + PROCEDURE CODE id-cellTrafficTrace + CRITICALITY ignore +} + +positioningAssistanceInformationControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationControl + PROCEDURE CODE id-PositioningAssistanceInformationControl + CRITICALITY ignore +} + +positioningAssistanceInformationFeedback F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationFeedback + PROCEDURE CODE id-PositioningAssistanceInformationFeedback + CRITICALITY ignore +} + +positioningMeasurementExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementRequest + SUCCESSFUL OUTCOME PositioningMeasurementResponse + UNSUCCESSFUL OUTCOME PositioningMeasurementFailure + PROCEDURE CODE id-PositioningMeasurementExchange + CRITICALITY reject +} + +positioningMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementReport + PROCEDURE CODE id-PositioningMeasurementReport + CRITICALITY ignore +} + +positioningMeasurementAbort F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementAbort + PROCEDURE CODE id-PositioningMeasurementAbort + CRITICALITY ignore +} + +positioningMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementFailureIndication + PROCEDURE CODE id-PositioningMeasurementFailureIndication + CRITICALITY ignore +} + +positioningMeasurementUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementUpdate + PROCEDURE CODE id-PositioningMeasurementUpdate + CRITICALITY ignore +} + + +tRPInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TRPInformationRequest + SUCCESSFUL OUTCOME TRPInformationResponse + UNSUCCESSFUL OUTCOME TRPInformationFailure + PROCEDURE CODE id-TRPInformationExchange + CRITICALITY reject +} + +positioningInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationRequest + SUCCESSFUL OUTCOME PositioningInformationResponse + UNSUCCESSFUL OUTCOME PositioningInformationFailure + PROCEDURE CODE id-PositioningInformationExchange + CRITICALITY reject +} + +positioningActivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningActivationRequest + SUCCESSFUL OUTCOME PositioningActivationResponse + UNSUCCESSFUL OUTCOME PositioningActivationFailure + PROCEDURE CODE id-PositioningActivation + CRITICALITY reject +} + +positioningDeactivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningDeactivation + PROCEDURE CODE id-PositioningDeactivation + CRITICALITY ignore +} + +e-CIDMeasurementInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementInitiationRequest + SUCCESSFUL OUTCOME E-CIDMeasurementInitiationResponse + UNSUCCESSFUL OUTCOME E-CIDMeasurementInitiationFailure + PROCEDURE CODE id-E-CIDMeasurementInitiation + CRITICALITY reject +} + +e-CIDMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementFailureIndication + PROCEDURE CODE id-E-CIDMeasurementFailureIndication + CRITICALITY ignore +} + +e-CIDMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementReport + PROCEDURE CODE id-E-CIDMeasurementReport + CRITICALITY ignore +} + +e-CIDMeasurementTermination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementTerminationCommand + PROCEDURE CODE id-E-CIDMeasurementTermination + CRITICALITY ignore +} + +positioningInformationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationUpdate + PROCEDURE CODE id-PositioningInformationUpdate + CRITICALITY ignore +} + + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- PDU definitions for F1AP. +-- +-- ************************************************************** + +F1AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Candidate-SpCell-Item, + Cause, + Cells-Failed-to-be-Activated-List-Item, + Cells-Status-Item, + Cells-to-be-Activated-List-Item, + Cells-to-be-Deactivated-List-Item, + CellULConfigured, + CriticalityDiagnostics, + C-RNTI, + CUtoDURRCInformation, + DRB-Activity-Item, + DRBID, + DRBs-FailedToBeModified-Item, + DRBs-FailedToBeSetup-Item, + DRBs-FailedToBeSetupMod-Item, + DRB-Notify-Item, + DRBs-ModifiedConf-Item, + DRBs-Modified-Item, + DRBs-Required-ToBeModified-Item, + DRBs-Required-ToBeReleased-Item, + DRBs-Setup-Item, + DRBs-SetupMod-Item, + DRBs-ToBeModified-Item, + DRBs-ToBeReleased-Item, + DRBs-ToBeSetup-Item, + DRBs-ToBeSetupMod-Item, + DRXCycle, + DRXConfigurationIndicator, + DUtoCURRCInformation, + EUTRANQoS, + ExecuteDuplication, + FullConfiguration, + GNB-CU-UE-F1AP-ID, + GNB-DU-UE-F1AP-ID, + GNB-DU-ID, + GNB-DU-Served-Cells-Item, + GNB-DU-System-Information, + GNB-CU-Name, + GNB-DU-Name, + InactivityMonitoringRequest, + InactivityMonitoringResponse, + LowerLayerPresenceStatusChange, + NotificationControl, + NRCGI, + NRPCI, + UEContextNotRetrievable, + Potential-SpCell-Item, + RAT-FrequencyPriorityInformation, + RequestedSRSTransmissionCharacteristics, + ResourceCoordinationTransferContainer, + RRCContainer, + RRCContainer-RRCSetupComplete, + RRCReconfigurationCompleteIndicator, + SCellIndex, + SCell-ToBeRemoved-Item, + SCell-ToBeSetup-Item, + SCell-ToBeSetupMod-Item, + SCell-FailedtoSetup-Item, + SCell-FailedtoSetupMod-Item, + ServCellIndex, + Served-Cell-Information, + Served-Cells-To-Add-Item, + Served-Cells-To-Delete-Item, + Served-Cells-To-Modify-Item, + ServingCellMO, + SRBID, + SRBs-FailedToBeSetup-Item, + SRBs-FailedToBeSetupMod-Item, + SRBs-Required-ToBeReleased-Item, + SRBs-ToBeReleased-Item, + SRBs-ToBeSetup-Item, + SRBs-ToBeSetupMod-Item, + SRBs-Modified-Item, + SRBs-Setup-Item, + SRBs-SetupMod-Item, + TimeToWait, + TransactionID, + TransmissionActionIndicator, + UE-associatedLogicalF1-ConnectionItem, + DUtoCURRCContainer, + PagingCell-Item, + SItype-List, + UEIdentityIndexValue, + GNB-CU-TNL-Association-Setup-Item, + GNB-CU-TNL-Association-Failed-To-Setup-Item, + GNB-CU-TNL-Association-To-Add-Item, + GNB-CU-TNL-Association-To-Remove-Item, + GNB-CU-TNL-Association-To-Update-Item, + MaskedIMEISV, + PagingDRX, + PagingPriority, + PagingIdentity, + Cells-to-be-Barred-Item, + PWSSystemInformation, + Broadcast-To-Be-Cancelled-Item, + Cells-Broadcast-Cancelled-Item, + NR-CGI-List-For-Restart-Item, + PWS-Failed-NR-CGI-Item, + RepetitionPeriod, + NumberofBroadcastRequest, + Cells-To-Be-Broadcast-Item, + Cells-Broadcast-Completed-Item, + Cancel-all-Warning-Messages-Indicator, + EUTRA-NR-CellResourceCoordinationReq-Container, + EUTRA-NR-CellResourceCoordinationReqAck-Container, + RequestType, + PLMN-Identity, + RLCFailureIndication, + UplinkTxDirectCurrentListInformation, + SULAccessIndication, + Protected-EUTRA-Resources-Item, + GNB-DUConfigurationQuery, + BitRate, + RRC-Version, + GNBDUOverloadInformation, + RRCDeliveryStatusRequest, + NeedforGap, + RRCDeliveryStatus, + ResourceCoordinationTransferInformation, + Dedicated-SIDelivery-NeededUE-Item, + Associated-SCell-Item, + IgnoreResourceCoordinationContainer, + PagingOrigin, + UAC-Assistance-Info, + RANUEID, + GNB-DU-TNL-Association-To-Remove-Item, + NotificationInformation, + TraceActivation, + TraceID, + Neighbour-Cell-Information-Item, + SymbolAllocInSlot, + NumDLULSymbols, + AdditionalRRMPriorityIndex, + DUCURadioInformationType, + CUDURadioInformationType, + Transport-Layer-Address-Info, + BHChannels-ToBeSetup-Item, + BHChannels-Setup-Item, + BHChannels-FailedToBeSetup-Item, + BHChannels-ToBeModified-Item, + BHChannels-ToBeReleased-Item, + BHChannels-ToBeSetupMod-Item, + BHChannels-FailedToBeModified-Item, + BHChannels-FailedToBeSetupMod-Item, + BHChannels-Modified-Item, + BHChannels-SetupMod-Item, + BHChannels-Required-ToBeReleased-Item, + BAPAddress, + BAPPathID, + BAPRoutingID, + BH-Routing-Information-Added-List-Item, + BH-Routing-Information-Removed-List-Item, + Child-Nodes-List, + Child-Nodes-List-Item, + Child-Node-Cells-List, + Child-Node-Cells-List-Item, + Activated-Cells-to-be-Updated-List, + Activated-Cells-to-be-Updated-List-Item, + UL-BH-Non-UP-Traffic-Mapping, + IABTNLAddressesRequested, + IABIPv6RequestType, + IAB-TNL-Addresses-To-Remove-Item, + IABTNLAddress, + IAB-Allocated-TNL-Address-Item, + IABv4AddressesRequested, + TrafficMappingInfo, + UL-UP-TNL-Information-to-Update-List-Item, + UL-UP-TNL-Address-to-Update-List-Item, + DL-UP-TNL-Address-to-Update-List-Item, + NRV2XServicesAuthorized, + LTEV2XServicesAuthorized, + NRUESidelinkAggregateMaximumBitrate, + LTEUESidelinkAggregateMaximumBitrate, + SLDRBs-SetupMod-Item, + SLDRBs-ModifiedConf-Item, + SLDRBID, + SLDRBs-FailedToBeModified-Item, + SLDRBs-FailedToBeSetup-Item, + SLDRBs-FailedToBeSetupMod-Item, + SLDRBs-Modified-Item, + SLDRBs-Required-ToBeModified-Item, + SLDRBs-Required-ToBeReleased-Item, + SLDRBs-Setup-Item, + SLDRBs-ToBeModified-Item, + SLDRBs-ToBeReleased-Item, + SLDRBs-ToBeSetup-Item, + SLDRBs-ToBeSetupMod-Item, + GNBCUMeasurementID, + GNBDUMeasurementID, + RegistrationRequest, + ReportCharacteristics, + CellToReportList, + HardwareLoadIndicator, + CellMeasurementResultList, + ReportingPeriodicity, + TNLCapacityIndicator, + RACHReportInformationList, + RLFReportInformationList, + ReportingRequestType, + TimeReferenceInformation, + ConditionalInterDUMobilityInformation, + ConditionalIntraDUMobilityInformation, + TargetCellList, + MDTPLMNList, + PrivacyIndicator, + TransportLayerAddress, + URI-address, + NID, + PosAssistance-Information, + PosBroadcast, + PositioningBroadcastCells, + RoutingID, + PosAssistanceInformationFailureList, + PosMeasurementQuantities, + PosMeasurementResultList, + PosMeasurementPeriodicity, + PosReportCharacteristics, + TRPInformationTypeItem, + TRPInformationItem, + LMF-MeasurementID, + RAN-MeasurementID, + SRSResourceSetID, + SRSSpatialRelation, + SRSResourceTrigger, + SRSConfiguration, + TRPList, + E-CID-MeasurementQuantities, + E-CID-MeasurementPeriodicity, + E-CID-MeasurementResult, + Cell-Portion-ID, + LMF-UE-MeasurementID, + RAN-UE-MeasurementID, + SFNInitialisationTime, + SystemFrameNumber, + SlotNumber, + AbortTransmission, + TRP-MeasurementRequestList, + MeasurementBeamInfoRequest, + E-CID-ReportCharacteristics, + Extended-GNB-CU-Name, + Extended-GNB-DU-Name + + + +FROM F1AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-SingleContainer{}, + F1AP-PRIVATE-IES, + F1AP-PROTOCOL-EXTENSION, + F1AP-PROTOCOL-IES, + F1AP-PROTOCOL-IES-PAIR + +FROM F1AP-Containers + + id-Candidate-SpCell-Item, + id-Candidate-SpCell-List, + id-Cause, + id-Cancel-all-Warning-Messages-Indicator, + id-Cells-Failed-to-be-Activated-List, + id-Cells-Failed-to-be-Activated-List-Item, + id-Cells-Status-Item, + id-Cells-Status-List, + id-Cells-to-be-Activated-List, + id-Cells-to-be-Activated-List-Item, + id-Cells-to-be-Deactivated-List, + id-Cells-to-be-Deactivated-List-Item, + id-ConfirmedUEID, + id-CriticalityDiagnostics, + id-C-RNTI, + id-CUtoDURRCInformation, + id-DRB-Activity-Item, + id-DRB-Activity-List, + id-DRBs-FailedToBeModified-Item, + id-DRBs-FailedToBeModified-List, + id-DRBs-FailedToBeSetup-Item, + id-DRBs-FailedToBeSetup-List, + id-DRBs-FailedToBeSetupMod-Item, + id-DRBs-FailedToBeSetupMod-List, + id-DRBs-ModifiedConf-Item, + id-DRBs-ModifiedConf-List, + id-DRBs-Modified-Item, + id-DRBs-Modified-List, + id-DRB-Notify-Item, + id-DRB-Notify-List, + id-DRBs-Required-ToBeModified-Item, + id-DRBs-Required-ToBeModified-List, + id-DRBs-Required-ToBeReleased-Item, + id-DRBs-Required-ToBeReleased-List, + id-DRBs-Setup-Item, + id-DRBs-Setup-List, + id-DRBs-SetupMod-Item, + id-DRBs-SetupMod-List, + id-DRBs-ToBeModified-Item, + id-DRBs-ToBeModified-List, + id-DRBs-ToBeReleased-Item, + id-DRBs-ToBeReleased-List, + id-DRBs-ToBeSetup-Item, + id-DRBs-ToBeSetup-List, + id-DRBs-ToBeSetupMod-Item, + id-DRBs-ToBeSetupMod-List, + id-DRXCycle, + id-DUtoCURRCInformation, + id-ExecuteDuplication, + id-FullConfiguration, + id-gNB-CU-UE-F1AP-ID, + id-gNB-DU-UE-F1AP-ID, + id-gNB-DU-ID, + id-GNB-DU-Served-Cells-Item, + id-gNB-DU-Served-Cells-List, + id-gNB-CU-Name, + id-gNB-DU-Name, + id-Extended-GNB-CU-Name, + id-Extended-GNB-DU-Name, + id-InactivityMonitoringRequest, + id-InactivityMonitoringResponse, + id-new-gNB-CU-UE-F1AP-ID, + id-new-gNB-DU-UE-F1AP-ID, + id-oldgNB-DU-UE-F1AP-ID, + id-PLMNAssistanceInfoForNetShar, + id-Potential-SpCell-Item, + id-Potential-SpCell-List, + id-RAT-FrequencyPriorityInformation, + id-RedirectedRRCmessage, + id-ResetType, + id-RequestedSRSTransmissionCharacteristics, + id-ResourceCoordinationTransferContainer, + id-RRCContainer, + id-RRCContainer-RRCSetupComplete, + id-RRCReconfigurationCompleteIndicator, + id-SCell-FailedtoSetup-List, + id-SCell-FailedtoSetup-Item, + id-SCell-FailedtoSetupMod-List, + id-SCell-FailedtoSetupMod-Item, + id-SCell-ToBeRemoved-Item, + id-SCell-ToBeRemoved-List, + id-SCell-ToBeSetup-Item, + id-SCell-ToBeSetup-List, + id-SCell-ToBeSetupMod-Item, + id-SCell-ToBeSetupMod-List, + id-SelectedPLMNID, + id-Served-Cells-To-Add-Item, + id-Served-Cells-To-Add-List, + id-Served-Cells-To-Delete-Item, + id-Served-Cells-To-Delete-List, + id-Served-Cells-To-Modify-Item, + id-Served-Cells-To-Modify-List, + id-ServCellIndex, + id-ServingCellMO, + id-SpCell-ID, + id-SpCellULConfigured, + id-SRBID, + id-SRBs-FailedToBeSetup-Item, + id-SRBs-FailedToBeSetup-List, + id-SRBs-FailedToBeSetupMod-Item, + id-SRBs-FailedToBeSetupMod-List, + id-SRBs-Required-ToBeReleased-Item, + id-SRBs-Required-ToBeReleased-List, + id-SRBs-ToBeReleased-Item, + id-SRBs-ToBeReleased-List, + id-SRBs-ToBeSetup-Item, + id-SRBs-ToBeSetup-List, + id-SRBs-ToBeSetupMod-Item, + id-SRBs-ToBeSetupMod-List, + id-SRBs-Modified-Item, + id-SRBs-Modified-List, + id-SRBs-Setup-Item, + id-SRBs-Setup-List, + id-SRBs-SetupMod-Item, + id-SRBs-SetupMod-List, + id-TimeToWait, + id-TransactionID, + id-TransmissionActionIndicator, + id-UEContextNotRetrievable, + id-UE-associatedLogicalF1-ConnectionItem, + id-UE-associatedLogicalF1-ConnectionListResAck, + id-DUtoCURRCContainer, + id-NRCGI, + id-PagingCell-Item, + id-PagingCell-List, + id-PagingDRX, + id-PagingPriority, + id-SItype-List, + id-UEIdentityIndexValue, + id-GNB-CU-TNL-Association-Setup-List, + id-GNB-CU-TNL-Association-Setup-Item, + id-GNB-CU-TNL-Association-Failed-To-Setup-List, + id-GNB-CU-TNL-Association-Failed-To-Setup-Item, + id-GNB-CU-TNL-Association-To-Add-Item, + id-GNB-CU-TNL-Association-To-Add-List, + id-GNB-CU-TNL-Association-To-Remove-Item, + id-GNB-CU-TNL-Association-To-Remove-List, + id-GNB-CU-TNL-Association-To-Update-Item, + id-GNB-CU-TNL-Association-To-Update-List, + id-MaskedIMEISV, + id-PagingIdentity, + id-Cells-to-be-Barred-List, + id-Cells-to-be-Barred-Item, + id-PWSSystemInformation, + id-RepetitionPeriod, + id-NumberofBroadcastRequest, + id-Cells-To-Be-Broadcast-List, + id-Cells-To-Be-Broadcast-Item, + id-Cells-Broadcast-Completed-List, + id-Cells-Broadcast-Completed-Item, + id-Broadcast-To-Be-Cancelled-List, + id-Broadcast-To-Be-Cancelled-Item, + id-Cells-Broadcast-Cancelled-List, + id-Cells-Broadcast-Cancelled-Item, + id-NR-CGI-List-For-Restart-List, + id-NR-CGI-List-For-Restart-Item, + id-PWS-Failed-NR-CGI-List, + id-PWS-Failed-NR-CGI-Item, + id-EUTRA-NR-CellResourceCoordinationReq-Container, + id-EUTRA-NR-CellResourceCoordinationReqAck-Container, + id-Protected-EUTRA-Resources-List, + id-RequestType, + id-ServingPLMN, + id-DRXConfigurationIndicator, + id-RLCFailureIndication, + id-UplinkTxDirectCurrentListInformation, + id-SULAccessIndication, + id-Protected-EUTRA-Resources-Item, + id-GNB-DUConfigurationQuery, + id-GNB-DU-UE-AMBR-UL, + id-GNB-CU-RRC-Version, + id-GNB-DU-RRC-Version, + id-GNBDUOverloadInformation, + id-NeedforGap, + id-RRCDeliveryStatusRequest, + id-RRCDeliveryStatus, + id-Dedicated-SIDelivery-NeededUE-List, + id-Dedicated-SIDelivery-NeededUE-Item, + id-ResourceCoordinationTransferInformation, + id-Associated-SCell-List, + id-Associated-SCell-Item, + id-IgnoreResourceCoordinationContainer, + id-UAC-Assistance-Info, + id-RANUEID, + id-PagingOrigin, + id-GNB-DU-TNL-Association-To-Remove-Item, + id-GNB-DU-TNL-Association-To-Remove-List, + id-NotificationInformation, + id-TraceActivation, + id-TraceID, + id-Neighbour-Cell-Information-List, + id-Neighbour-Cell-Information-Item, + id-SymbolAllocInSlot, + id-NumDLULSymbols, + id-AdditionalRRMPriorityIndex, + id-DUCURadioInformationType, + id-CUDURadioInformationType, + id-LowerLayerPresenceStatusChange, + id-Transport-Layer-Address-Info, + id-BHChannels-ToBeSetup-List, + id-BHChannels-ToBeSetup-Item, + id-BHChannels-Setup-List, + id-BHChannels-Setup-Item, + id-BHChannels-ToBeModified-Item, + id-BHChannels-ToBeModified-List, + id-BHChannels-ToBeReleased-Item, + id-BHChannels-ToBeReleased-List, + id-BHChannels-ToBeSetupMod-Item, + id-BHChannels-ToBeSetupMod-List, + id-BHChannels-FailedToBeSetup-Item, + id-BHChannels-FailedToBeSetup-List, + id-BHChannels-FailedToBeModified-Item, + id-BHChannels-FailedToBeModified-List, + id-BHChannels-FailedToBeSetupMod-Item, + id-BHChannels-FailedToBeSetupMod-List, + id-BHChannels-Modified-Item, + id-BHChannels-Modified-List, + id-BHChannels-SetupMod-Item, + id-BHChannels-SetupMod-List, + id-BHChannels-Required-ToBeReleased-Item, + id-BHChannels-Required-ToBeReleased-List, + id-BAPAddress, + id-ConfiguredBAPAddress, + id-BH-Routing-Information-Added-List, + id-BH-Routing-Information-Added-List-Item, + id-BH-Routing-Information-Removed-List, + id-BH-Routing-Information-Removed-List-Item, + id-UL-BH-Non-UP-Traffic-Mapping, + id-Child-Nodes-List, + id-Activated-Cells-to-be-Updated-List, + id-IABIPv6RequestType, + id-IAB-TNL-Addresses-To-Remove-List, + id-IAB-TNL-Addresses-To-Remove-Item, + id-IAB-Allocated-TNL-Address-List, + id-IAB-Allocated-TNL-Address-Item, + id-IABv4AddressesRequested, + id-TrafficMappingInformation, + id-UL-UP-TNL-Information-to-Update-List, + id-UL-UP-TNL-Information-to-Update-List-Item, + id-UL-UP-TNL-Address-to-Update-List, + id-UL-UP-TNL-Address-to-Update-List-Item, + id-DL-UP-TNL-Address-to-Update-List, + id-DL-UP-TNL-Address-to-Update-List-Item, + id-NRV2XServicesAuthorized, + id-LTEV2XServicesAuthorized, + id-NRUESidelinkAggregateMaximumBitrate, + id-LTEUESidelinkAggregateMaximumBitrate, + id-PC5LinkAMBR, + id-SLDRBs-FailedToBeModified-Item, + id-SLDRBs-FailedToBeModified-List, + id-SLDRBs-FailedToBeSetup-Item, + id-SLDRBs-FailedToBeSetup-List, + id-SLDRBs-Modified-Item, + id-SLDRBs-Modified-List, + id-SLDRBs-Required-ToBeModified-Item, + id-SLDRBs-Required-ToBeModified-List, + id-SLDRBs-Required-ToBeReleased-Item, + id-SLDRBs-Required-ToBeReleased-List, + id-SLDRBs-Setup-Item, + id-SLDRBs-Setup-List, + id-SLDRBs-ToBeModified-Item, + id-SLDRBs-ToBeModified-List, + id-SLDRBs-ToBeReleased-Item, + id-SLDRBs-ToBeReleased-List, + id-SLDRBs-ToBeSetup-Item, + id-SLDRBs-ToBeSetup-List, + id-SLDRBs-ToBeSetupMod-Item, + id-SLDRBs-ToBeSetupMod-List, + id-SLDRBs-SetupMod-List, + id-SLDRBs-FailedToBeSetupMod-List, + id-SLDRBs-SetupMod-Item, + id-SLDRBs-FailedToBeSetupMod-Item, + id-SLDRBs-ModifiedConf-List, + id-SLDRBs-ModifiedConf-Item, + id-gNBCUMeasurementID, + id-gNBDUMeasurementID, + id-RegistrationRequest, + id-ReportCharacteristics, + id-CellToReportList, + id-CellMeasurementResultList, + id-HardwareLoadIndicator, + id-ReportingPeriodicity, + id-TNLCapacityIndicator, + id-RACHReportInformationList, + id-RLFReportInformationList, + id-ReportingRequestType, + id-TimeReferenceInformation, + id-ConditionalInterDUMobilityInformation, + id-ConditionalIntraDUMobilityInformation, + id-targetCellsToCancel, + id-requestedTargetCellGlobalID, + id-TraceCollectionEntityIPAddress, + id-ManagementBasedMDTPLMNList, + id-PrivacyIndicator, + id-TraceCollectionEntityURI, + id-ServingNID, + id-PosAssistance-Information, + id-PosBroadcast, + id-PositioningBroadcastCells, + id-RoutingID, + id-PosAssistanceInformationFailureList, + id-PosMeasurementQuantities, + id-PosMeasurementResultList, + id-PosMeasurementPeriodicity, + id-PosReportCharacteristics, + id-TRPInformationTypeListTRPReq, + id-TRPInformationTypeItem, + id-TRPInformationListTRPResp, + id-TRPInformationItem, + id-LMF-MeasurementID, + id-RAN-MeasurementID, + id-SRSType, + id-ActivationTime, + id-AbortTransmission, + id-SRSConfiguration, + id-TRPList, + id-E-CID-MeasurementQuantities, + id-E-CID-MeasurementPeriodicity, + id-E-CID-MeasurementResult, + id-Cell-Portion-ID, + id-LMF-UE-MeasurementID, + id-RAN-UE-MeasurementID, + id-SFNInitialisationTime, + id-SystemFrameNumber, + id-SlotNumber, + id-TRP-MeasurementRequestList, + id-MeasurementBeamInfoRequest, + id-E-CID-ReportCharacteristics, + + maxCellingNBDU, + maxnoofCandidateSpCells, + maxnoofDRBs, + maxnoofErrors, + maxnoofIndividualF1ConnectionsToReset, + maxnoofPotentialSpCells, + maxnoofSCells, + maxnoofSRBs, + maxnoofPagingCells, + maxnoofTNLAssociations, + maxCellineNB, + maxnoofUEIDs, + maxnoofBHRLCChannels, + maxnoofRoutingEntries, + maxnoofChildIABNodes, + maxnoofServedCellsIAB, + maxnoofTLAsIAB, + maxnoofULUPTNLInformationforIAB, + maxnoofUPTNLAddresses, + maxnoofSLDRBs, + maxnoofTRPInfoTypes, + maxnoofTRPs + + + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- RESET ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Reset +-- +-- ************************************************************** + +Reset ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetIEs} }, + ... +} + +ResetIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, + ... +} + +ResetType ::= CHOICE { + f1-Interface ResetAll, + partOfF1-Interface UE-associatedLogicalF1-ConnectionListRes, + choice-extension ProtocolIE-SingleContainer { { ResetType-ExtIEs} } +} + +ResetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +ResetAll ::= ENUMERATED { + reset-all, + ... +} + +UE-associatedLogicalF1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemRes } } + +UE-associatedLogicalF1-ConnectionItemRes F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- Reset Acknowledge +-- +-- ************************************************************** + +ResetAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetAcknowledgeIEs} }, + ... +} + +ResetAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UE-associatedLogicalF1-ConnectionListResAck CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionListResAck PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +UE-associatedLogicalF1-ConnectionListResAck ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemResAck } } + +UE-associatedLogicalF1-ConnectionItemResAck F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Error Indication +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndicationIEs}}, + ... +} + +ErrorIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- F1 SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Setup Request +-- +-- ************************************************************** + +F1SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupRequestIEs} }, + ... +} + +F1SetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE mandatory }| + { ID id-gNB-DU-Name CRITICALITY ignore TYPE GNB-DU-Name PRESENCE optional }| + { ID id-gNB-DU-Served-Cells-List CRITICALITY reject TYPE GNB-DU-Served-Cells-List PRESENCE optional }| + { ID id-GNB-DU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-CU-Name CRITICALITY ignore TYPE Extended-GNB-CU-Name PRESENCE optional }, + ... +} + + +GNB-DU-Served-Cells-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { GNB-DU-Served-Cells-ItemIEs } } + +GNB-DU-Served-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-Served-Cells-Item CRITICALITY reject TYPE GNB-DU-Served-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- F1 Setup Response +-- +-- ************************************************************** + +F1SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupResponseIEs} }, + ... +} + + +F1SetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-CU-Name CRITICALITY ignore TYPE GNB-CU-Name PRESENCE optional }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-GNB-CU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-DU-Name CRITICALITY ignore TYPE Extended-GNB-DU-Name PRESENCE optional }, + ... +} + + +Cells-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Activated-List-ItemIEs } } + +Cells-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-Cells-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-to-be-Activated-List-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- F1 Setup Failure +-- +-- ************************************************************** + +F1SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupFailureIEs} }, + ... +} + +F1SetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBDUConfigurationUpdate::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateIEs} }, + ... +} + +GNBDUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Served-Cells-To-Add-List CRITICALITY reject TYPE Served-Cells-To-Add-List PRESENCE optional }| + { ID id-Served-Cells-To-Modify-List CRITICALITY reject TYPE Served-Cells-To-Modify-List PRESENCE optional }| + { ID id-Served-Cells-To-Delete-List CRITICALITY reject TYPE Served-Cells-To-Delete-List PRESENCE optional }| + { ID id-Cells-Status-List CRITICALITY reject TYPE Cells-Status-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE optional }| + { ID id-GNB-DU-TNL-Association-To-Remove-List CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Served-Cells-To-Add-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Add-ItemIEs } } +Served-Cells-To-Modify-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Modify-ItemIEs } } +Served-Cells-To-Delete-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Delete-ItemIEs } } +Cells-Status-List ::= SEQUENCE (SIZE(0.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Status-ItemIEs } } + +Dedicated-SIDelivery-NeededUE-List::= SEQUENCE (SIZE(1.. maxnoofUEIDs)) OF ProtocolIE-SingleContainer { { Dedicated-SIDelivery-NeededUE-ItemIEs } } + +GNB-DU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-DU-TNL-Association-To-Remove-ItemIEs } } + + +Served-Cells-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Add-Item CRITICALITY reject TYPE Served-Cells-To-Add-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Modify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Modify-Item CRITICALITY reject TYPE Served-Cells-To-Modify-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Delete-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Delete-Item CRITICALITY reject TYPE Served-Cells-To-Delete-Item PRESENCE mandatory }, + ... +} + +Cells-Status-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Status-Item CRITICALITY reject TYPE Cells-Status-Item PRESENCE mandatory }, + ... +} + +Dedicated-SIDelivery-NeededUE-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Dedicated-SIDelivery-NeededUE-Item CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-Item PRESENCE mandatory }, + ... +} + +GNB-DU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-TNL-Association-To-Remove-Item CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBDUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateFailureIEs} }, + ... +} + +GNBDUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBCUConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateIEs} }, + ... +} + +GNBCUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Add-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Remove-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Update-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-List PRESENCE optional }| + { ID id-Cells-to-be-Barred-List CRITICALITY ignore TYPE Cells-to-be-Barred-List PRESENCE optional }| + { ID id-Protected-EUTRA-Resources-List CRITICALITY reject TYPE Protected-EUTRA-Resources-List PRESENCE optional }| + { ID id-Neighbour-Cell-Information-List CRITICALITY ignore TYPE Neighbour-Cell-Information-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Deactivated-List-ItemIEs } } +GNB-CU-TNL-Association-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Add-ItemIEs } } +GNB-CU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Remove-ItemIEs } } +GNB-CU-TNL-Association-To-Update-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Update-ItemIEs } } +Cells-to-be-Barred-List ::= SEQUENCE(SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Barred-ItemIEs } } + + +Cells-to-be-Deactivated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Deactivated-List-Item CRITICALITY reject TYPE Cells-to-be-Deactivated-List-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Add-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Remove-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Update-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Update-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-Item PRESENCE mandatory }, + ... +} + +Cells-to-be-Barred-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Barred-Item CRITICALITY ignore TYPE Cells-to-be-Barred-Item PRESENCE mandatory }, + ... +} + +Protected-EUTRA-Resources-List ::= SEQUENCE (SIZE(1.. maxCellineNB)) OF ProtocolIE-SingleContainer { { Protected-EUTRA-Resources-ItemIEs } } +Protected-EUTRA-Resources-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Protected-EUTRA-Resources-Item CRITICALITY reject TYPE Protected-EUTRA-Resources-Item PRESENCE mandatory}, + ... +} + +Neighbour-Cell-Information-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Neighbour-Cell-Information-ItemIEs } } +Neighbour-Cell-Information-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Neighbour-Cell-Information-Item CRITICALITY ignore TYPE Neighbour-Cell-Information-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBCUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Failed-to-be-Activated-List CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Cells-Failed-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Failed-to-be-Activated-List-ItemIEs } } +GNB-CU-TNL-Association-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Setup-ItemIEs } } +GNB-CU-TNL-Association-Failed-To-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs } } + +Cells-Failed-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Failed-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateFailureIEs} }, + ... +} + +GNBCUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION REQUEST +-- +-- ************************************************************** + +GNBDUResourceCoordinationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationRequest-IEs}}, + ... +} + +GNBDUResourceCoordinationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RequestType CRITICALITY reject TYPE RequestType PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReq-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReq-Container PRESENCE mandatory}| + { ID id-IgnoreResourceCoordinationContainer CRITICALITY reject TYPE IgnoreResourceCoordinationContainer PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION RESPONSE +-- +-- ************************************************************** + +GNBDUResourceCoordinationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationResponse-IEs}}, + ... +} + +GNBDUResourceCoordinationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReqAck-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReqAck-Container PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE Context Setup ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT SETUP REQUEST +-- +-- ************************************************************** + +UEContextSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupRequestIEs} }, + ... +} + +UEContextSetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SpCell-ID CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE mandatory }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE mandatory}| + { ID id-Candidate-SpCell-List CRITICALITY ignore TYPE Candidate-SpCell-List PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-SCell-ToBeSetup-List CRITICALITY ignore TYPE SCell-ToBeSetup-List PRESENCE optional }| + { ID id-SRBs-ToBeSetup-List CRITICALITY reject TYPE SRBs-ToBeSetup-List PRESENCE optional }| + { ID id-DRBs-ToBeSetup-List CRITICALITY reject TYPE DRBs-ToBeSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-MaskedIMEISV CRITICALITY ignore TYPE MaskedIMEISV PRESENCE optional }| + { ID id-ServingPLMN CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE conditional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-BHChannels-ToBeSetup-List CRITICALITY reject TYPE BHChannels-ToBeSetup-List PRESENCE optional }| + { ID id-ConfiguredBAPAddress CRITICALITY reject TYPE BAPAddress PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetup-List CRITICALITY reject TYPE SLDRBs-ToBeSetup-List PRESENCE optional }| + { ID id-ConditionalInterDUMobilityInformation CRITICALITY reject TYPE ConditionalInterDUMobilityInformation PRESENCE optional}| + { ID id-ManagementBasedMDTPLMNList CRITICALITY ignore TYPE MDTPLMNList PRESENCE optional }| + { ID id-ServingNID CRITICALITY reject TYPE NID PRESENCE optional }, + ... +} + +Candidate-SpCell-List::= SEQUENCE (SIZE(1..maxnoofCandidateSpCells)) OF ProtocolIE-SingleContainer { { Candidate-SpCell-ItemIEs} } +SCell-ToBeSetup-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetup-ItemIEs} } +SRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetup-ItemIEs} } +DRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetup-ItemIEs} } +BHChannels-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetup-ItemIEs} } +SLDRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetup-ItemIEs} } + +Candidate-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Candidate-SpCell-Item CRITICALITY ignore TYPE Candidate-SpCell-Item PRESENCE mandatory }, + ... +} + + +SCell-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetup-Item CRITICALITY ignore TYPE SCell-ToBeSetup-Item PRESENCE mandatory }, + ... +} + +SRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetup-Item CRITICALITY reject TYPE SRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetup-Item CRITICALITY reject TYPE DRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetup-Item CRITICALITY reject TYPE BHChannels-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetup-Item CRITICALITY reject TYPE SLDRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP RESPONSE +-- +-- ************************************************************** + +UEContextSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupResponseIEs} }, + ... +} + + +UEContextSetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-DRBs-Setup-List CRITICALITY ignore TYPE DRBs-Setup-List PRESENCE optional }| + { ID id-SRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetup-List CRITICALITY ignore TYPE DRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-SCell-FailedtoSetup-List CRITICALITY ignore TYPE SCell-FailedtoSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-SRBs-Setup-List CRITICALITY ignore TYPE SRBs-Setup-List PRESENCE optional }| + { ID id-BHChannels-Setup-List CRITICALITY ignore TYPE BHChannels-Setup-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeSetup-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-List PRESENCE optional }| + { ID id-SLDRBs-Setup-List CRITICALITY ignore TYPE SLDRBs-Setup-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +DRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Setup-ItemIEs} } + + +SRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetup-ItemIEs} } +DRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetup-ItemIEs} } +SCell-FailedtoSetup-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetup-ItemIEs} } +SRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Setup-ItemIEs} } +BHChannels-Setup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Setup-ItemIEs} } +BHChannels-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetup-ItemIEs} } + +DRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Setup-Item CRITICALITY ignore TYPE DRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Setup-Item CRITICALITY ignore TYPE SRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetup-Item CRITICALITY ignore TYPE SCell-FailedtoSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Setup-Item CRITICALITY ignore TYPE BHChannels-Setup-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetup-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Setup-ItemIEs} } + +SLDRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetup-ItemIEs} } + +SLDRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Setup-Item CRITICALITY ignore TYPE SLDRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP FAILURE +-- +-- ************************************************************** + +UEContextSetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupFailureIEs} }, + ... +} + +UEContextSetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Potential-SpCell-List CRITICALITY ignore TYPE Potential-SpCell-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +Potential-SpCell-List::= SEQUENCE (SIZE(0..maxnoofPotentialSpCells)) OF ProtocolIE-SingleContainer { { Potential-SpCell-ItemIEs} } + +Potential-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Potential-SpCell-Item CRITICALITY ignore TYPE Potential-SpCell-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Request ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Release Request +-- +-- ************************************************************** + +UEContextReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEContextReleaseRequestIEs}}, + ... +} + +UEContextReleaseRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Release (gNB-CU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMMAND +-- +-- ************************************************************** + +UEContextReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCommandIEs} }, + ... +} + +UEContextReleaseCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE conditional }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMPLETE +-- +-- ************************************************************** + +UEContextReleaseComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCompleteIEs} }, + ... +} + + +UEContextReleaseCompleteIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE Context Modification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUEST +-- +-- ************************************************************** + +UEContextModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequestIEs} }, + ... +} + +UEContextModificationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SpCell-ID CRITICALITY ignore TYPE NRCGI PRESENCE optional }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE optional }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE optional }| + { ID id-TransmissionActionIndicator CRITICALITY ignore TYPE TransmissionActionIndicator PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-RRCReconfigurationCompleteIndicator CRITICALITY ignore TYPE RRCReconfigurationCompleteIndicator PRESENCE optional }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE optional }| + { ID id-SCell-ToBeSetupMod-List CRITICALITY ignore TYPE SCell-ToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-ToBeRemoved-List CRITICALITY ignore TYPE SCell-ToBeRemoved-List PRESENCE optional }| + { ID id-SRBs-ToBeSetupMod-List CRITICALITY reject TYPE SRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeSetupMod-List CRITICALITY reject TYPE DRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeModified-List CRITICALITY reject TYPE DRBs-ToBeModified-List PRESENCE optional }| + { ID id-SRBs-ToBeReleased-List CRITICALITY reject TYPE SRBs-ToBeReleased-List PRESENCE optional }| + { ID id-DRBs-ToBeReleased-List CRITICALITY reject TYPE DRBs-ToBeReleased-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-DRXConfigurationIndicator CRITICALITY ignore TYPE DRXConfigurationIndicator PRESENCE optional }| + { ID id-RLCFailureIndication CRITICALITY ignore TYPE RLCFailureIndication PRESENCE optional }| + { ID id-UplinkTxDirectCurrentListInformation CRITICALITY ignore TYPE UplinkTxDirectCurrentListInformation PRESENCE optional }| + { ID id-GNB-DUConfigurationQuery CRITICALITY reject TYPE GNB-DUConfigurationQuery PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-NeedforGap CRITICALITY ignore TYPE NeedforGap PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-LowerLayerPresenceStatusChange CRITICALITY ignore TYPE LowerLayerPresenceStatusChange PRESENCE optional }| + { ID id-BHChannels-ToBeSetupMod-List CRITICALITY reject TYPE BHChannels-ToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-ToBeModified-List CRITICALITY reject TYPE BHChannels-ToBeModified-List PRESENCE optional }| + { ID id-BHChannels-ToBeReleased-List CRITICALITY reject TYPE BHChannels-ToBeReleased-List PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetupMod-List CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-ToBeModified-List CRITICALITY reject TYPE SLDRBs-ToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-ToBeReleased-List PRESENCE optional }| + { ID id-ConditionalIntraDUMobilityInformation CRITICALITY reject TYPE ConditionalIntraDUMobilityInformation PRESENCE optional}, + ... +} + +SCell-ToBeSetupMod-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetupMod-ItemIEs} } +SCell-ToBeRemoved-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeRemoved-ItemIEs} } +SRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetupMod-ItemIEs} } +DRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetupMod-ItemIEs} } +BHChannels-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetupMod-ItemIEs} } + +DRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeModified-ItemIEs} } +BHChannels-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeModified-ItemIEs} } +SRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeReleased-ItemIEs} } +DRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeReleased-ItemIEs} } +BHChannels-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeReleased-ItemIEs} } + +SCell-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetupMod-Item CRITICALITY ignore TYPE SCell-ToBeSetupMod-Item PRESENCE mandatory }, + ... +} + +SCell-ToBeRemoved-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeRemoved-Item CRITICALITY ignore TYPE SCell-ToBeRemoved-Item PRESENCE mandatory }, + ... +} + + +SRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetupMod-Item CRITICALITY reject TYPE DRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeModified-Item CRITICALITY reject TYPE DRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + + +SRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeReleased-Item CRITICALITY reject TYPE SRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeReleased-Item CRITICALITY reject TYPE DRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetupMod-Item CRITICALITY reject TYPE BHChannels-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeModified-Item CRITICALITY reject TYPE BHChannels-ToBeModified-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetupMod-ItemIEs} } +SLDRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeModified-ItemIEs} } +SLDRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeReleased-ItemIEs} } + +SLDRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION RESPONSE +-- +-- ************************************************************** + +UEContextModificationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationResponseIEs} }, + ... +} + + +UEContextModificationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-SetupMod-List CRITICALITY ignore TYPE DRBs-SetupMod-List PRESENCE optional}| + { ID id-DRBs-Modified-List CRITICALITY ignore TYPE DRBs-Modified-List PRESENCE optional}| + { ID id-SRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-FailedtoSetupMod-List CRITICALITY ignore TYPE SCell-FailedtoSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeModified-List CRITICALITY ignore TYPE DRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-Associated-SCell-List CRITICALITY ignore TYPE Associated-SCell-List PRESENCE optional }| + { ID id-SRBs-SetupMod-List CRITICALITY ignore TYPE SRBs-SetupMod-List PRESENCE optional }| + { ID id-SRBs-Modified-List CRITICALITY ignore TYPE SRBs-Modified-List PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-BHChannels-SetupMod-List CRITICALITY ignore TYPE BHChannels-SetupMod-List PRESENCE optional}| + { ID id-BHChannels-Modified-List CRITICALITY ignore TYPE BHChannels-Modified-List PRESENCE optional}| + { ID id-BHChannels-FailedToBeSetupMod-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeModified-List CRITICALITY ignore TYPE BHChannels-FailedToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-SetupMod-List CRITICALITY ignore TYPE SLDRBs-SetupMod-List PRESENCE optional }| + { ID id-SLDRBs-Modified-List CRITICALITY ignore TYPE SLDRBs-Modified-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeModified-List CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +DRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-SetupMod-ItemIEs} } +DRBs-Modified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Modified-ItemIEs } } +SRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-SetupMod-ItemIEs} } +SRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Modified-ItemIEs } } +DRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeModified-ItemIEs} } +SRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetupMod-ItemIEs} } +DRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetupMod-ItemIEs} } +SCell-FailedtoSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetupMod-ItemIEs} } +BHChannels-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-SetupMod-ItemIEs} } +BHChannels-Modified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Modified-ItemIEs } } +BHChannels-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeModified-ItemIEs} } +BHChannels-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetupMod-ItemIEs} } + +Associated-SCell-List ::= SEQUENCE (SIZE(1.. maxnoofSCells)) OF ProtocolIE-SingleContainer { { Associated-SCell-ItemIEs} } + +DRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-SetupMod-Item CRITICALITY ignore TYPE DRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Modified-Item CRITICALITY ignore TYPE DRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-SetupMod-Item CRITICALITY ignore TYPE SRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +SRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Modified-Item CRITICALITY ignore TYPE SRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeModified-Item CRITICALITY ignore TYPE DRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetupMod-Item CRITICALITY ignore TYPE SCell-FailedtoSetupMod-Item PRESENCE mandatory}, + ... +} + +Associated-SCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Associated-SCell-Item CRITICALITY ignore TYPE Associated-SCell-Item PRESENCE mandatory}, + ... +} + +BHChannels-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-SetupMod-Item CRITICALITY ignore TYPE BHChannels-SetupMod-Item PRESENCE mandatory}, + ... +} + + +BHChannels-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Modified-Item CRITICALITY ignore TYPE BHChannels-Modified-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetupMod-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeModified-Item CRITICALITY ignore TYPE BHChannels-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-SetupMod-ItemIEs} } +SLDRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Modified-ItemIEs } } +SLDRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeModified-ItemIEs} } +SLDRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetupMod-ItemIEs} } + +SLDRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-SetupMod-Item CRITICALITY ignore TYPE SLDRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Modified-Item CRITICALITY ignore TYPE SLDRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeModified-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION FAILURE +-- +-- ************************************************************** + +UEContextModificationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationFailureIEs} }, + ... +} + +UEContextModificationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- UE Context Modification Required (gNB-DU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUIRED +-- +-- ************************************************************** + +UEContextModificationRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequiredIEs} }, + ... +} + +UEContextModificationRequiredIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-Required-ToBeModified-List CRITICALITY reject TYPE DRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-DRBs-Required-ToBeReleased-List CRITICALITY reject TYPE DRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-BHChannels-Required-ToBeReleased-List CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeModified-List CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +DRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeModified-ItemIEs } } +DRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeReleased-ItemIEs } } + +SRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Required-ToBeReleased-ItemIEs } } + +BHChannels-Required-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Required-ToBeReleased-ItemIEs } } + +DRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeModified-Item CRITICALITY reject TYPE DRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +DRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE DRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Required-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeModified-ItemIEs } } +SLDRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeReleased-ItemIEs } } + +SLDRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION CONFIRM +-- +-- ************************************************************** + +UEContextModificationConfirm::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationConfirmIEs} }, + ... +} + + +UEContextModificationConfirmIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DRBs-ModifiedConf-List CRITICALITY ignore TYPE DRBs-ModifiedConf-List PRESENCE optional}| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-SLDRBs-ModifiedConf-List CRITICALITY ignore TYPE SLDRBs-ModifiedConf-List PRESENCE optional}, + ... +} + +DRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ModifiedConf-ItemIEs } } + +DRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ModifiedConf-Item CRITICALITY ignore TYPE DRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ModifiedConf-ItemIEs } } + +SLDRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ModifiedConf-Item CRITICALITY ignore TYPE SLDRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REFUSE +-- +-- ************************************************************** + +UEContextModificationRefuse::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRefuseIEs} }, + ... +} + + +UEContextModificationRefuseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- WRITE-REPLACE WARNING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Write-Replace Warning Request +-- +-- ************************************************************** + +WriteReplaceWarningRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningRequestIEs} }, + ... +} + +WriteReplaceWarningRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWSSystemInformation CRITICALITY reject TYPE PWSSystemInformation PRESENCE mandatory }| + { ID id-RepetitionPeriod CRITICALITY reject TYPE RepetitionPeriod PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Cells-To-Be-Broadcast-List CRITICALITY reject TYPE Cells-To-Be-Broadcast-List PRESENCE optional }, + ... +} + +Cells-To-Be-Broadcast-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-To-Be-Broadcast-List-ItemIEs } } + +Cells-To-Be-Broadcast-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-To-Be-Broadcast-Item CRITICALITY reject TYPE Cells-To-Be-Broadcast-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Write-Replace Warning Response +-- +-- ************************************************************** + +WriteReplaceWarningResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningResponseIEs} }, + ... +} + +WriteReplaceWarningResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Completed-List CRITICALITY reject TYPE Cells-Broadcast-Completed-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }, + ... +} + +Cells-Broadcast-Completed-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Completed-List-ItemIEs } } + +Cells-Broadcast-Completed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Completed-Item CRITICALITY reject TYPE Cells-Broadcast-Completed-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- PWS CANCEL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Cancel Request +-- +-- ************************************************************** + +PWSCancelRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelRequestIEs} }, + ... +} + +PWSCancelRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Broadcast-To-Be-Cancelled-List CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-List PRESENCE optional }| + { ID id-Cancel-all-Warning-Messages-Indicator CRITICALITY reject TYPE Cancel-all-Warning-Messages-Indicator PRESENCE optional }| + { ID id-NotificationInformation CRITICALITY reject TYPE NotificationInformation PRESENCE optional}, + ... +} + +Broadcast-To-Be-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Broadcast-To-Be-Cancelled-List-ItemIEs } } + +Broadcast-To-Be-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Broadcast-To-Be-Cancelled-Item CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS Cancel Response +-- +-- ************************************************************** + +PWSCancelResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelResponseIEs} }, + ... +} + +PWSCancelResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Cancelled-List CRITICALITY reject TYPE Cells-Broadcast-Cancelled-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +Cells-Broadcast-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Cancelled-List-ItemIEs } } + +Cells-Broadcast-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Cancelled-Item CRITICALITY reject TYPE Cells-Broadcast-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Inactivity Notification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Inactivity Notification +-- +-- ************************************************************** + +UEInactivityNotification ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEInactivityNotificationIEs}}, + ... +} + +UEInactivityNotificationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Activity-List CRITICALITY reject TYPE DRB-Activity-List PRESENCE mandatory } , + ... +} + +DRB-Activity-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Activity-ItemIEs } } + +DRB-Activity-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Activity-Item CRITICALITY reject TYPE DRB-Activity-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- Initial UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- INITIAL UL RRC Message Transfer +-- +-- ************************************************************** + +InitialULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ InitialULRRCMessageTransferIEs}}, + ... +} + +InitialULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY reject TYPE C-RNTI PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-DUtoCURRCContainer CRITICALITY reject TYPE DUtoCURRCContainer PRESENCE optional }| + { ID id-SULAccessIndication CRITICALITY ignore TYPE SULAccessIndication PRESENCE optional }| + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-RRCContainer-RRCSetupComplete CRITICALITY ignore TYPE RRCContainer-RRCSetupComplete PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- DL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DL RRC Message Transfer +-- +-- ************************************************************** + +DLRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DLRRCMessageTransferIEs}}, + ... +} + +DLRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-UEContextNotRetrievable CRITICALITY reject TYPE UEContextNotRetrievable PRESENCE optional }| + { ID id-RedirectedRRCmessage CRITICALITY reject TYPE OCTET STRING PRESENCE optional }| + { ID id-PLMNAssistanceInfoForNetShar CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UL RRC Message Transfer +-- +-- ************************************************************** + +ULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ULRRCMessageTransferIEs}}, + ... +} + +ULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-SelectedPLMNID CRITICALITY reject TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- PRIVATE MESSAGE +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessage-IEs}}, + ... +} + +PrivateMessage-IEs F1AP-PRIVATE-IES ::= { + ... +} + + +-- ************************************************************** +-- +-- System Information ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- System information Delivery Command +-- +-- ************************************************************** + +SystemInformationDeliveryCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ SystemInformationDeliveryCommandIEs}}, + ... +} + +SystemInformationDeliveryCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-SItype-List CRITICALITY reject TYPE SItype-List PRESENCE mandatory }| + { ID id-ConfirmedUEID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Paging PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Paging +-- +-- ************************************************************** + +Paging ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PagingIEs}}, + ... +} + +PagingIEs F1AP-PROTOCOL-IES ::= { + { ID id-UEIdentityIndexValue CRITICALITY reject TYPE UEIdentityIndexValue PRESENCE mandatory }| + { ID id-PagingIdentity CRITICALITY reject TYPE PagingIdentity PRESENCE mandatory }| + { ID id-PagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE optional }| + { ID id-PagingPriority CRITICALITY ignore TYPE PagingPriority PRESENCE optional }| + { ID id-PagingCell-List CRITICALITY ignore TYPE PagingCell-list PRESENCE mandatory }| + { ID id-PagingOrigin CRITICALITY ignore TYPE PagingOrigin PRESENCE optional }, + ... +} + +PagingCell-list::= SEQUENCE (SIZE(1.. maxnoofPagingCells)) OF ProtocolIE-SingleContainer { { PagingCell-ItemIEs } } + +PagingCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PagingCell-Item CRITICALITY ignore TYPE PagingCell-Item PRESENCE mandatory} , + ... +} + + + +-- ************************************************************** +-- +-- Notify +-- +-- ************************************************************** + +Notify ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NotifyIEs}}, + ... +} + +NotifyIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Notify-List CRITICALITY reject TYPE DRB-Notify-List PRESENCE mandatory }, + ... +} + +DRB-Notify-List::= SEQUENCE (SIZE(1.. maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Notify-ItemIEs } } + +DRB-Notify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Notify-Item CRITICALITY reject TYPE DRB-Notify-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- NETWORK ACCESS RATE REDUCTION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Network Access Rate Reduction +-- +-- ************************************************************** + +NetworkAccessRateReduction ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NetworkAccessRateReductionIEs }}, + ... +} + +NetworkAccessRateReductionIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UAC-Assistance-Info CRITICALITY reject TYPE UAC-Assistance-Info PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS RESTART INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Restart Indication +-- +-- ************************************************************** + +PWSRestartIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSRestartIndicationIEs} }, + ... +} + +PWSRestartIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NR-CGI-List-For-Restart-List CRITICALITY reject TYPE NR-CGI-List-For-Restart-List PRESENCE mandatory }, + ... +} + +NR-CGI-List-For-Restart-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { NR-CGI-List-For-Restart-List-ItemIEs } } + +NR-CGI-List-For-Restart-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-NR-CGI-List-For-Restart-Item CRITICALITY reject TYPE NR-CGI-List-For-Restart-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Failure Indication +-- +-- ************************************************************** + +PWSFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSFailureIndicationIEs} }, + ... +} + +PWSFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWS-Failed-NR-CGI-List CRITICALITY reject TYPE PWS-Failed-NR-CGI-List PRESENCE optional }, + ... +} + +PWS-Failed-NR-CGI-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { PWS-Failed-NR-CGI-List-ItemIEs } } + +PWS-Failed-NR-CGI-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PWS-Failed-NR-CGI-Item CRITICALITY reject TYPE PWS-Failed-NR-CGI-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- gNB-DU STATUS INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- gNB-DU Status Indication +-- +-- ************************************************************** + +GNBDUStatusIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUStatusIndicationIEs} }, + ... +} + +GNBDUStatusIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-GNBDUOverloadInformation CRITICALITY reject TYPE GNBDUOverloadInformation PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- RRC Delivery Report ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- RRC Delivery Report +-- +-- ************************************************************** + +RRCDeliveryReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ RRCDeliveryReportIEs}}, + ... +} + +RRCDeliveryReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RRCDeliveryStatus CRITICALITY ignore TYPE RRCDeliveryStatus PRESENCE mandatory }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Removal Request +-- +-- ************************************************************** + +F1RemovalRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalRequestIEs }}, + ... +} + +F1RemovalRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal Response +-- +-- ************************************************************** + +F1RemovalResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalResponseIEs }}, + ... +} + +F1RemovalResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + +-- ************************************************************** +-- +-- F1 Removal Failure +-- +-- ************************************************************** + +F1RemovalFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalFailureIEs }}, + ... +} + +F1RemovalFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + + +-- ************************************************************** +-- +-- TRACE ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRACE START +-- +-- ************************************************************** + +TraceStart ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {TraceStartIEs} }, + ... +} + +TraceStartIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- DEACTIVATE TRACE +-- +-- ************************************************************** + +DeactivateTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {DeactivateTraceIEs} }, + ... +} + +DeactivateTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- CELL TRAFFIC TRACE +-- +-- ************************************************************** + +CellTrafficTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {CellTrafficTraceIEs} }, + ... +} + +CellTrafficTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + {ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }| + {ID id-TraceCollectionEntityIPAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE mandatory }| + {ID id-PrivacyIndicator CRITICALITY ignore TYPE PrivacyIndicator PRESENCE optional }| + + {ID id-TraceCollectionEntityURI CRITICALITY ignore TYPE URI-address PRESENCE optional }, + ... + +} + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer +-- +-- ************************************************************** + +DUCURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DUCURadioInformationTransferIEs}}, + ... +} + +DUCURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-DUCURadioInformationType CRITICALITY ignore TYPE DUCURadioInformationType PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer +-- +-- ************************************************************** + +CUDURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ CUDURadioInformationTransferIEs}}, + ... +} + +CUDURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CUDURadioInformationType CRITICALITY ignore TYPE CUDURadioInformationType PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- IAB PROCEDURES +-- +-- ************************************************************** +-- ************************************************************** +-- +-- BAP Mapping Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION +-- ************************************************************** + + +BAPMappingConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfiguration-IEs} }, + ... + } + +BAPMappingConfiguration-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-BH-Routing-Information-Added-List CRITICALITY ignore TYPE BH-Routing-Information-Added-List PRESENCE optional}| + { ID id-BH-Routing-Information-Removed-List CRITICALITY ignore TYPE BH-Routing-Information-Removed-List PRESENCE optional}| + { ID id-TrafficMappingInformation CRITICALITY ignore TYPE TrafficMappingInfo PRESENCE optional}, + ... +} + +BH-Routing-Information-Added-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Added-List-ItemIEs } } +BH-Routing-Information-Removed-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Removed-List-ItemIEs } } + +BH-Routing-Information-Added-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Added-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Added-List-Item PRESENCE optional}, + ... +} + +BH-Routing-Information-Removed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Removed-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Removed-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + +BAPMappingConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfigurationAcknowledge-IEs} }, + ... +} + +BAPMappingConfigurationAcknowledge-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- GNB-DU Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION +-- ************************************************************** + + +GNBDUResourceConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ GNBDUResourceConfigurationIEs}}, + ... +} + + +GNBDUResourceConfigurationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Activated-Cells-to-be-Updated-List CRITICALITY reject TYPE Activated-Cells-to-be-Updated-List PRESENCE optional}| + { ID id-Child-Nodes-List CRITICALITY reject TYPE Child-Nodes-List PRESENCE optional}, + ... +} + + + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + + +GNBDUResourceConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBDUResourceConfigurationAcknowledgeIEs} }, + ... +} + + +GNBDUResourceConfigurationAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- IAB TNL Address Allocation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB TNL ADDRESS REQUEST +-- ************************************************************** + + + +IABTNLAddressRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressRequestIEs} }, + ... +} + +IABTNLAddressRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IABv4AddressesRequested CRITICALITY reject TYPE IABv4AddressesRequested PRESENCE optional }| + { ID id-IABIPv6RequestType CRITICALITY reject TYPE IABIPv6RequestType PRESENCE optional }| + { ID id-IAB-TNL-Addresses-To-Remove-List CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-List PRESENCE optional }, + ... +} + + +IAB-TNL-Addresses-To-Remove-List ::= SEQUENCE (SIZE(1..maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-TNL-Addresses-To-Remove-ItemIEs } } + +IAB-TNL-Addresses-To-Remove-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-TNL-Addresses-To-Remove-Item CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- IAB TNL ADDRESS RESPONSE +-- ************************************************************** + + +IABTNLAddressResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressResponseIEs} }, + ... +} + + +IABTNLAddressResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IAB-Allocated-TNL-Address-List CRITICALITY reject TYPE IAB-Allocated-TNL-Address-List PRESENCE mandatory }, + ... +} + + +IAB-Allocated-TNL-Address-List ::= SEQUENCE (SIZE(1.. maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-Allocated-TNL-Address-List-ItemIEs } } + + +IAB-Allocated-TNL-Address-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-Allocated-TNL-Address-Item CRITICALITY reject TYPE IAB-Allocated-TNL-Address-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB UP Configuration Update Request +-- +-- ************************************************************** + +IABUPConfigurationUpdateRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateRequestIEs} }, + ... +} + +IABUPConfigurationUpdateRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UL-UP-TNL-Information-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List PRESENCE optional }| + { ID id-UL-UP-TNL-Address-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +UL-UP-TNL-Information-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofULUPTNLInformationforIAB)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Information-to-Update-List-ItemIEs } } + +UL-UP-TNL-Information-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Information-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List-Item PRESENCE optional}, + ... +} + +UL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Address-to-Update-List-ItemIEs } } + +UL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- IAB UP Configuration Update Response +-- +-- ************************************************************** + +IABUPConfigurationUpdateResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateResponseIEs} }, + ... +} + +IABUPConfigurationUpdateResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-DL-UP-TNL-Address-to-Update-List CRITICALITY reject TYPE DL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +DL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { DL-UP-TNL-Address-to-Update-List-ItemIEs } } + +DL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE DL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update Failure +-- +-- ************************************************************** + +IABUPConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateFailureIEs} }, + ... +} + +IABUPConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting Initiation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Request +-- +-- ************************************************************** + +ResourceStatusRequest::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResourceStatusRequestIEs} }, + ... +} + +ResourceStatusRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE conditional }| + { ID id-RegistrationRequest CRITICALITY ignore TYPE RegistrationRequest PRESENCE mandatory }| + { ID id-ReportCharacteristics CRITICALITY ignore TYPE ReportCharacteristics PRESENCE conditional }| + { ID id-CellToReportList CRITICALITY ignore TYPE CellToReportList PRESENCE optional }| + { ID id-ReportingPeriodicity CRITICALITY ignore TYPE ReportingPeriodicity PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Response +-- +-- ************************************************************** + +ResourceStatusResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusResponseIEs} }, + ... +} + + +ResourceStatusResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Failure +-- +-- ************************************************************** + +ResourceStatusFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusFailureIEs} }, + ... +} + +ResourceStatusFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Update +-- +-- ************************************************************** + +ResourceStatusUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ResourceStatusUpdateIEs}}, + ... +} + +ResourceStatusUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-HardwareLoadIndicator CRITICALITY ignore TYPE HardwareLoadIndicator PRESENCE optional }| + { ID id-TNLCapacityIndicator CRITICALITY ignore TYPE TNLCapacityIndicator PRESENCE optional }| + { ID id-CellMeasurementResultList CRITICALITY ignore TYPE CellMeasurementResultList PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Access And Mobility Indication ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Access And Mobility Indication +-- +-- ************************************************************** + +AccessAndMobilityIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { AccessAndMobilityIndicationIEs} }, + ... +} + +AccessAndMobilityIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RACHReportInformationList CRITICALITY ignore TYPE RACHReportInformationList PRESENCE optional }| + { ID id-RLFReportInformationList CRITICALITY ignore TYPE RLFReportInformationList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORTING CONTROL +-- +-- ************************************************************** + +ReferenceTimeInformationReportingControl::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportingControlIEs} }, + ... +} + +ReferenceTimeInformationReportingControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-ReportingRequestType CRITICALITY reject TYPE ReportingRequestType PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORT +-- +-- ************************************************************** + +ReferenceTimeInformationReport::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportIEs} }, + ... +} + +ReferenceTimeInformationReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-TimeReferenceInformation CRITICALITY ignore TYPE TimeReferenceInformation PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Access Success +-- +-- ************************************************************** + +AccessSuccess ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ AccessSuccessIEs}}, + ... +} + +AccessSuccessIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION CONTROL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Control +-- +-- ************************************************************** + +PositioningAssistanceInformationControl ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationControlIEs}}, + ... +} + +PositioningAssistanceInformationControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistance-Information CRITICALITY reject TYPE PosAssistance-Information PRESENCE optional}| + { ID id-PosBroadcast CRITICALITY reject TYPE PosBroadcast PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION FEEDBACK ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Feedback +-- +-- ************************************************************** + +PositioningAssistanceInformationFeedback ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationFeedbackIEs}}, + ... +} + +PositioningAssistanceInformationFeedbackIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistanceInformationFailureList CRITICALITY reject TYPE PosAssistanceInformationFailureList PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITONING MEASUREMENT EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Request +-- +-- ************************************************************** + +PositioningMeasurementRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementRequestIEs} }, + ... +} + +PositioningMeasurementRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-TRP-MeasurementRequestList CRITICALITY reject TYPE TRP-MeasurementRequestList PRESENCE mandatory}| + { ID id-PosReportCharacteristics CRITICALITY reject TYPE PosReportCharacteristics PRESENCE mandatory}| + { ID id-PosMeasurementPeriodicity CRITICALITY reject TYPE PosMeasurementPeriodicity PRESENCE conditional }| + -- The above IE shall be present if the PosReportCharacteristics IE is set to “periodic” -- + { ID id-PosMeasurementQuantities CRITICALITY reject TYPE PosMeasurementQuantities PRESENCE mandatory}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-MeasurementBeamInfoRequest CRITICALITY ignore TYPE MeasurementBeamInfoRequest PRESENCE optional }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional}| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Response +-- +-- ************************************************************** + +PositioningMeasurementResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementResponseIEs} }, + ... +} + + +PositioningMeasurementResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Failure +-- +-- ************************************************************** + +PositioningMeasurementFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIEs} }, + ... +} + +PositioningMeasurementFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT REPORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Report +-- +-- ************************************************************** + +PositioningMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementReportIEs} }, + ... +} + +PositioningMeasurementReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT ABORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Abort +-- +-- ************************************************************** + +PositioningMeasurementAbort ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementAbortIEs} }, + ... +} + +PositioningMeasurementAbortIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Failure Indication +-- +-- ************************************************************** + +PositioningMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIndicationIEs} }, + ... +} + +PositioningMeasurementFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Update +-- +-- ************************************************************** + +PositioningMeasurementUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementUpdateIEs} }, + ... +} + +PositioningMeasurementUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- TRP INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRP Information Request +-- +-- ************************************************************** + +TRPInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationRequestIEs} }, + ... +} + +TRPInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPList CRITICALITY ignore TYPE TRPList PRESENCE optional }| + { ID id-TRPInformationTypeListTRPReq CRITICALITY reject TYPE TRPInformationTypeListTRPReq PRESENCE mandatory }, + ... +} + +TRPInformationTypeListTRPReq ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF ProtocolIE-SingleContainer { { TRPInformationTypeItemTRPReq } } + +TRPInformationTypeItemTRPReq F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationTypeItem CRITICALITY reject TYPE TRPInformationTypeItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Response +-- +-- ************************************************************** + +TRPInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationResponseIEs} }, + ... +} + +TRPInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPInformationListTRPResp CRITICALITY ignore TYPE TRPInformationListTRPResp PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +TRPInformationListTRPResp ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF ProtocolIE-SingleContainer { { TRPInformationItemTRPResp } } + +TRPInformationItemTRPResp F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationItem CRITICALITY ignore TYPE TRPInformationItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Failure +-- +-- ************************************************************** + +TRPInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationFailureIEs} }, + ... +} + +TRPInformationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Request +-- +-- ************************************************************** + +PositioningInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationRequestIEs} }, + ... +} + +PositioningInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RequestedSRSTransmissionCharacteristics CRITICALITY ignore TYPE RequestedSRSTransmissionCharacteristics PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Response +-- +-- ************************************************************** + +PositioningInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationResponseIEs} }, + ... +} + + +PositioningInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Failure +-- +-- ************************************************************** + +PositioningInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationFailureIEs} }, + ... +} + +PositioningInformationFailureIEs F1AP-PROTOCOL-IES ::= { + + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Activation Request +-- +-- ************************************************************** + +PositioningActivationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationRequestIEs} }, + ... +} + +PositioningActivationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSType CRITICALITY reject TYPE SRSType PRESENCE mandatory }| + { ID id-ActivationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }, + ... +} + +SRSType ::= CHOICE { + semipersistentSRS SemipersistentSRS, + aperiodicSRS AperiodicSRS, + choice-extension ProtocolIE-SingleContainer { { SRSType-ExtIEs} } +} + +SRSType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SemipersistentSRS ::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSSpatialRelation SRSSpatialRelation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SemipersistentSRS-ExtIEs} } OPTIONAL, + ... +} + +SemipersistentSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AperiodicSRS ::= SEQUENCE { + aperiodic ENUMERATED {true, ...}, + sRSResourceTrigger SRSResourceTrigger OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AperiodicSRS-ExtIEs} } OPTIONAL, + ... +} + +AperiodicSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- Positioning Activation Response +-- +-- ************************************************************** + +PositioningActivationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationResponseIEs} }, + ... +} + + +PositioningActivationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional }| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + + + +-- ************************************************************** +-- +-- Positioning Activation Failure +-- +-- ************************************************************** + +PositioningActivationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationFailureIEs} }, + ... +} + +PositioningActivationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING DEACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Deactivation +-- +-- ************************************************************** + +PositioningDeactivation ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningDeactivationIEs} }, + ... +} + +PositioningDeactivationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-AbortTransmission CRITICALITY ignore TYPE AbortTransmission PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING INFORMATION UPDATE PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Update +-- +-- ************************************************************** + +PositioningInformationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationUpdateIEs} }, + ... +} + + +PositioningInformationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Request +-- +-- ************************************************************** + +E-CIDMeasurementInitiationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationRequest-IEs}}, + ... +} + +E-CIDMeasurementInitiationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-ReportCharacteristics CRITICALITY reject TYPE E-CID-ReportCharacteristics PRESENCE mandatory }| + { ID id-E-CID-MeasurementPeriodicity CRITICALITY reject TYPE E-CID-MeasurementPeriodicity PRESENCE conditional }| +-- The above IE shall be present if the E-CID-ReportCharacteristics IE is set to “periodic” –- + { ID id-E-CID-MeasurementQuantities CRITICALITY reject TYPE E-CID-MeasurementQuantities PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Response +-- +-- ************************************************************** + +E-CIDMeasurementInitiationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationResponse-IEs}}, + ... +} + +E-CIDMeasurementInitiationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE optional}| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Failure +-- +-- ************************************************************** + +E-CIDMeasurementInitiationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationFailure-IEs}}, + ... +} + + +E-CIDMeasurementInitiationFailure-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT FAILURE INDICATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Failure Indication +-- +-- ************************************************************** + +E-CIDMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementFailureIndication-IEs}}, + ... +} + + +E-CIDMeasurementFailureIndication-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT REPORT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Report +-- +-- ************************************************************** + +E-CIDMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementReport-IEs}}, + ... +} + + +E-CIDMeasurementReport-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE mandatory }| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}, + + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT TERMINATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Termination Command +-- +-- ************************************************************** + + +E-CIDMeasurementTerminationCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementTerminationCommand-IEs}}, + ... +} + + +E-CIDMeasurementTerminationCommand-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }, + ... +} + + + +END +-- ASN1STOP + + +-- ASN1START +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +F1AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + id-gNB-CUSystemInformation, + id-HandoverPreparationInformation, + id-TAISliceSupportList, + id-RANAC, + id-BearerTypeChange, + id-Cell-Direction, + id-Cell-Type, + id-CellGroupConfig, + id-AvailablePLMNList, + id-PDUSessionID, + id-ULPDUSessionAggregateMaximumBitRate, + id-DC-Based-Duplication-Configured, + id-DC-Based-Duplication-Activation, + id-Duplication-Activation, + id-DLPDCPSNLength, + id-ULPDCPSNLength, + id-RLC-Status, + id-MeasurementTimingConfiguration, + id-DRB-Information, + id-QoSFlowMappingIndication, + id-ServingCellMO, + id-RLCMode, + id-ExtendedServedPLMNs-List, + id-ExtendedAvailablePLMN-List, + id-DRX-LongCycleStartOffset, + id-SelectedBandCombinationIndex, + id-SelectedFeatureSetEntryIndex, + id-Ph-InfoSCG, + id-latest-RRC-Version-Enhanced, + id-RequestedBandCombinationIndex, + id-RequestedFeatureSetEntryIndex, + id-DRX-Config, + id-UEAssistanceInformation, + id-PDCCH-BlindDetectionSCG, + id-Requested-PDCCH-BlindDetectionSCG, + id-BPLMN-ID-Info-List, + id-NotificationInformation, + id-TNLAssociationTransportLayerAddressgNBDU, + id-portNumber, + id-AdditionalSIBMessageList, + id-IgnorePRACHConfiguration, + id-CG-Config, + id-Ph-InfoMCG, + id-AggressorgNBSetID, + id-VictimgNBSetID, + id-MeasGapSharingConfig, + id-systemInformationAreaID, + id-areaScope, + id-IntendedTDD-DL-ULConfig, + id-QosMonitoringRequest, + id-BHInfo, + id-IAB-Info-IAB-DU, + id-IAB-Info-IAB-donor-CU, + id-IAB-Barred, + id-SIB12-message, + id-SIB13-message, + id-SIB14-message, + id-UEAssistanceInformationEUTRA, + id-SL-PHY-MAC-RLC-Config, + id-SL-ConfigDedicatedEUTRA, + id-AlternativeQoSParaSetList, + id-CurrentQoSParaSetIndex, + id-CarrierList, + id-ULCarrierList, + id-FrequencyShift7p5khz, + id-SSB-PositionsInBurst, + id-NRPRACHConfig, + id-TDD-UL-DLConfigCommonNR, + id-CNPacketDelayBudgetDownlink, + id-CNPacketDelayBudgetUplink, + id-ExtendedPacketDelayBudget, + id-TSCTrafficCharacteristics, + id-AdditionalPDCPDuplicationTNL-List, + id-RLCDuplicationInformation, + id-AdditionalDuplicationIndication, + id-mdtConfiguration, + id-TraceCollectionEntityURI, + id-NID, + id-NPNSupportInfo, + id-NPNBroadcastInformation, + id-AvailableSNPN-ID-List, + id-SIB10-message, + id-RequestedP-MaxFR2, + id-DLCarrierList, + id-ExtendedTAISliceSupportList, + id-E-CID-MeasurementQuantities-Item, + id-ConfiguredTACIndication, + maxNRARFCN, + maxnoofErrors, + maxnoofBPLMNs, + maxnoofBPLMNsNR, + maxnoofDLUPTNLInformation, + maxnoofNrCellBands, + maxnoofULUPTNLInformation, + maxnoofQoSFlows, + maxnoofSliceItems, + maxnoofSIBTypes, + maxnoofSITypes, + maxCellineNB, + maxnoofExtendedBPLMNs, + maxnoofAdditionalSIBs, + maxnoofUACPLMNs, + maxnoofUACperPLMN, + maxCellingNBDU, + maxnoofTLAs, + maxnoofGTPTLAs, + maxnoofslots, + maxnoofNonUPTrafficMappings, + maxnoofServingCells, + maxnoofServedCellsIAB, + maxnoofChildIABNodes, + maxnoofIABSTCInfo, + maxnoofSymbols, + maxnoofDUFSlots, + maxnoofHSNASlots, + maxnoofEgressLinks, + maxnoofMappingEntries, + maxnoofDSInfo, + maxnoofQoSParaSets, + maxnoofPC5QoSFlows, + maxnoofSSBAreas, + maxnoofBPLMNsNR, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofPhysicalResourceBlocks-1, + maxnoofPRACHconfigs, + maxnoofRACHReports, + maxnoofRLFReports, + maxnoofAdditionalPDCPDuplicationTNL, + maxnoofRLCDuplicationState, + maxnoofCHOcells, + maxnoofMDTPLMNs, + maxnoofCAGsupported, + maxnoofNIDsupported, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofExtSliceItems, + maxnoofPosMeas, + maxnoofTRPInfoTypes, + maxnoofSRSTriggerStates, + maxnoofSpatialRelations, + maxnoBcastCell, + maxnoofTRPs, + maxnoofAngleInfo, + maxnooflcs-gcs-translation, + maxnoofPath, + maxnoofMeasE-CID, + maxnoofSSBs, + maxnoSRS-ResourceSets, + maxnoSRS-ResourcePerSet, + maxnoSRS-Carriers, + maxnoSCSs, + maxnoSRS-Resources, + maxnoSRS-PosResources, + maxnoSRS-PosResourceSets, + maxnoSRS-PosResourcePerSet, + maxnoofPRS-ResourceSets, + maxnoofPRS-ResourcesPerSet, + maxNoOfMeasTRPs, + maxnoofPRSresourceSets, + maxnoofPRSresources + + + +FROM F1AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage + +FROM F1AP-CommonDataTypes + + ProtocolExtensionContainer{}, + F1AP-PROTOCOL-EXTENSION, + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + +-- A + +AbortTransmission ::= CHOICE { + sRSResourceSetID SRSResourceSetID, + releaseALL NULL, + choice-extension ProtocolIE-SingleContainer { { AbortTransmission-ExtIEs } } +} + +AbortTransmission-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +AccessPointPosition ::= SEQUENCE { + latitudeSign ENUMERATED {north, south}, + latitude INTEGER (0..8388607), + longitude INTEGER (-8388608..8388607), + directionOfAltitude ENUMERATED {height, depth}, + altitude INTEGER (0..32767), + uncertaintySemi-major INTEGER (0..127), + uncertaintySemi-minor INTEGER (0..127), + orientationOfMajorAxis INTEGER (0..179), + uncertaintyAltitude INTEGER (0..127), + confidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { AccessPointPosition-ExtIEs} } OPTIONAL +} + +AccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Activated-Cells-to-be-Updated-List ::= SEQUENCE (SIZE(1..maxnoofServedCellsIAB)) OF Activated-Cells-to-be-Updated-List-Item + +Activated-Cells-to-be-Updated-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info, + iE-Extensions ProtocolExtensionContainer { { Activated-Cells-to-be-Updated-List-Item-ExtIEs} } OPTIONAL +} + +Activated-Cells-to-be-Updated-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ActiveULBWP ::= SEQUENCE { + locationAndBandwidth INTEGER (0..37949,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + cyclicPrefix ENUMERATED {normal, extended}, + txDirectCurrentLocation INTEGER (0..3301,...), + shift7dot5kHz ENUMERATED {true, ...} OPTIONAL, + sRSConfig SRSConfig, + iE-Extensions ProtocolExtensionContainer { { ActiveULBWP-ExtIEs} } OPTIONAL +} + +ActiveULBWP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalDuplicationIndication ::= ENUMERATED { + three, + four, + ... +} + + +AdditionalPath-List::= SEQUENCE (SIZE(1..maxnoofPath)) OF AdditionalPath-Item + +AdditionalPath-Item ::=SEQUENCE { + relativePathDelay RelativePathDelay, + pathQuality TRPMeasurementQuality OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { AdditionalPath-Item-ExtIEs } } OPTIONAL +} + +AdditionalPath-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AdditionalPDCPDuplicationTNL-List ::= SEQUENCE (SIZE(1..maxnoofAdditionalPDCPDuplicationTNL)) OF AdditionalPDCPDuplicationTNL-Item + +AdditionalPDCPDuplicationTNL-Item ::=SEQUENCE { + additionalPDCPDuplicationUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { AdditionalPDCPDuplicationTNL-ItemExtIEs } } OPTIONAL, + ... +} + +AdditionalPDCPDuplicationTNL-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalSIBMessageList ::= SEQUENCE (SIZE(1..maxnoofAdditionalSIBs)) OF AdditionalSIBMessageList-Item + +AdditionalSIBMessageList-Item ::= SEQUENCE { + additionalSIB OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { AdditionalSIBMessageList-Item-ExtIEs} } OPTIONAL +} + +AdditionalSIBMessageList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalRRMPriorityIndex ::= BIT STRING (SIZE(32)) + +AggressorCellList ::= SEQUENCE (SIZE(1..maxCellingNBDU)) OF AggressorCellList-Item + +AggressorCellList-Item ::= SEQUENCE { + aggressorCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { AggressorCellList-Item-ExtIEs } } OPTIONAL +} + +AggressorCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AggressorgNBSetID ::= SEQUENCE { + aggressorgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { AggressorgNBSetID-ExtIEs } } OPTIONAL +} + +AggressorgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AlternativeQoSParaSetList ::= SEQUENCE (SIZE(1..maxnoofQoSParaSets)) OF AlternativeQoSParaSetItem + +AlternativeQoSParaSetItem ::= SEQUENCE { + alternativeQoSParaSetIndex QoSParaSetIndex, + guaranteedFlowBitRateDL BitRate OPTIONAL, + guaranteedFlowBitRateUL BitRate OPTIONAL, + packetDelayBudget PacketDelayBudget OPTIONAL, + packetErrorRate PacketErrorRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AlternativeQoSParaSetItem-ExtIEs} } OPTIONAL, + ... +} + +AlternativeQoSParaSetItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AngleMeasurementQuality ::= SEQUENCE { + azimuthQuality INTEGER(0..255), + zenithQuality INTEGER(0..255) OPTIONAL, + resolution ENUMERATED{deg0dot1,...}, + iE-Extensions ProtocolExtensionContainer { { AngleMeasurementQuality-ExtIEs } } OPTIONAL +} + +AngleMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AperiodicSRSResourceTriggerList ::= SEQUENCE (SIZE(1..maxnoofSRSTriggerStates)) OF AperiodicSRSResourceTrigger + +AperiodicSRSResourceTrigger ::= INTEGER (0..3, ...) + +Associated-SCell-Item ::= SEQUENCE { + sCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { Associated-SCell-ItemExtIEs } } OPTIONAL +} + +Associated-SCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailablePLMNList ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF AvailablePLMNList-Item + +AvailablePLMNList-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { AvailablePLMNList-Item-ExtIEs} } OPTIONAL +} + +AvailablePLMNList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailableSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF AvailableSNPN-ID-List-Item + +AvailableSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + availableNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { AvailableSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +AvailableSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AveragingWindow ::= INTEGER (0..4095, ...) + +AreaScope ::= ENUMERATED {true, ...} + +-- B + +BandwidthSRS ::= CHOICE { + fR1 FR1-Bandwidth, + fR2 FR2-Bandwidth, + choice-extension ProtocolIE-SingleContainer {{ BandwidthSRS-ExtIEs }} +} + +BandwidthSRS-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +BAPAddress ::= BIT STRING (SIZE(10)) + +BAPCtrlPDUChannel ::= ENUMERATED {true, ...} + +BAPlayerBHRLCchannelMappingInfo ::= SEQUENCE { + bAPlayerBHRLCchannelMappingInfoToAdd BAPlayerBHRLCchannelMappingInfoList OPTIONAL, + bAPlayerBHRLCchannelMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPlayerBHRLCchannelMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF BAPlayerBHRLCchannelMappingInfo-Item + +BAPlayerBHRLCchannelMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + priorHopBAPAddress BAPAddress OPTIONAL, + ingressbHRLCChannelID BHRLCChannelID OPTIONAL, + nextHopBAPAddress BAPAddress OPTIONAL, + egressbHRLCChannelID BHRLCChannelID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPPathID ::= BIT STRING (SIZE(10)) + +BAPRoutingID ::= SEQUENCE { + bAPAddress BAPAddress, + bAPPathID BAPPathID, + iE-Extensions ProtocolExtensionContainer { { BAPRoutingIDExtIEs } } OPTIONAL +} + +BAPRoutingIDExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BitRate ::= INTEGER (0..4000000000000,...) + +BearerTypeChange ::= ENUMERATED {true, ...} + +BHRLCChannelID ::= BIT STRING (SIZE(16)) + +BHChannels-FailedToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Modified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Modified-ItemExtIEs } } OPTIONAL +} + +BHChannels-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Required-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Setup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Setup-ItemExtIEs } } OPTIONAL +} + +BHChannels-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-SetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-SetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode OPTIONAL, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHInfo ::= SEQUENCE { + bAProutingID BAPRoutingID OPTIONAL, + egressBHRLCCHList EgressBHRLCCHList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHInfo-ExtIEs} } OPTIONAL +} + +BHInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHQoSInformation ::= CHOICE { + bHRLCCHQoS QoSFlowLevelQoSParameters, + eUTRANBHRLCCHQoS EUTRANQoS, + cPTrafficType CPTrafficType, + choice-extension ProtocolIE-SingleContainer { { BHQoSInformation-ExtIEs} } +} + +BHQoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +BH-Routing-Information-Added-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + nextHopBAPAddress BAPAddress, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Added-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Added-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BH-Routing-Information-Removed-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Removed-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Removed-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BPLMN-ID-Info-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNsNR)) OF BPLMN-ID-Info-Item + +BPLMN-ID-Info-Item ::= SEQUENCE { + pLMN-Identity-List AvailablePLMNList, + extended-PLMN-Identity-List ExtendedAvailablePLMN-List OPTIONAL, + fiveGS-TAC FiveGS-TAC OPTIONAL, + nr-cell-ID NRCellIdentity, + ranac RANAC OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BPLMN-ID-Info-ItemExtIEs} } OPTIONAL, + ... +} + +BPLMN-ID-Info-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-NPNBroadcastInformation CRITICALITY reject EXTENSION NPNBroadcastInformation PRESENCE optional}, + ... +} + +ServedPLMNs-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF ServedPLMNs-Item + +ServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-TAISliceSupportList CRITICALITY ignore EXTENSION SliceSupportList PRESENCE optional }| +{ ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +BroadcastCAGList ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF CAGID + +BroadcastNIDList ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF NID + +BroadcastSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF BroadcastSNPN-ID-List-Item + +BroadcastSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { BroadcastSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BroadcastPNI-NPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF BroadcastPNI-NPN-ID-List-Item + +BroadcastPNI-NPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastCAGList BroadcastCAGList, + iE-Extensions ProtocolExtensionContainer { { BroadcastPNI-NPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastPNI-NPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +BurstArrivalTime ::= OCTET STRING + +-- C +CAGID ::= BIT STRING (SIZE(32)) + +Cancel-all-Warning-Messages-Indicator ::= ENUMERATED {true, ...} + +Candidate-SpCell-Item ::= SEQUENCE { + candidate-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Candidate-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Candidate-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CapacityValue::= SEQUENCE { + capacityValue INTEGER (0..100), + sSBAreaCapacityValueList SSBAreaCapacityValueList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CapacityValue-ExtIEs} } OPTIONAL +} + +CapacityValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + protocol CauseProtocol, + misc CauseMisc, + choice-extension ProtocolIE-SingleContainer { { Cause-ExtIEs} } +} + +Cause-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, + ... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + unspecified, + rl-failure-rlc, + unknown-or-already-allocated-gnb-cu-ue-f1ap-id, + unknown-or-already-allocated-gnb-du-ue-f1ap-id, + unknown-or-inconsistent-pair-of-ue-f1ap-id, + interaction-with-other-procedure, + not-supported-qci-Value, + action-desirable-for-radio-reasons, + no-radio-resources-available, + procedure-cancelled, + normal-release, + ..., + cell-not-available, + rl-failure-others, + ue-rejection, + resources-not-available-for-the-slice, + amf-initiated-abnormal-release, + release-due-to-pre-emption, + plmn-not-served-by-the-gNB-CU, + multiple-drb-id-instances, + unknown-drb-id, + multiple-bh-rlc-ch-id-instances, + unknown-bh-rlc-ch-id, + cho-cpc-resources-tobechanged, + nPN-not-supported, + nPN-access-denied, + gNB-CU-Cell-Capacity-Exceeded, + report-characteristics-empty, + existing-measurement-ID, + measurement-temporarily-not-available, + measurement-not-supported-for-the-object + +} + +CauseTransport ::= ENUMERATED { + unspecified, + transport-resource-unavailable, + ..., + unknown-TNL-address-for-IAB, + unknown-UP-TNL-information-for-IAB +} + +CellGroupConfig ::= OCTET STRING + +CellCapacityClassValue ::= INTEGER (1..100,...) + +Cell-Direction ::= ENUMERATED {dl-only, ul-only} + +CellMeasurementResultList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellMeasurementResultItem + +CellMeasurementResultItem ::= SEQUENCE { + cellID NRCGI, + radioResourceStatus RadioResourceStatus OPTIONAL, + compositeAvailableCapacityGroup CompositeAvailableCapacityGroup OPTIONAL, + sliceAvailableCapacity SliceAvailableCapacity OPTIONAL, + numberofActiveUEs NumberofActiveUEs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellMeasurementResultItem-ExtIEs} } OPTIONAL +} + +CellMeasurementResultItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cell-Portion-ID ::= INTEGER (0..4095,...) + +Cells-Failed-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { Cells-Failed-to-be-Activated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Failed-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Status-Item ::= SEQUENCE { + nRCGI NRCGI, + service-status Service-Status, + iE-Extensions ProtocolExtensionContainer { { Cells-Status-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Status-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-To-Be-Broadcast-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-To-Be-Broadcast-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-To-Be-Broadcast-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Broadcast-Completed-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Completed-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Completed-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Broadcast-To-Be-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Broadcast-To-Be-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Broadcast-To-Be-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Cells-Broadcast-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Activated-List-ItemExtIEs} } OPTIONAL, + ... +} + +Cells-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-gNB-CUSystemInformation CRITICALITY reject EXTENSION GNB-CUSystemInformation PRESENCE optional }| + { ID id-AvailablePLMNList CRITICALITY ignore EXTENSION AvailablePLMNList PRESENCE optional }| + { ID id-ExtendedAvailablePLMN-List CRITICALITY ignore EXTENSION ExtendedAvailablePLMN-List PRESENCE optional }| + { ID id-IAB-Info-IAB-donor-CU CRITICALITY ignore EXTENSION IAB-Info-IAB-donor-CU PRESENCE optional}| + { ID id-AvailableSNPN-ID-List CRITICALITY ignore EXTENSION AvailableSNPN-ID-List PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Deactivated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-to-be-Deactivated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Barred-Item::= SEQUENCE { + nRCGI NRCGI , + cellBarred CellBarred, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Barred-Item-ExtIEs } } OPTIONAL +} + +Cells-to-be-Barred-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-IAB-Barred CRITICALITY ignore EXTENSION IAB-Barred PRESENCE optional }, + + ... +} + + +CellBarred ::= ENUMERATED {barred, not-barred, ...} + +CellSize ::= ENUMERATED {verysmall, small, medium, large, ...} + +CellToReportList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellToReportItem + +CellToReportItem ::= SEQUENCE { + cellID NRCGI, + sSBToReportList SSBToReportList OPTIONAL, + sliceToReportList SliceToReportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellToReportItem-ExtIEs} } OPTIONAL +} + +CellToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellType ::= SEQUENCE { + cellSize CellSize, + iE-Extensions ProtocolExtensionContainer { {CellType-ExtIEs} } OPTIONAL, + ... +} + +CellType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellULConfigured ::= ENUMERATED {none, ul, sul, ul-and-sul, ...} + +Child-Node-Cells-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Node-Cells-List-Item + +Child-Node-Cells-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + rACH-Config-Common RACH-Config-Common OPTIONAL, + rACH-Config-Common-IAB RACH-Config-Common-IAB OPTIONAL, + cSI-RS-Configuration OCTET STRING OPTIONAL, + sR-Configuration OCTET STRING OPTIONAL, + pDCCH-ConfigSIB1 OCTET STRING OPTIONAL, + sCS-Common OCTET STRING OPTIONAL, + multiplexingInfo MultiplexingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Node-Cells-List-Item-ExtIEs}} OPTIONAL +} + +Child-Node-Cells-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Child-Nodes-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Nodes-List-Item + +Child-Nodes-List-Item ::= SEQUENCE{ + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID, + child-Node-Cells-List Child-Node-Cells-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Nodes-List-Item-ExtIEs}} OPTIONAL +} + +Child-Nodes-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CHOtrigger-InterDU ::= ENUMERATED { + cho-initiation, + cho-replace, + ... +} + +CHOtrigger-IntraDU ::= ENUMERATED { + cho-initiation, + cho-replace, + cho-cancel, + ... +} + +CNUEPagingIdentity ::= CHOICE { + fiveG-S-TMSI BIT STRING (SIZE(48)), + choice-extension ProtocolIE-SingleContainer { { CNUEPagingIdentity-ExtIEs } } +} + +CNUEPagingIdentity-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CompositeAvailableCapacityGroup ::= SEQUENCE { + compositeAvailableCapacityDownlink CompositeAvailableCapacity, + compositeAvailableCapacityUplink CompositeAvailableCapacity, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacityGroup-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacityGroup-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CompositeAvailableCapacity ::= SEQUENCE { + cellCapacityClassValue CellCapacityClassValue OPTIONAL, + capacityValue CapacityValue, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacity-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ConditionalInterDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-InterDU, + targetgNB-DUUEF1APID GNB-DU-UE-F1AP-ID OPTIONAL + -- This IE shall be present if the cho-trigger IE is present and set to "cho-replace" --, + iE-Extensions ProtocolExtensionContainer { { ConditionalInterDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalInterDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConditionalIntraDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-IntraDU, + targetCellsTocancel TargetCellList OPTIONAL, + -- This IE may be present if the cho-trigger IE is present and set to "cho-cancel" + iE-Extensions ProtocolExtensionContainer { { ConditionalIntraDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalIntraDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConfiguredTACIndication ::= ENUMERATED { + true, + ... +} + + +CoordinateID ::= INTEGER (0..511, ...) + +CP-TransportLayerAddress ::= CHOICE { + endpoint-IP-address TransportLayerAddress, + endpoint-IP-address-and-port Endpoint-IP-address-and-port, + choice-extension ProtocolIE-SingleContainer { { CP-TransportLayerAddress-ExtIEs } } +} + +CP-TransportLayerAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CPTrafficType ::= INTEGER (1..3,...) + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + transactionID TransactionID OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1.. maxnoofErrors)) OF CriticalityDiagnostics-IE-Item + +CriticalityDiagnostics-IE-Item ::= SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-IE-Item-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +C-RNTI ::= INTEGER (0..65535, ...) + +CUDURadioInformationType ::= CHOICE { + rIM CUDURIMInformation, + choice-extension ProtocolIE-SingleContainer { { CUDURadioInformationType-ExtIEs} } +} + +CUDURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CUDURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + iE-Extensions ProtocolExtensionContainer { { CUDURIMInformation-ExtIEs} } OPTIONAL +} + +CUDURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CUtoDURRCInformation ::= SEQUENCE { + cG-ConfigInfo CG-ConfigInfo OPTIONAL, + uE-CapabilityRAT-ContainerList UE-CapabilityRAT-ContainerList OPTIONAL, + measConfig MeasConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CUtoDURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +CUtoDURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-HandoverPreparationInformation CRITICALITY ignore EXTENSION HandoverPreparationInformation PRESENCE optional }| + { ID id-CellGroupConfig CRITICALITY ignore EXTENSION CellGroupConfig PRESENCE optional }| + { ID id-MeasurementTimingConfiguration CRITICALITY ignore EXTENSION MeasurementTimingConfiguration PRESENCE optional }| + { ID id-UEAssistanceInformation CRITICALITY ignore EXTENSION UEAssistanceInformation PRESENCE optional }| + { ID id-CG-Config CRITICALITY ignore EXTENSION CG-Config PRESENCE optional }| + { ID id-UEAssistanceInformationEUTRA CRITICALITY ignore EXTENSION UEAssistanceInformationEUTRA PRESENCE optional }, + ... +} + +-- D + +DCBasedDuplicationConfigured::= ENUMERATED{true,..., false} + +Dedicated-SIDelivery-NeededUE-Item ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { DedicatedSIDeliveryNeededUE-Item-ExtIEs} } OPTIONAL, + ... +} + +DedicatedSIDeliveryNeededUE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION::={ + ... +} + + +DL-PRS ::= SEQUENCE { + prsid INTEGER (0..255), + dl-PRSResourceSetID PRS-Resource-Set-ID, + dl-PRSResourceID PRS-Resource-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {DL-PRS-ExtIEs} } OPTIONAL +} + +DL-PRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSMutingPattern ::= CHOICE { + two BIT STRING (SIZE(2)), + four BIT STRING (SIZE(4)), + six BIT STRING (SIZE(6)), + eight BIT STRING (SIZE(8)), + sixteen BIT STRING (SIZE(16)), + thirty-two BIT STRING (SIZE(32)), + choice-extension ProtocolIE-SingleContainer { { DL-PRSMutingPattern-ExtIEs } } +} + +DL-PRSMutingPattern-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DLPRSResourceCoordinates ::= SEQUENCE { + listofDL-PRSResourceSetARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF DLPRSResourceSetARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceCoordinates-ExtIEs } } OPTIONAL +} + +DLPRSResourceCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLPRSResourceSetARP ::= SEQUENCE { + dl-PRSResourceSetID INTEGER (0..7), + dL-PRSResourceSetARPLocation DL-PRSResourceSetARPLocation, + listofDL-PRSResourceARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF DLPRSResourceARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceSetARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceSetARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DL-PRSResourceSetARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceSetARPLocation-ExtIEs } } +} + +DL-PRSResourceSetARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +DLPRSResourceARP ::= SEQUENCE { + dl-PRSResourceID INTEGER (0..63), + dL-PRSResourceARPLocation DL-PRSResourceARPLocation, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSResourceARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceARPLocation-ExtIEs } } +} + +DL-PRSResourceARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { DL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +DL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDLUPTNLInformation)) OF DLUPTNLInformation-ToBeSetup-Item + +DLUPTNLInformation-ToBeSetup-Item ::= SEQUENCE { + dLUPTNLInformation UPTransportLayerInformation , + iE-Extensions ProtocolExtensionContainer { { DLUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DLUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity-Item ::= SEQUENCE { + dRBID DRBID, + dRB-Activity DRB-Activity OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRB-Activity-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Activity-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity ::= ENUMERATED {active, not-active} + +DRBID ::= INTEGER (1..32, ...) + +DRBs-FailedToBeModified-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-FailedToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Information ::= SEQUENCE { + dRB-QoS QoSFlowLevelQoSParameters, + sNSSAI SNSSAI, + notificationControl NotificationControl OPTIONAL, + flows-Mapped-To-DRB-List Flows-Mapped-To-DRB-List, + iE-Extensions ProtocolExtensionContainer { { DRB-Information-ItemExtIEs } } OPTIONAL +} + +DRB-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Modified-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List, + iE-Extensions ProtocolExtensionContainer { { DRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-ModifiedConf-Item ::= SEQUENCE { + dRBID DRBID, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-ModifiedConf-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRB-Notify-Item ::= SEQUENCE { + dRBID DRBID, + notification-Cause Notification-Cause, + iE-Extensions ProtocolExtensionContainer { { DRB-Notify-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Notify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CurrentQoSParaSetIndex CRITICALITY ignore EXTENSION QoSParaSetNotifyIndex PRESENCE optional }, + ... +} + +DRBs-Required-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-Required-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Setup-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, ... +} + +DRBs-SetupMod-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation OPTIONAL, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + uLConfiguration ULConfiguration OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + {ID id-BearerTypeChange CRITICALITY ignore EXTENSION BearerTypeChange PRESENCE optional}| + { ID id-RLCMode CRITICALITY ignore EXTENSION RLCMode PRESENCE optional }| + { ID id-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRBs-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE mandatory }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List, + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRXCycle ::= SEQUENCE { + longDRXCycleLength LongDRXCycleLength, + shortDRXCycleLength ShortDRXCycleLength OPTIONAL, + shortDRXCycleTimer ShortDRXCycleTimer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRXCycle-ExtIEs} } OPTIONAL, + ... +} + +DRXCycle-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRX-Config ::= OCTET STRING + +DRXConfigurationIndicator ::= ENUMERATED{ release, ...} + +DRX-LongCycleStartOffset ::= INTEGER (0..10239) + +DSInformationList ::= SEQUENCE (SIZE(0..maxnoofDSInfo)) OF DSCP + +DSCP ::= BIT STRING (SIZE (6)) + +DUtoCURRCContainer ::= OCTET STRING + +DUCURadioInformationType ::= CHOICE { + rIM DUCURIMInformation, + choice-extension ProtocolIE-SingleContainer { { DUCURadioInformationType-ExtIEs} } +} + +DUCURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DUCURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + aggressorCellList AggressorCellList, + iE-Extensions ProtocolExtensionContainer { { DUCURIMInformation-ExtIEs} } OPTIONAL +} + +DUCURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DUF-Slot-Config-Item ::= CHOICE { + explicitFormat ExplicitFormat, + implicitFormat ImplicitFormat, + choice-extension ProtocolIE-SingleContainer { { DUF-Slot-Config-Item-ExtIEs} } +} + +DUF-Slot-Config-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} +DUF-Slot-Config-List ::= SEQUENCE (SIZE(1..maxnoofDUFSlots)) OF DUF-Slot-Config-Item + +DUFSlotformatIndex ::= INTEGER(0..254) + +DUFTransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ...} + +DU-RX-MT-RX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-RX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-RX ::= ENUMERATED {supported, not-supported} + +DUtoCURRCInformation ::= SEQUENCE { + cellGroupConfig CellGroupConfig, + measGapConfig MeasGapConfig OPTIONAL, + requestedP-MaxFR1 OCTET STRING OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DUtoCURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +DUtoCURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DRX-LongCycleStartOffset CRITICALITY ignore EXTENSION DRX-LongCycleStartOffset PRESENCE optional }| + { ID id-SelectedBandCombinationIndex CRITICALITY ignore EXTENSION SelectedBandCombinationIndex PRESENCE optional }| + { ID id-SelectedFeatureSetEntryIndex CRITICALITY ignore EXTENSION SelectedFeatureSetEntryIndex PRESENCE optional }| + { ID id-Ph-InfoSCG CRITICALITY ignore EXTENSION Ph-InfoSCG PRESENCE optional }| + { ID id-RequestedBandCombinationIndex CRITICALITY ignore EXTENSION RequestedBandCombinationIndex PRESENCE optional }| + { ID id-RequestedFeatureSetEntryIndex CRITICALITY ignore EXTENSION RequestedFeatureSetEntryIndex PRESENCE optional }| + { ID id-DRX-Config CRITICALITY ignore EXTENSION DRX-Config PRESENCE optional }| + { ID id-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Requested-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION Requested-PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Ph-InfoMCG CRITICALITY ignore EXTENSION Ph-InfoMCG PRESENCE optional }| + { ID id-MeasGapSharingConfig CRITICALITY ignore EXTENSION MeasGapSharingConfig PRESENCE optional }| + { ID id-SL-PHY-MAC-RLC-Config CRITICALITY ignore EXTENSION SL-PHY-MAC-RLC-Config PRESENCE optional }| + { ID id-SL-ConfigDedicatedEUTRA CRITICALITY ignore EXTENSION SL-ConfigDedicatedEUTRA PRESENCE optional }| + { ID id-RequestedP-MaxFR2 CRITICALITY ignore EXTENSION RequestedP-MaxFR2 PRESENCE optional }, + ... +} + +DuplicationActivation ::= ENUMERATED{active,inactive,... } + +DuplicationIndication ::= ENUMERATED {true, ... , false } + +DuplicationState ::= ENUMERATED { + active, + inactive, + ... +} + +Dynamic5QIDescriptor ::= SEQUENCE { + qoSPriorityLevel INTEGER (1..127), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + fiveQI INTEGER (0..255, ...) OPTIONAL, + delayCritical ENUMERATED {delay-critical, non-delay-critical} OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Dynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +Dynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ExtendedPacketDelayBudget CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +DynamicPQIDescriptor ::= SEQUENCE { + resourceType ENUMERATED {gbr, non-gbr, delay-critical-grb, ...} OPTIONAL, + qoSPriorityLevel INTEGER (1..8, ...), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +DynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- E + +E-CID-MeasurementPeriodicity ::= ENUMERATED { + ms120, + ms240, + ms480, + ms640, + ms1024, + ms2048, + ms5120, + ms10240, + min1, + min6, + min12, + min30, + min60, + ... +} + +E-CID-MeasurementQuantities ::= SEQUENCE (SIZE (1.. maxnoofMeasE-CID)) OF ProtocolIE-SingleContainer { {E-CID-MeasurementQuantities-ItemIEs} } + +E-CID-MeasurementQuantities-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-E-CID-MeasurementQuantities-Item CRITICALITY reject TYPE E-CID-MeasurementQuantities-Item PRESENCE mandatory} +} + +E-CID-MeasurementQuantities-Item ::= SEQUENCE { + e-CIDmeasurementQuantitiesValue E-CID-MeasurementQuantitiesValue, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementQuantitiesValue-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementQuantitiesValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasurementQuantitiesValue ::= ENUMERATED { + cell-Portion, + angleOfArrivalNR, + ... +} + +E-CID-MeasurementResult ::= SEQUENCE { + geographicalCoordinates GeographicalCoordinates OPTIONAL, + measuredResults-List E-CID-MeasuredResults-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementResult-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementResult-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-List ::= SEQUENCE (SIZE(1..maxnoofMeasE-CID)) OF E-CID-MeasuredResults-Item + +E-CID-MeasuredResults-Item ::= SEQUENCE { + e-CID-MeasuredResults-Value E-CID-MeasuredResults-Value, + iE-Extensions ProtocolExtensionContainer {{ E-CID-MeasuredResults-Item-ExtIEs }} OPTIONAL +} + +E-CID-MeasuredResults-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-Value ::= CHOICE { + valueAngleofArrivalNR UL-AoA, + choice-extension ProtocolIE-SingleContainer { { E-CID-MeasuredResults-Value-ExtIEs} } +} + +E-CID-MeasuredResults-Value-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +E-CID-ReportCharacteristics ::= ENUMERATED { + onDemand, + periodic, + ... +} + +EgressBHRLCCHList ::= SEQUENCE (SIZE(1..maxnoofEgressLinks)) OF EgressBHRLCCHItem + +EgressBHRLCCHItem ::= SEQUENCE { + nextHopBAPAddress BAPAddress, + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer {{EgressBHRLCCHItemExtIEs }} OPTIONAL +} + +EgressBHRLCCHItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Endpoint-IP-address-and-port ::=SEQUENCE { + endpointIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { Endpoint-IP-address-and-port-ExtIEs} } OPTIONAL +} + +Endpoint-IP-address-and-port-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-portNumber CRITICALITY reject EXTENSION PortNumber PRESENCE optional}, + ... +} + +ExtendedAvailablePLMN-List ::= SEQUENCE (SIZE(1..maxnoofExtendedBPLMNs)) OF ExtendedAvailablePLMN-Item + +ExtendedAvailablePLMN-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ExtendedAvailablePLMN-Item-ExtIEs} } OPTIONAL +} + +ExplicitFormat ::= SEQUENCE { + permutation Permutation, + noofDownlinkSymbols NoofDownlinkSymbols OPTIONAL, + noofUplinkSymbols NoofUplinkSymbols OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExplicitFormat-ExtIEs} } OPTIONAL +} + +ExplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedAvailablePLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedServedPLMNs-List ::= SEQUENCE (SIZE(1.. maxnoofExtendedBPLMNs)) OF ExtendedServedPLMNs-Item + +ExtendedServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + tAISliceSupportList SliceSupportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExtendedServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ExtendedServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +ExtendedSliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofExtSliceItems)) OF SliceSupportItem + +EUTRACells-List ::= SEQUENCE (SIZE (1.. maxCellineNB)) OF EUTRACells-List-item + +EUTRACells-List-item ::= SEQUENCE { + eUTRA-Cell-ID EUTRA-Cell-ID, + served-EUTRA-Cells-Information Served-EUTRA-Cells-Information, + iE-Extensions ProtocolExtensionContainer { { EUTRACells-List-itemExtIEs } } OPTIONAL +} + +EUTRACells-List-itemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-Cell-ID ::= BIT STRING (SIZE(28)) + +EUTRA-Coex-FDD-Info ::= SEQUENCE { + uL-EARFCN ExtendedEARFCN OPTIONAL, + dL-EARFCN ExtendedEARFCN, + uL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth OPTIONAL, + dL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-Coex-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ULCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-DLCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +EUTRA-Coex-Mode-Info ::= CHOICE { + fDD EUTRA-Coex-FDD-Info, + tDD EUTRA-Coex-TDD-Info, + ... +} + +EUTRA-Coex-TDD-Info ::= SEQUENCE { + eARFCN ExtendedEARFCN, + transmission-Bandwidth EUTRA-Transmission-Bandwidth, + subframeAssignment EUTRA-SubframeAssignment, + specialSubframe-Info EUTRA-SpecialSubframe-Info, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-TDD-Info-ExtIEs} } OPTIONAL, + ... +} +EUTRA-Coex-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +EUTRA-CyclicPrefixDL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-CyclicPrefixUL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-PRACH-Configuration ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + zeroCorrelationIndex INTEGER (0..15), + highSpeedFlag BOOLEAN, + prach-FreqOffset INTEGER (0..94), + prach-ConfigIndex INTEGER (0..63) OPTIONAL, + -- C-ifTDD: This IE shall be present if the EUTRA-Mode-Info IE in the Resource Coordination E-UTRA Cell Information IE is set to the value "TDD" + iE-Extensions ProtocolExtensionContainer { {EUTRA-PRACH-Configuration-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-PRACH-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-SpecialSubframe-Info ::= SEQUENCE { + specialSubframePatterns EUTRA-SpecialSubframePatterns, + cyclicPrefixDL EUTRA-CyclicPrefixDL, + cyclicPrefixUL EUTRA-CyclicPrefixUL, + iE-Extensions ProtocolExtensionContainer { { EUTRA-SpecialSubframe-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-SpecialSubframe-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-SpecialSubframePatterns ::= ENUMERATED { + ssp0, + ssp1, + ssp2, + ssp3, + ssp4, + ssp5, + ssp6, + ssp7, + ssp8, + ssp9, + ssp10, + ... +} + +EUTRA-SubframeAssignment ::= ENUMERATED { + sa0, + sa1, + sa2, + sa3, + sa4, + sa5, + sa6, + ... +} + +EUTRA-Transmission-Bandwidth ::= ENUMERATED { + bw6, + bw15, + bw25, + bw50, + bw75, + bw100, + ... +} + +EUTRANQoS ::= SEQUENCE { + qCI QCI, + allocationAndRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { EUTRANQoS-ExtIEs} } OPTIONAL, + ... +} + +EUTRANQoS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExecuteDuplication ::= ENUMERATED{true,...} + +ExtendedEARFCN ::= INTEGER (0..262143) + +EUTRA-Mode-Info ::= CHOICE { + eUTRAFDD EUTRA-FDD-Info, + eUTRATDD EUTRA-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { EUTRA-Mode-Info-ExtIEs} } +} + +EUTRA-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +EUTRA-NR-CellResourceCoordinationReq-Container ::= OCTET STRING + +EUTRA-NR-CellResourceCoordinationReqAck-Container ::= OCTET STRING + +EUTRA-FDD-Info ::= SEQUENCE { + uL-offsetToPointA OffsetToPointA, + dL-offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-TDD-Info ::= SEQUENCE { + offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EventType ::= ENUMERATED { + on-demand, + periodic, + stop, + ... +} + +ExtendedPacketDelayBudget ::= INTEGER (1..65535, ...) + +-- F + +FDD-Info ::= SEQUENCE { + uL-NRFreqInfo NRFreqInfo, + dL-NRFreqInfo NRFreqInfo, + uL-Transmission-Bandwidth Transmission-Bandwidth, + dL-Transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Flows-Mapped-To-DRB-List ::= SEQUENCE (SIZE(1.. maxnoofQoSFlows)) OF Flows-Mapped-To-DRB-Item + +Flows-Mapped-To-DRB-Item ::= SEQUENCE { + qoSFlowIdentifier QoSFlowIdentifier, + qoSFlowLevelQoSParameters QoSFlowLevelQoSParameters, + iE-Extensions ProtocolExtensionContainer { { Flows-Mapped-To-DRB-ItemExtIEs} } OPTIONAL +} + +Flows-Mapped-To-DRB-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-QoSFlowMappingIndication CRITICALITY ignore EXTENSION QoSFlowMappingIndication PRESENCE optional}| + {ID id-TSCTrafficCharacteristics CRITICALITY ignore EXTENSION TSCTrafficCharacteristics PRESENCE optional}, + ... +} + +FR1-Bandwidth ::= ENUMERATED {bw5, bw10, bw20, bw40, bw50, bw80, bw100, ...} + +FR2-Bandwidth ::= ENUMERATED {bw50, bw100, bw200, bw400, ...} + +FreqBandNrItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + supportedSULBandList SEQUENCE (SIZE(0..maxnoofNrCellBands)) OF SupportedSULFreqBandItem, + iE-Extensions ProtocolExtensionContainer { {FreqBandNrItem-ExtIEs} } OPTIONAL, + ... +} + +FreqBandNrItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +FreqDomainLength ::= CHOICE { + l839 L839Info, + l139 L139Info, + choice-extension ProtocolIE-SingleContainer { {FreqDomainLength-ExtIEs} } +} + +FreqDomainLength-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +FrequencyShift7p5khz ::= ENUMERATED {false, true, ...} + +FullConfiguration ::= ENUMERATED {full, ...} + +FlowsMappedToSLDRB-List ::= SEQUENCE (SIZE(1.. maxnoofPC5QoSFlows)) OF FlowsMappedToSLDRB-Item + +FlowsMappedToSLDRB-Item ::= SEQUENCE { + pc5QoSFlowIdentifier PC5QoSFlowIdentifier, + iE-Extensions ProtocolExtensionContainer { {FlowsMappedToSLDRB-Item-ExtIEs} } OPTIONAL, + ... +} + +FlowsMappedToSLDRB-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- G + + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GBR-QoSFlowInformation::= SEQUENCE { + maxFlowBitRateDownlink BitRate, + maxFlowBitRateUplink BitRate, + guaranteedFlowBitRateDownlink BitRate, + guaranteedFlowBitRateUplink BitRate, + maxPacketLossRateDownlink MaxPacketLossRate OPTIONAL, + maxPacketLossRateUplink MaxPacketLossRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GBR-QosFlowInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosFlowInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AlternativeQoSParaSetList CRITICALITY ignore EXTENSION AlternativeQoSParaSetList PRESENCE optional }, + ... +} + +CG-Config ::= OCTET STRING + +GeographicalCoordinates ::= SEQUENCE { + tRPPositionDefinitionType TRPPositionDefinitionType, + dLPRSResourceCoordinates DLPRSResourceCoordinates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GeographicalCoordinates-ExtIEs } } OPTIONAL +} + +GeographicalCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNBCUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNBDUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNB-CUSystemInformation::= SEQUENCE { + sibtypetobeupdatedlist SEQUENCE (SIZE(1.. maxnoofSIBTypes)) OF SibtypetobeupdatedListItem, + iE-Extensions ProtocolExtensionContainer { { GNB-CUSystemInformation-ExtIEs} } OPTIONAL, + ... +} + +GNB-CUSystemInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-systemInformationAreaID CRITICALITY ignore EXTENSION SystemInformationAreaID PRESENCE optional}, + ... +} + +GNB-CU-TNL-Association-Setup-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + cause Cause, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GNB-CU-TNL-Association-To-Add-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Add-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Add-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-TNLAssociationTransportLayerAddressgNBDU CRITICALITY reject EXTENSION CP-TransportLayerAddress PRESENCE optional}, + ... +} + + +GNB-CU-TNL-Association-To-Update-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Update-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Update-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-Cell-Resource-Configuration ::= SEQUENCE { + subcarrierSpacing SubcarrierSpacing, + dUFTransmissionPeriodicity DUFTransmissionPeriodicity OPTIONAL, + dUF-Slot-Config-List DUF-Slot-Config-List OPTIONAL, + hSNATransmissionPeriodicity HSNATransmissionPeriodicity, + hNSASlotConfigList HSNASlotConfigList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Cell-Resource-Configuration-ExtIEs } } OPTIONAL +} + +GNB-DU-Cell-Resource-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-ID ::= INTEGER (0..68719476735) + +GNB-CU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Name ::= PrintableString(SIZE(1..150,...)) + +Extended-GNB-CU-Name ::= SEQUENCE { + gNB-CU-NameVisibleString GNB-CU-NameVisibleString OPTIONAL, + gNB-CU-NameUTF8String GNB-CU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-CU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-CU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-CU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + +Extended-GNB-DU-Name ::= SEQUENCE { + gNB-DU-NameVisibleString GNB-DU-NameVisibleString OPTIONAL, + gNB-DU-NameUTF8String GNB-DU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-DU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-DU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-DU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + + +GNB-DU-Served-Cells-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Served-Cells-ItemExtIEs} } OPTIONAL, + ... +} + +GNB-DU-Served-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-System-Information ::= SEQUENCE { + mIB-message MIB-message, + sIB1-message SIB1-message, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-System-Information-ExtIEs } } OPTIONAL, + ... +} + +GNB-DU-System-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-SIB12-message CRITICALITY ignore EXTENSION SIB12-message PRESENCE optional}| + { ID id-SIB13-message CRITICALITY ignore EXTENSION SIB13-message PRESENCE optional}| + { ID id-SIB14-message CRITICALITY ignore EXTENSION SIB14-message PRESENCE optional}| + { ID id-SIB10-message CRITICALITY ignore EXTENSION SIB10-message PRESENCE optional}, + ... +} + +GNB-DUConfigurationQuery ::= ENUMERATED {true, ...} + +GNBDUOverloadInformation ::= ENUMERATED {overloaded, not-overloaded} + +GNB-DU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationTransportLayerAddressgNBCU CP-TransportLayerAddress OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-DU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-RxTxTimeDiff ::= SEQUENCE { + rxTxTimeDiff GNBRxTxTimeDiffMeas, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-RxTxTimeDiff-ExtIEs} } OPTIONAL +} + +GNB-RxTxTimeDiff-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + + ... +} + +GNBRxTxTimeDiffMeas ::= CHOICE { + k0 INTEGER (0.. 1970049), + k1 INTEGER (0.. 985025), + k2 INTEGER (0.. 492513), + k3 INTEGER (0.. 246257), + k4 INTEGER (0.. 123129), + k5 INTEGER (0.. 61565), + choice-extension ProtocolIE-SingleContainer { { GNBRxTxTimeDiffMeas-ExtIEs } } +} + +GNBRxTxTimeDiffMeas-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +GNBSetID ::= BIT STRING (SIZE(22)) + +GTP-TEID ::= OCTET STRING (SIZE (4)) + +GTPTLAs ::= SEQUENCE (SIZE(1.. maxnoofGTPTLAs)) OF GTPTLA-Item + + +GTPTLA-Item ::= SEQUENCE { + gTPTransportLayerAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { GTPTLA-Item-ExtIEs } } OPTIONAL +} + +GTPTLA-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTPTunnel ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { GTPTunnel-ExtIEs } } OPTIONAL, + ... +} + +GTPTunnel-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- H + +HandoverPreparationInformation ::= OCTET STRING + +HardwareLoadIndicator ::= SEQUENCE { + dLHardwareLoadIndicator INTEGER (0..100, ...), + uLHardwareLoadIndicator INTEGER (0..100, ...), + iE-Extensions ProtocolExtensionContainer { { HardwareLoadIndicator-ExtIEs } } OPTIONAL, + ... +} + +HardwareLoadIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +HSNASlotConfigList ::= SEQUENCE (SIZE(1..maxnoofHSNASlots)) OF HSNASlotConfigItem + +HSNASlotConfigItem ::= SEQUENCE { + hSNADownlink HSNADownlink OPTIONAL, + hSNAUplink HSNAUplink OPTIONAL, + hSNAFlexible HSNAFlexible OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { HSNASlotConfigItem-ExtIEs } } OPTIONAL +} + +HSNASlotConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +HSNADownlink ::= ENUMERATED { hard, soft, notavailable } + +HSNAFlexible ::= ENUMERATED { hard, soft, notavailable } + +HSNAUplink ::= ENUMERATED { hard, soft, notavailable } + +HSNATransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ms20, ms40, ms80, ms160, ...} + +-- I + +IAB-Barred ::= ENUMERATED {barred, not-barred, ...} + +IAB-Info-IAB-donor-CU ::= SEQUENCE{ + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-donor-CU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-donor-CU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Info-IAB-DU ::= SEQUENCE{ + multiplexingInfo MultiplexingInfo OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-DU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-DU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-MT-Cell-List ::= SEQUENCE (SIZE(1..maxnoofServingCells)) OF IAB-MT-Cell-List-Item + +IAB-MT-Cell-List-Item ::= SEQUENCE { + nRCellIdentity NRCellIdentity, + dU-RX-MT-RX DU-RX-MT-RX, + dU-TX-MT-TX DU-TX-MT-TX, + dU-RX-MT-TX DU-RX-MT-TX, + dU-TX-MT-RX DU-TX-MT-RX, + iE-Extensions ProtocolExtensionContainer { { IAB-MT-Cell-List-Item-ExtIEs } } OPTIONAL +} + +IAB-MT-Cell-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info ::= SEQUENCE{ + iAB-STC-Info-List IAB-STC-Info-List, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info-List ::= SEQUENCE (SIZE(1..maxnoofIABSTCInfo)) OF IAB-STC-Info-Item + +IAB-STC-Info-Item::= SEQUENCE { + sSB-freqInfo SSB-freqInfo, + sSB-subcarrierSpacing SSB-subcarrierSpacing, + sSB-transmissionPeriodicity SSB-transmissionPeriodicity, + sSB-transmissionTimingOffset SSB-transmissionTimingOffset, + sSB-transmissionBitmap SSB-transmissionBitmap, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-Item-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Allocated-TNL-Address-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iABTNLAddressUsage IABTNLAddressUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Allocated-TNL-Address-Item-ExtIEs } } OPTIONAL +} + +IAB-Allocated-TNL-Address-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info ::= CHOICE { + fDD IAB-DU-Cell-Resource-Configuration-FDD-Info, + tDD IAB-DU-Cell-Resource-Configuration-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs} } +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resource-Configuration-FDD-UL GNB-DU-Cell-Resource-Configuration, + gNB-DU-Cell-Resource-Configuration-FDD-DL GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resourc-Configuration-TDD GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABIPv6RequestType ::= CHOICE { + iPv6Address IABTNLAddressesRequested, + iPv6Prefix IABTNLAddressesRequested, + choice-extension ProtocolIE-SingleContainer { { IABIPv6RequestType-ExtIEs} } +} + +IABIPv6RequestType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddress ::= CHOICE { + iPv4Address BIT STRING (SIZE(32)), + iPv6Address BIT STRING (SIZE(128)), + iPv6Prefix BIT STRING (SIZE(64)), + choice-extension ProtocolIE-SingleContainer { { IABTNLAddress-ExtIEs} } +} + +IABTNLAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddressesRequested ::= SEQUENCE { + tNLAddressesOrPrefixesRequestedAllTraffic INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-C INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-U INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedNoNF1 INTEGER (1..256) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IABTNLAddressesRequested-ExtIEs } } OPTIONAL +} + +IABTNLAddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-TNL-Addresses-To-Remove-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iE-Extensions ProtocolExtensionContainer { { IAB-TNL-Addresses-To-Remove-Item-ExtIEs} } OPTIONAL +} + +IAB-TNL-Addresses-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABTNLAddressUsage ::= ENUMERATED { + f1-c, + f1-u, + non-f1, + ... +} + + +IABv4AddressesRequested ::= SEQUENCE { + iABv4AddressesRequested IABTNLAddressesRequested, + iE-Extensions ProtocolExtensionContainer { { IABv4AddressesRequested-ExtIEs} } OPTIONAL +} + +IABv4AddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ImplicitFormat ::= SEQUENCE { + dUFSlotformatIndex DUFSlotformatIndex, + iE-Extensions ProtocolExtensionContainer { { ImplicitFormat-ExtIEs } } OPTIONAL +} + +ImplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IgnorePRACHConfiguration::= ENUMERATED { true,...} + +IgnoreResourceCoordinationContainer ::= ENUMERATED { yes,...} +InactivityMonitoringRequest ::= ENUMERATED { true,...} +InactivityMonitoringResponse ::= ENUMERATED { not-supported,...} +InterfacesToTrace ::= BIT STRING (SIZE(8)) + +IntendedTDD-DL-ULConfig ::= SEQUENCE { + nRSCS ENUMERATED { scs15, scs30, scs60, scs120,...}, + nRCP ENUMERATED { normal, extended,...}, + nRDLULTxPeriodicity ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms3, ms4, ms5, ms10, ms20, ms40, ms60, ms80, ms100, ms120, ms140, ms160, ...}, + slot-Configuration-List Slot-Configuration-List, + iE-Extensions ProtocolExtensionContainer { {IntendedTDD-DL-ULConfig-ExtIEs} } OPTIONAL +} + +IntendedTDD-DL-ULConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPHeaderInformation ::= SEQUENCE { + destinationIABTNLAddress IABTNLAddress, + dsInformationList DSInformationList OPTIONAL, + iPv6FlowLabel BIT STRING (SIZE (20)) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPHeaderInformation-ItemExtIEs} } OPTIONAL, + ... +} + +IPHeaderInformation-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPtolayer2TrafficMappingInfo ::= SEQUENCE { + iPtolayer2TrafficMappingInfoToAdd IPtolayer2TrafficMappingInfoList OPTIONAL, + iPtolayer2TrafficMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF IPtolayer2TrafficMappingInfo-Item + +IPtolayer2TrafficMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + iPHeaderInformation IPHeaderInformation, + bHInfo BHInfo, iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- J + +-- K + +-- L + +L139Info ::= SEQUENCE { + msg1SCS ENUMERATED {scs15, scs30, scs60, scs120, ...}, + rootSequenceIndex INTEGER (0..137) OPTIONAL, + iE-Extension ProtocolExtensionContainer { {L139Info-ExtIEs} } OPTIONAL, + ... +} + +L139Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +L839Info ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + restrictedSetConfig ENUMERATED {unrestrictedSet, restrictedSetTypeA, + restrictedSetTypeB, ...}, + iE-Extension ProtocolExtensionContainer { {L839Info-ExtIEs} } OPTIONAL, + ... +} + +L839Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LCID ::= INTEGER (1..32, ...) + + +LCStoGCSTranslationList ::= SEQUENCE (SIZE (1.. maxnooflcs-gcs-translation)) OF LCStoGCSTranslation + +LCStoGCSTranslation ::= SEQUENCE { + alpha INTEGER (0..359), + alpha-fine INTEGER (0..9), + beta INTEGER (0..359), + beta-fine INTEGER (0..9), + gamma INTEGER (0..359), + gamma-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { {LCStoGCSTranslation-ExtIEs} } OPTIONAL +} + +LCStoGCSTranslation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LMF-MeasurementID ::= INTEGER (1.. 65536, ...) + +LMF-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +LocationUncertainty ::= SEQUENCE { + horizontalUncertainty INTEGER (0..255), + horizontalConfidence INTEGER (0..100), + verticalUncertainty INTEGER (0..255), + verticalConfidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { LocationUncertainty-ExtIEs} } OPTIONAL +} + +LocationUncertainty-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LongDRXCycleLength ::= ENUMERATED +{ms10, ms20, ms32, ms40, ms60, ms64, ms70, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ms1024, ms1280, ms2048, ms2560, ms5120, ms10240, ...} + +LowerLayerPresenceStatusChange ::= ENUMERATED { + suspend-lower-layers, + resume-lower-layers, + ... + +} + +LTEUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uELTESidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {LTEUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +LTEUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LTEV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {LTEV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +LTEV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- M + +MappingInformationIndex ::= BIT STRING (SIZE (26)) + +MappingInformationtoRemove ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF MappingInformationIndex + +MaskedIMEISV ::= BIT STRING (SIZE (64)) + +MaxDataBurstVolume ::= INTEGER (0..4095, ..., 4096.. 2000000) +MaxPacketLossRate ::= INTEGER (0..1000) + +MIB-message ::= OCTET STRING + +MeasConfig ::= OCTET STRING + +MeasGapConfig ::= OCTET STRING + +MeasGapSharingConfig ::= OCTET STRING + +MeasurementBeamInfoRequest ::= ENUMERATED {true, ...} + +MeasurementBeamInfo ::= SEQUENCE { + pRS-Resource-ID PRS-Resource-ID OPTIONAL, + pRS-Resource-Set-ID PRS-Resource-Set-ID OPTIONAL, + sSB-Index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { MeasurementBeamInfo-ExtIEs} } OPTIONAL +} + +MeasurementBeamInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MeasurementTimingConfiguration ::= OCTET STRING + +MessageIdentifier ::= BIT STRING (SIZE (16)) + +MultiplexingInfo ::= SEQUENCE{ + iAB-MT-Cell-List IAB-MT-Cell-List, + iE-Extensions ProtocolExtensionContainer { {MultiplexingInfo-ExtIEs} } OPTIONAL +} + +MultiplexingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M2Configuration ::= ENUMERATED {true, ...} + + +M5Configuration ::= SEQUENCE { + m5period M5period, + m5-links-to-log M5-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M5Configuration-ExtIEs} } OPTIONAL, + ... +} + +M5Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M5period ::= ENUMERATED { ms1024, ms2048, ms5120, ms10240, min1, ... } + +M5-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M6Configuration ::= SEQUENCE { + m6report-Interval M6report-Interval, + m6-links-to-log M6-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M6Configuration-ExtIEs} } OPTIONAL, + ... +} + +M6Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M6report-Interval ::= ENUMERATED { ms120, ms240, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1, min6, min12, min30, ... } + + + +M6-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M7Configuration ::= SEQUENCE { + m7period M7period, + m7-links-to-log M7-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M7Configuration-ExtIEs} } OPTIONAL, + ... +} + +M7Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M7period ::= INTEGER(1..60, ...) + +M7-Links-to-log ::= ENUMERATED {downlink, ...} + +MDT-Activation ::= ENUMERATED { + immediate-MDT-only, + immediate-MDT-and-Trace, + ... +} + +MDTConfiguration ::= SEQUENCE { + mdt-Activation MDT-Activation, + measurementsToActivate MeasurementsToActivate, + m2Configuration M2Configuration OPTIONAL, + -- C-ifM2: This IE shall be present if the Measurements to Activate IE has the second bit set to "1". + m5Configuration M5Configuration OPTIONAL, + -- C-ifM5: This IE shall be present if the Measurements to Activate IE has the fifth bit set to "1". + m6Configuration M6Configuration OPTIONAL, + -- C-ifM6: This IE shall be present if the Measurements to Activate IE has the seventh bit set to "1". + m7Configuration M7Configuration OPTIONAL, + -- C-ifM7: This IE shall be present if the Measurements to Activate IE has the eighth bit set to "1". + iE-Extensions ProtocolExtensionContainer { { MDTConfiguration-ExtIEs} } OPTIONAL, + ... +} +MDTConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MDTPLMNList ::= SEQUENCE (SIZE(1..maxnoofMDTPLMNs)) OF PLMN-Identity + + +MeasuredResultsValue ::= CHOICE { + uL-AngleOfArrival UL-AoA, + uL-SRS-RSRP UL-SRS-RSRP, + uL-RTOA UL-RTOA-Measurement, + gNB-RxTxTimeDiff GNB-RxTxTimeDiff, + choice-extension ProtocolIE-SingleContainer { { MeasuredResultsValue-ExtIEs } } +} + +MeasuredResultsValue-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +MeasurementsToActivate ::= BIT STRING (SIZE (8)) + +-- N + +NeedforGap::= ENUMERATED {true, ...} + +Neighbour-Cell-Information-Item ::= SEQUENCE { + nRCGI NRCGI, + intendedTDD-DL-ULConfig IntendedTDD-DL-ULConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Neighbour-Cell-Information-ItemExtIEs } } OPTIONAL +} + +Neighbour-Cell-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NGRANAllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {NGRANAllocationAndRetentionPriority-ExtIEs} } OPTIONAL +} + +NGRANAllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NGRANHighAccuracyAccessPointPosition ::= SEQUENCE { + latitude INTEGER (-2147483648.. 2147483647), + longitude INTEGER (-2147483648.. 2147483647), + altitude INTEGER (-64000..1280000), + uncertaintySemi-major INTEGER (0..255), + uncertaintySemi-minor INTEGER (0..255), + orientationOfMajorAxis INTEGER (0..179), + horizontalConfidence INTEGER (0..100), + uncertaintyAltitude INTEGER (0..255), + verticalConfidence INTEGER (0..100), + + iE-Extensions ProtocolExtensionContainer { { NGRANHighAccuracyAccessPointPosition-ExtIEs} } OPTIONAL +} + +NGRANHighAccuracyAccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NID ::= BIT STRING (SIZE(44)) + +NR-CGI-List-For-Restart-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { NR-CGI-List-For-Restart-ItemExtIEs } } OPTIONAL, + ... +} + +NR-CGI-List-For-Restart-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformation ::= SEQUENCE { + nR-PRSBeamInformationList NR-PRSBeamInformationList, + lCStoGCSTranslationList LCStoGCSTranslationList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformation-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformationList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF NR-PRSBeamInformationItem + +NR-PRSBeamInformationItem ::= SEQUENCE { + pRSResourceSetID INTEGER (0..7), + pRSAngleList PRSAngleList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformationItem-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonDynamic5QIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..127) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +NonDynamicPQIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..8, ...) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonUPTrafficType ::= ENUMERATED {ue-associated, non-ue-associated, non-f1, bap-control-pdu,...} + +NoofDownlinkSymbols ::= INTEGER (0..14) + +NoofUplinkSymbols ::= INTEGER (0..14) + +Notification-Cause ::= ENUMERATED {fulfilled, not-fulfilled, ...} + +NotificationControl ::= ENUMERATED {active, not-active, ...} + +NotificationInformation ::= SEQUENCE { + message-Identifier MessageIdentifier, + serialNumber SerialNumber, + iE-Extensions ProtocolExtensionContainer { { NotificationInformationExtIEs} } OPTIONAL, + ... +} + +NotificationInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NPNBroadcastInformation ::= CHOICE { + sNPN-Broadcast-Information NPN-Broadcast-Information-SNPN, + pNI-NPN-Broadcast-Information NPN-Broadcast-Information-PNI-NPN, + choice-extension ProtocolIE-SingleContainer { {NPNBroadcastInformation-ExtIEs} } +} + +NPNBroadcastInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NPN-Broadcast-Information-SNPN ::= SEQUENCE { + broadcastSNPNID-List BroadcastSNPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-SNPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-SNPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +NPN-Broadcast-Information-PNI-NPN ::= SEQUENCE { + broadcastPNI-NPN-ID-Information BroadcastPNI-NPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-PNI-NPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-PNI-NPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NPNSupportInfo ::= CHOICE { + sNPN-Information NID, + choice-extension ProtocolIE-SingleContainer { { NPNSupportInfo-ExtIEs } } +} + +NPNSupportInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NRCarrierList ::= SEQUENCE (SIZE(1..maxnoofNRSCSs)) OF NRCarrierItem + +NRCarrierItem ::= SEQUENCE { + carrierSCS NRSCS, + offsetToCarrier INTEGER (0..2199, ...), + carrierBandwidth INTEGER (0..maxnoofPhysicalResourceBlocks, ...), + iE-Extension ProtocolExtensionContainer { {NRCarrierItem-ExtIEs} } OPTIONAL, + ... +} + +NRCarrierItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRFreqInfo ::= SEQUENCE { + nRARFCN INTEGER (0..maxNRARFCN), + sul-Information SUL-Information OPTIONAL, + freqBandListNr SEQUENCE (SIZE(1..maxnoofNrCellBands)) OF FreqBandNrItem, + iE-Extensions ProtocolExtensionContainer { { NRFreqInfoExtIEs} } OPTIONAL, + ... +} + +NRFreqInfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +NRCGI ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + nRCellIdentity NRCellIdentity, + iE-Extensions ProtocolExtensionContainer { {NRCGI-ExtIEs} } OPTIONAL, + ... +} + +NRCGI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-Mode-Info ::= CHOICE { + fDD FDD-Info, + tDD TDD-Info, + choice-extension ProtocolIE-SingleContainer { { NR-Mode-Info-ExtIEs} } +} + +NR-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + + +NRPRACHConfig ::= SEQUENCE { + ulPRACHConfigList NRPRACHConfigList OPTIONAL, + sulPRACHConfigList NRPRACHConfigList OPTIONAL, + iE-Extension ProtocolExtensionContainer { {NRPRACHConfig-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRCellIdentity ::= BIT STRING (SIZE(36)) + +NRNRB ::= ENUMERATED { nrb11, nrb18, nrb24, nrb25, nrb31, nrb32, nrb38, nrb51, nrb52, nrb65, nrb66, nrb78, nrb79, nrb93, nrb106, nrb107, nrb121, nrb132, nrb133, nrb135, nrb160, nrb162, nrb189, nrb216, nrb217, nrb245, nrb264, nrb270, nrb273, ...} + +NRPCI ::= INTEGER(0..1007) + + +NRPRACHConfigList ::= SEQUENCE (SIZE(0..maxnoofPRACHconfigs)) OF NRPRACHConfigItem + +NRPRACHConfigItem ::= SEQUENCE { + nRSCS NRSCS, + prachFreqStartfromCarrier INTEGER (0..maxnoofPhysicalResourceBlocks-1, ...), + msg1FDM ENUMERATED {one, two, four, eight, ...}, + parchConfigIndex INTEGER (0..255, ...), + ssb-perRACH-Occasion ENUMERATED {oneEighth, oneFourth, oneHalf, one, + two, four, eight, sixteen, ...}, + freqDomainLength FreqDomainLength, + zeroCorrelZoneConfig INTEGER (0..15), + iE-Extension ProtocolExtensionContainer { { NRPRACHConfigItem-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRSCS ::= ENUMERATED { scs15, scs30, scs60, scs120, ...} + +NRUERLFReportContainer ::= OCTET STRING + +NumberofActiveUEs ::= INTEGER(0..16777215, ...) + +NumberOfBroadcasts ::= INTEGER (0..65535) + +NumberofBroadcastRequest ::= INTEGER (0..65535) + +NumDLULSymbols ::= SEQUENCE { + numDLSymbols INTEGER (0..13, ...), + numULSymbols INTEGER (0..13, ...), + iE-Extensions ProtocolExtensionContainer { { NumDLULSymbols-ExtIEs} } OPTIONAL +} + +NumDLULSymbols-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {NRV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +NRV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uENRSidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {NRUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +NRUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NZP-CSI-RS-ResourceID::= INTEGER (0..191, ...) + + +-- O + +OffsetToPointA ::= INTEGER (0..2199,...) + + +-- P + +PacketDelayBudget ::= INTEGER (0..1023, ...) + +PacketErrorRate ::= SEQUENCE { + pER-Scalar PER-Scalar, + pER-Exponent PER-Exponent, + iE-Extensions ProtocolExtensionContainer { {PacketErrorRate-ExtIEs} } OPTIONAL, + ... +} + +PacketErrorRate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PER-Scalar ::= INTEGER (0..9, ...) +PER-Exponent ::= INTEGER (0..9, ...) + +PagingCell-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { PagingCell-ItemExtIEs } } OPTIONAL +} + +PagingCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PagingDRX ::= ENUMERATED { + v32, + v64, + v128, + v256, + ... +} + +PagingIdentity ::= CHOICE { + rANUEPagingIdentity RANUEPagingIdentity, + cNUEPagingIdentity CNUEPagingIdentity, + choice-extension ProtocolIE-SingleContainer { { PagingIdentity-ExtIEs } } +} + +PagingIdentity-ExtIEs F1AP-PROTOCOL-IES::= { + ... +} + +PagingOrigin ::= ENUMERATED { non-3gpp, ...} + +PagingPriority ::= ENUMERATED { priolevel1, priolevel2, priolevel3, priolevel4, priolevel5, priolevel6, priolevel7, priolevel8,...} + + +RelativePathDelay ::= CHOICE { + k0 INTEGER (0..16351,...), + k1 INTEGER (0..8176,...), + k2 INTEGER (0..4088,...), + k3 INTEGER (0..2044,...), + k4 INTEGER (0..1022,...), + k5 INTEGER (0..511,...), + choice-extension ProtocolIE-SingleContainer { { RelativePathDelay-ExtIEs } } +} + +RelativePathDelay-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PathlossReferenceInfo ::= SEQUENCE { + pathlossReferenceSignal PathlossReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {PathlossReferenceInfo-ExtIEs} } OPTIONAL +} + +PathlossReferenceInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PathlossReferenceSignal ::= CHOICE { + sSB SSB, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{PathlossReferenceSignal-ExtIEs }} +} + +PathlossReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PC5QoSFlowIdentifier ::= INTEGER (1..2048) + +PC5-QoS-Characteristics ::= CHOICE { + non-Dynamic-PQI NonDynamicPQIDescriptor, + dynamic-PQI DynamicPQIDescriptor, + choice-extension ProtocolIE-SingleContainer { { PC5-QoS-Characteristics-ExtIEs } } +} + +PC5-QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +PC5QoSParameters ::= SEQUENCE { + pC5-QoS-Characteristics PC5-QoS-Characteristics, + pC5-QoS-Flow-Bit-Rates PC5FlowBitRates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PC5QoSParameters-ExtIEs } } OPTIONAL, + ... +} + +PC5QoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PC5FlowBitRates ::= SEQUENCE { + guaranteedFlowBitRate BitRate, + maximumFlowBitRate BitRate, + iE-Extensions ProtocolExtensionContainer { { PC5FlowBitRates-ExtIEs } } OPTIONAL, + ... +} + +PC5FlowBitRates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PDCCH-BlindDetectionSCG ::= OCTET STRING + +PDCP-SN ::= INTEGER (0..4095) + +PDCPSNLength ::= ENUMERATED { twelve-bits,eighteen-bits,...} + +PDUSessionID ::= INTEGER (0..255) + +ReportingPeriodicityValue ::= INTEGER (0..512, ...) + +Periodicity ::= INTEGER (0..640000, ...) + +PeriodicitySRS ::= ENUMERATED { ms0p125, ms0p25, ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms4, ms5, ms8, ms10, ms16, ms20, ms32, ms40, ms64, ms80, ms160, ms320, ms640, ms1280, ms2560, ms5120, ms10240, ...} + +PeriodicityList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourcePerSet)) OF PeriodicityList-Item + +PeriodicityList-Item ::= SEQUENCE { + periodicitySRS PeriodicitySRS, + iE-Extensions ProtocolExtensionContainer { { PeriodicityList-ItemExtIEs} } OPTIONAL +} + +PeriodicityList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Permutation ::= ENUMERATED {dfu, ufd, ...} + +Ph-InfoMCG ::= OCTET STRING + +Ph-InfoSCG ::= OCTET STRING + +PLMN-Identity ::= OCTET STRING (SIZE(3)) + +PortNumber ::= BIT STRING (SIZE (16)) + + +PosAssistance-Information ::= OCTET STRING + +PosAssistanceInformationFailureList ::= OCTET STRING + +PosBroadcast ::= ENUMERATED { + start, + stop, + ... +} + +PositioningBroadcastCells ::= SEQUENCE (SIZE (1..maxnoBcastCell)) OF NRCGI + +PosMeasurementPeriodicity ::= ENUMERATED +{ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, min1, min6, min12, min30, min60, ...} + + +PosMeasurementQuantities ::= SEQUENCE (SIZE(1.. maxnoofPosMeas)) OF PosMeasurementQuantities-Item + +PosMeasurementQuantities-Item ::= SEQUENCE { + posMeasurementType PosMeasurementType, + timingReportingGranularityFactor INTEGER (0..5) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementQuantities-ItemExtIEs} } OPTIONAL +} + +PosMeasurementQuantities-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResult ::= SEQUENCE (SIZE (1.. maxnoofPosMeas)) OF PosMeasurementResultItem + +PosMeasurementResultItem ::= SEQUENCE { + measuredResultsValue MeasuredResultsValue, + timeStamp TimeStamp, + measurementQuality TRPMeasurementQuality OPTIONAL, + measurementBeamInfo MeasurementBeamInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultItemExtIEs } } OPTIONAL +} + +PosMeasurementResultItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResultList ::= SEQUENCE (SIZE(1.. maxNoOfMeasTRPs)) OF PosMeasurementResultList-Item + +PosMeasurementResultList-Item ::= SEQUENCE { + posMeasurementResult PosMeasurementResult, + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultList-ItemExtIEs} } OPTIONAL +} + +PosMeasurementResultList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementType ::= ENUMERATED { + gnb-rx-tx, + ul-srs-rsrp, + ul-aoa, + ul-rtoa, + ... +} + +PosReportCharacteristics ::= ENUMERATED { + ondemand, + periodic, + ... +} + +PosResourceSetType ::= CHOICE { + periodic PosResourceSetTypePR, + semi-persistent PosResourceSetTypeSP, + aperiodic PosResourceSetTypeAP, + choice-extension ProtocolIE-SingleContainer {{ PosResourceSetType-ExtIEs }} +} + +PosResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PosResourceSetTypePR ::= SEQUENCE { + posperiodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypePR-ExtIEs} } OPTIONAL +} + +PosResourceSetTypePR-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeSP ::= SEQUENCE { + possemi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeSP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeSP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeAP ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeAP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeAP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceID-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourcePerSet)) OF SRSPosResourceID + +PosSRSResource-Item ::= SEQUENCE { + srs-PosResourceId SRSPosResourceID, + transmissionCombPos TransmissionCombPos, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4, n8, n12}, + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceTypePos ResourceTypePos, + sequenceId INTEGER (0.. 65535), + spatialRelationPos SpatialRelationPos OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosSRSResource-Item-ExtIEs} } OPTIONAL +} + +PosSRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResources)) OF PosSRSResource-Item + +PosSRSResourceSet-Item ::= SEQUENCE { + possrsResourceSetID INTEGER(0..15), + possRSResourceID-List PosSRSResourceID-List, + posresourceSetType PosResourceSetType, + iE-Extensions ProtocolExtensionContainer { { PosSRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PosSRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourceSets)) OF PosSRSResourceSet-Item + +PrimaryPathIndication ::= ENUMERATED { + true, + false, + ... +} + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +ProtectedEUTRAResourceIndication ::= OCTET STRING + +Protected-EUTRA-Resources-Item ::= SEQUENCE { + spectrumSharingGroupID SpectrumSharingGroupID, + eUTRACells-List EUTRACells-List, + iE-Extensions ProtocolExtensionContainer { { Protected-EUTRA-Resources-ItemExtIEs } } OPTIONAL +} + +Protected-EUTRA-Resources-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSConfiguration ::= SEQUENCE { + pRSResourceSet-List PRSResourceSet-List, + iE-Extensions ProtocolExtensionContainer { { PRSConfiguration-ExtIEs } } OPTIONAL +} + +PRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSInformationPos ::= SEQUENCE { + pRS-IDPos INTEGER(0..255) OPTIONAL, + pRS-Resource-Set-IDPos INTEGER(0..7), + pRS-Resource-IDPos INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { PRSInformationPos-ExtIEs} } OPTIONAL +} + +PRSInformationPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Potential-SpCell-Item ::= SEQUENCE { + potential-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Potential-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Potential-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +PRSAngleList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF PRSAngleItem + +PRSAngleItem ::= SEQUENCE { + nR-PRS-Azimuth INTEGER (0..359), + nR-PRS-Azimuth-fine INTEGER (0..9), + nR-PRS-Elevation INTEGER (0..180), + nR-PRS-Elevation-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { { PRSAngleItem-ItemExtIEs } } OPTIONAL +} + +PRSAngleItem-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMuting::= SEQUENCE { + pRSMutingOption1 PRSMutingOption1, + pRSMutingOption2 PRSMutingOption2, + iE-Extensions ProtocolExtensionContainer { { PRSMuting-ExtIEs} } OPTIONAL +} + +PRSMuting-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption1 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + mutingBitRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf8,...}, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption1-ExtIEs} } OPTIONAL +} + +PRSMutingOption1-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption2 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption2-ExtIEs} } OPTIONAL +} + +PRSMutingOption2-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-ID ::= INTEGER (0..63) + +PRSResource-List::= SEQUENCE (SIZE (1..maxnoofPRSresources)) OF PRSResource-Item + +PRSResource-Item ::= SEQUENCE { + pRSResourceID INTEGER(0..63), + sequenceID INTEGER(0..4095,...), + rEOffset INTEGER(0..11), + resourceSlotOffset INTEGER(0..511,...), + resourceSymbolOffset INTEGER(0..12,...), + qCLInfo PRSResource-QCLInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-Item-ExtIEs} } OPTIONAL +} + +PRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLInfo ::= SEQUENCE { + qCLSourceSSBIndex INTEGER(0..63) OPTIONAL, + qCLSourcePRSInfo PRSResource-QCLSourcePRSInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLInfo-ExtIEs} } OPTIONAL, + ... +} +PRSResource-QCLInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLSourcePRSInfo ::= SEQUENCE { + qCLSourcePRSResourceSetID INTEGER(0..7), + qCLSourcePRSResourceID INTEGER(0..63) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLSourcePRSInfo-ExtIEs} } OPTIONAL +} + +PRSResource-QCLSourcePRSInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-Set-ID ::= INTEGER(0..7) + +PRSResourceSet-List ::= SEQUENCE (SIZE (1.. maxnoofPRSresourceSets)) OF PRSResourceSet-Item +PRSResourceSet-Item ::= SEQUENCE { + pRSResourceSetID PRS-Resource-Set-ID, + subcarrierSpacing ENUMERATED{kHz15, kHz30, kHz60, kHz120, ...}, + pRSbandwidth INTEGER(1..63), + startPRB INTEGER(0..2176), + pointA INTEGER (0..3279165), + combSize ENUMERATED{n2, n4, n6, n12, ...}, + cPType ENUMERATED{normal, extended, ...}, + resourceSetPeriodicity ENUMERATED{n4,n5,n8,n10,n16,n20,n32,n40,n64,n80,n160,n320,n640,n1280,n2560,n5120,n10240,n20480,n40960, n81920,...}, + resourceSetSlotOffset INTEGER(0..81919,...), + resourceRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf6,rf8,rf16,rf32,...}, + resourceTimeGap ENUMERATED{tg1,tg2,tg4,tg8,tg16,tg32,...}, + resourceNumberofSymbols ENUMERATED{n2,n4,n6,n12,...}, + pRSMuting PRSMuting OPTIONAL, + pRSResourceTransmitPower INTEGER(-60..50), + pRSResource-List PRSResource-List, + iE-Extensions ProtocolExtensionContainer { { PRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWS-Failed-NR-CGI-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { PWS-Failed-NR-CGI-ItemExtIEs } } OPTIONAL, + ... +} + +PWS-Failed-NR-CGI-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWSSystemInformation ::= SEQUENCE { + sIBtype SIBType-PWS, + sIBmessage OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { PWSSystemInformationExtIEs } } OPTIONAL, + ... +} + +PWSSystemInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-NotificationInformation CRITICALITY ignore EXTENSION NotificationInformation PRESENCE optional}| + { ID id-AdditionalSIBMessageList CRITICALITY reject EXTENSION AdditionalSIBMessageList PRESENCE optional}, + ... +} + +PrivacyIndicator ::= ENUMERATED {immediate-MDT, logged-MDT, ...} + +-- Q + +QCI ::= INTEGER (0..255) + +QoS-Characteristics ::= CHOICE { + non-Dynamic-5QI NonDynamic5QIDescriptor, + dynamic-5QI Dynamic5QIDescriptor, + choice-extension ProtocolIE-SingleContainer { { QoS-Characteristics-ExtIEs } } +} + +QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +QoSFlowIdentifier ::= INTEGER (0..63) + +QoSFlowLevelQoSParameters ::= SEQUENCE { + qoS-Characteristics QoS-Characteristics, + nGRANallocationRetentionPriority NGRANAllocationAndRetentionPriority, + gBR-QoS-Flow-Information GBR-QoSFlowInformation OPTIONAL, + reflective-QoS-Attribute ENUMERATED {subject-to, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { QoSFlowLevelQoSParameters-ExtIEs } } OPTIONAL +} + +QoSFlowLevelQoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-PDUSessionID CRITICALITY ignore EXTENSION PDUSessionID PRESENCE optional}| + { ID id-ULPDUSessionAggregateMaximumBitRate CRITICALITY ignore EXTENSION BitRate PRESENCE optional}| + { ID id-QosMonitoringRequest CRITICALITY ignore EXTENSION QosMonitoringRequest PRESENCE optional}, + ... +} + +QoSFlowMappingIndication ::= ENUMERATED {ul,dl,...} + +QoSInformation ::= CHOICE { + eUTRANQoS EUTRANQoS, + choice-extension ProtocolIE-SingleContainer { { QoSInformation-ExtIEs} } +} + +QoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Information CRITICALITY ignore TYPE DRB-Information PRESENCE mandatory}, + ... +} + +QosMonitoringRequest ::= ENUMERATED {ul, dl, both, ...} + +QoSParaSetIndex ::= INTEGER (1..8, ...) + +QoSParaSetNotifyIndex ::= INTEGER (0..8, ...) + +-- R + +RACH-Config-Common ::= OCTET STRING + +RACH-Config-Common-IAB ::= OCTET STRING + +RACHReportContainer::= OCTET STRING + +RACHReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRACHReports)) OF RACHReportInformationItem + +RACHReportInformationItem ::= SEQUENCE { + rACHReportContainer RACHReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RACHReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RACHReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +RadioResourceStatus ::= SEQUENCE { + sSBAreaRadioResourceStatusList SSBAreaRadioResourceStatusList, + iE-Extensions ProtocolExtensionContainer { { RadioResourceStatus-ExtIEs} } OPTIONAL +} + +RadioResourceStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RANAC ::= INTEGER (0..255) + +RAN-MeasurementID ::= INTEGER (1.. 65536, ...) + +RAN-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +RANUEID ::= OCTET STRING (SIZE (8)) + +RANUEPagingIdentity ::= SEQUENCE { + iRNTI BIT STRING (SIZE(40)), + iE-Extensions ProtocolExtensionContainer { { RANUEPagingIdentity-ExtIEs } } OPTIONAL} + +RANUEPagingIdentity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RAT-FrequencyPriorityInformation::= CHOICE { + eNDC SubscriberProfileIDforRFP, + nGRAN RAT-FrequencySelectionPriority, + choice-extension ProtocolIE-SingleContainer { { RAT-FrequencyPriorityInformation-ExtIEs} } +} + +RAT-FrequencyPriorityInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RAT-FrequencySelectionPriority::= INTEGER (1.. 256, ...) + +Reestablishment-Indication ::= ENUMERATED { + reestablished, + ... +} + +ReferencePoint ::= CHOICE { + coordinateID CoordinateID, + referencePointCoordinate AccessPointPosition, + referencePointCoordinateHA NGRANHighAccuracyAccessPointPosition, + choice-Extension ProtocolIE-SingleContainer { { ReferencePoint-ExtIEs} } +} + +ReferencePoint-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ReferenceSFN ::= INTEGER (0..1023) + +ReferenceSignal ::= CHOICE { + nZP-CSI-RS NZP-CSI-RS-ResourceID, + sSB SSB, + sRS SRSResourceID, + positioningSRS SRSPosResourceID, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{ReferenceSignal-ExtIEs }} +} + +ReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RelativeCartesianLocation ::= SEQUENCE { + xYZunit ENUMERATED {mm, cm, dm, ...}, + xvalue INTEGER (-65536..65535), + yvalue INTEGER (-65536..65535), + zvalue INTEGER (-32768..32767), + locationUncertainty LocationUncertainty, + iE-Extensions ProtocolExtensionContainer { { RelativeCartesianLocation-ExtIEs} } OPTIONAL +} + +RelativeCartesianLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RelativeGeodeticLocation ::= SEQUENCE { + milli-Arc-SecondUnits ENUMERATED {zerodot03, zerodot3, three, ...}, + heightUnits ENUMERATED {mm, cm, m, ...}, + deltaLatitude INTEGER (-1024.. 1023), + deltaLongitude INTEGER (-1024.. 1023), + deltaHeight INTEGER (-1024.. 1023), + locationUncertainty LocationUncertainty, + iE-extensions ProtocolExtensionContainer {{RelativeGeodeticLocation-ExtIEs }} OPTIONAL +} + +RelativeGeodeticLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ReferenceTime ::= OCTET STRING + +RegistrationRequest ::= ENUMERATED{start, stop, add, ...} + +ReportCharacteristics ::= BIT STRING (SIZE(32)) + +ReportingPeriodicity ::= ENUMERATED{ms500, ms1000, ms2000, ms5000, ms10000, ...} + +RequestedBandCombinationIndex ::= OCTET STRING + +RequestedFeatureSetEntryIndex ::= OCTET STRING + +RequestedP-MaxFR2 ::= OCTET STRING + +Requested-PDCCH-BlindDetectionSCG ::= OCTET STRING + + +RequestedSRSTransmissionCharacteristics ::= SEQUENCE { + numberOfTransmissions INTEGER (0..500, ...) OPTIONAL, + resourceType ENUMERATED {periodic, semi-persistent, aperiodic,...}, + bandwidthSRS BandwidthSRS, + sRSResourceSetList SRSResourceSetList OPTIONAL, + sSBInformation SSBInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RequestedSRSTransmissionCharacteristics-ExtIEs} } OPTIONAL +} + +RequestedSRSTransmissionCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RequestType ::= ENUMERATED {offer, execution, ...} + +ResourceCoordinationEUTRACellInfo ::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Coex-Mode-Info, + eUTRA-PRACH-Configuration EUTRA-PRACH-Configuration, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationEUTRACellInfo-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationEUTRACellInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IgnorePRACHConfiguration CRITICALITY reject EXTENSION IgnorePRACHConfiguration PRESENCE optional }, + ... +} + +ResourceCoordinationTransferInformation ::= SEQUENCE { + meNB-Cell-ID EUTRA-Cell-ID, + resourceCoordinationEUTRACellInfo ResourceCoordinationEUTRACellInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationTransferInformation-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationTransferInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceCoordinationTransferContainer ::= OCTET STRING + +ResourceSetType ::= CHOICE { + periodic ResourceSetTypePeriodic, + semi-persistent ResourceSetTypeSemi-persistent, + aperiodic ResourceSetTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceSetType-ExtIEs }} +} + +ResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceSetTypePeriodic ::= SEQUENCE { + periodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeSemi-persistent ::= SEQUENCE { + semi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceSetTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeAperiodic ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + slotoffset INTEGER(1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RepetitionPeriod ::= INTEGER (0..131071, ...) + +ReportingRequestType ::= SEQUENCE { + eventType EventType, + reportingPeriodicityValue ReportingPeriodicityValue OPTIONAL, + -- C-ifEventTypeisPeriodic: This IE shall be present if the Event Type IE is set to "periodic" in the Event Type IE. + iE-Extensions ProtocolExtensionContainer { {ReportingRequestType-ExtIEs} } OPTIONAL +} + +ReportingRequestType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceType ::= CHOICE { + periodic ResourceTypePeriodic, + semi-persistent ResourceTypeSemi-persistent, + aperiodic ResourceTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceType-ExtIEs }} +} + +ResourceType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodic ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistent ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodic ::= SEQUENCE { + aperiodicResourceType ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypePos ::= CHOICE { + periodic ResourceTypePeriodicPos, + semi-persistent ResourceTypeSemi-persistentPos, + aperiodic ResourceTypeAperiodicPos, + choice-extension ProtocolIE-SingleContainer {{ ResourceTypePos-ExtIEs }} +} + +ResourceTypePos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodicPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistentPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistentPos-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistentPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodicPos ::= SEQUENCE { + slotOffset INTEGER (1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationInformation ::= SEQUENCE { + rLCDuplicationStateList RLCDuplicationStateList, + primaryPathIndication PrimaryPathIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationInformation-ExtIEs} } OPTIONAL +} + +RLCDuplicationInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationStateList ::= SEQUENCE (SIZE(1..maxnoofRLCDuplicationState)) OF RLCDuplicationState-Item + +RLCDuplicationState-Item ::=SEQUENCE { + duplicationState DuplicationState, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationState-Item-ExtIEs } } OPTIONAL, + ... +} + + +RLCDuplicationState-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCFailureIndication ::= SEQUENCE { + assocatedLCID LCID, + iE-Extensions ProtocolExtensionContainer { {RLCFailureIndication-ExtIEs} } OPTIONAL +} + +RLCFailureIndication-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCMode ::= ENUMERATED { + rlc-am, + rlc-um-bidirectional, + rlc-um-unidirectional-ul, + rlc-um-unidirectional-dl, + ... +} + +RLC-Status ::= SEQUENCE { + reestablishment-Indication Reestablishment-Indication, + iE-Extensions ProtocolExtensionContainer { { RLC-Status-ExtIEs } } OPTIONAL, + ... +} + +RLC-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLFReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRLFReports)) OF RLFReportInformationItem + +RLFReportInformationItem ::= SEQUENCE { + nRUERLFReportContainer NRUERLFReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RLFReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RLFReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RIMRSDetectionStatus ::= ENUMERATED {rs-detected, rs-disappeared, ...} + +RRCContainer ::= OCTET STRING + +RRCContainer-RRCSetupComplete ::= OCTET STRING + +RRCDeliveryStatus ::= SEQUENCE { + delivery-status PDCP-SN, + triggering-message PDCP-SN, + iE-Extensions ProtocolExtensionContainer { { RRCDeliveryStatus-ExtIEs } } OPTIONAL} + +RRCDeliveryStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +RRCDeliveryStatusRequest ::= ENUMERATED {true, ...} + +RRCReconfigurationCompleteIndicator ::= ENUMERATED { + true, + ..., + failure +} + +RRC-Version ::= SEQUENCE { + latest-RRC-Version BIT STRING (SIZE(3)), + iE-Extensions ProtocolExtensionContainer { { RRC-Version-ExtIEs } } OPTIONAL} + +RRC-Version-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-latest-RRC-Version-Enhanced CRITICALITY ignore EXTENSION OCTET STRING (SIZE(3)) PRESENCE optional }, + ... +} + +RoutingID ::= OCTET STRING + +-- S + +SCell-FailedtoSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-FailedtoSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeRemoved-Item ::= SEQUENCE { + sCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeRemoved-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeRemoved-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCell-ToBeSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCellIndex ::=INTEGER (1..31, ...) + +SCS-SpecificCarrier ::= SEQUENCE { + offsetToCarrier INTEGER (0..2199,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + carrierBandwidth INTEGER (0..275,...), + iE-Extensions ProtocolExtensionContainer { { SCS-SpecificCarrier-ExtIEs } } OPTIONAL +} + +SCS-SpecificCarrier-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Search-window-information ::= SEQUENCE { + expectedPropagationDelay INTEGER (-3841..3841,...), + delayUncertainty INTEGER (1..246,...), + iE-Extensions ProtocolExtensionContainer { { Search-window-information-ExtIEs } } OPTIONAL +} + +Search-window-information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SerialNumber ::= BIT STRING (SIZE (16)) + +SIBType-PWS ::=INTEGER (6..8, ...) + +SelectedBandCombinationIndex ::= OCTET STRING + +SelectedFeatureSetEntryIndex ::= OCTET STRING + +CG-ConfigInfo ::= OCTET STRING + +ServCellIndex ::= INTEGER (0..31, ...) + +ServingCellMO ::= INTEGER (1..64, ...) + +Served-Cell-Information ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI, + fiveGS-TAC FiveGS-TAC OPTIONAL, + configured-EPS-TAC Configured-EPS-TAC OPTIONAL, + servedPLMNs ServedPLMNs-List, + nR-Mode-Info NR-Mode-Info, + measurementTimingConfiguration OCTET STRING, + iE-Extensions ProtocolExtensionContainer { {Served-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RANAC CRITICALITY ignore EXTENSION RANAC PRESENCE optional }| + { ID id-ExtendedServedPLMNs-List CRITICALITY ignore EXTENSION ExtendedServedPLMNs-List PRESENCE optional }| + { ID id-Cell-Direction CRITICALITY ignore EXTENSION Cell-Direction PRESENCE optional }| + { ID id-BPLMN-ID-Info-List CRITICALITY ignore EXTENSION BPLMN-ID-Info-List PRESENCE optional }| + { ID id-Cell-Type CRITICALITY ignore EXTENSION CellType PRESENCE optional}| + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-AggressorgNBSetID CRITICALITY ignore EXTENSION AggressorgNBSetID PRESENCE optional}| + { ID id-VictimgNBSetID CRITICALITY ignore EXTENSION VictimgNBSetID PRESENCE optional}| + { ID id-IAB-Info-IAB-DU CRITICALITY ignore EXTENSION IAB-Info-IAB-DU PRESENCE optional}| + { ID id-SSB-PositionsInBurst CRITICALITY ignore EXTENSION SSB-PositionsInBurst PRESENCE optional }| + { ID id-NRPRACHConfig CRITICALITY ignore EXTENSION NRPRACHConfig PRESENCE optional }, + ... +} + +Served-Cells-To-Add-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Add-ItemExtIEs} } OPTIONAL, + ... +} + +Served-Cells-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Delete-Item ::= SEQUENCE { + oldNRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Delete-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Delete-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Modify-Item ::= SEQUENCE { + oldNRCGI NRCGI , + served-Cell-Information Served-Cell-Information , + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Modify-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Modify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-EUTRA-Cells-Information::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Mode-Info, + protectedEUTRAResourceIndication ProtectedEUTRAResourceIndication, + iE-Extensions ProtocolExtensionContainer { {Served-EUTRA-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-EUTRA-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Service-State ::= ENUMERATED { + in-service, + out-of-service, + ... +} + +Service-Status ::= SEQUENCE { + service-state Service-State, + switchingOffOngoing ENUMERATED {true, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Service-Status-ExtIEs } } OPTIONAL, + ... +} + +Service-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SFNInitialisationTime ::= BIT STRING (SIZE (64)) + +ShortDRXCycleLength ::= ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ...} + +ShortDRXCycleTimer ::= INTEGER (1..16) + +SIB1-message ::= OCTET STRING + +SIB10-message ::= OCTET STRING + +SIB12-message ::= OCTET STRING + +SIB13-message ::= OCTET STRING + +SIB14-message ::= OCTET STRING + +SItype ::= INTEGER (1..32, ...) + +SItype-List ::= SEQUENCE (SIZE(1.. maxnoofSITypes)) OF SItype-Item + +SItype-Item ::= SEQUENCE { + sItype SItype , + iE-Extensions ProtocolExtensionContainer { { SItype-ItemExtIEs } } OPTIONAL +} + +SItype-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SibtypetobeupdatedListItem ::= SEQUENCE { + sIBtype INTEGER (2..32,...), + sIBmessage OCTET STRING, + valueTag INTEGER (0..31,...), + iE-Extensions ProtocolExtensionContainer { { SibtypetobeupdatedListItem-ExtIEs } } OPTIONAL, + ... +} + +SibtypetobeupdatedListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-areaScope CRITICALITY ignore EXTENSION AreaScope PRESENCE optional}, + ... +} + +SLDRBID ::= INTEGER (1..512, ...) + +SLDRBInformation ::= SEQUENCE { + sLDRB-QoS PC5QoSParameters, + flowsMappedToSLDRB-List FlowsMappedToSLDRB-List, + ... +} + +SLDRBs-FailedToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Modified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Modified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ModifiedConf-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ModifiedConf-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Setup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Setup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-SetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-SetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation OPTIONAL, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode, + + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SL-PHY-MAC-RLC-Config ::= OCTET STRING + +SL-ConfigDedicatedEUTRA ::= OCTET STRING + +SliceAvailableCapacity ::= SEQUENCE { + sliceAvailableCapacityList SliceAvailableCapacityList, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacity-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceAvailableCapacityList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceAvailableCapacityItem + +SliceAvailableCapacityItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIAvailableCapacity-List SNSSAIAvailableCapacity-List, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacityItem-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacityItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SNSSAIAvailableCapacity-List ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAIAvailableCapacity-Item + +SNSSAIAvailableCapacity-Item ::= SEQUENCE { + sNSSAI SNSSAI, + sliceAvailableCapacityValueDownlink INTEGER (0..100) OPTIONAL, + sliceAvailableCapacityValueUplink INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SNSSAIAvailableCapacity-Item-ExtIEs } } OPTIONAL +} + +SNSSAIAvailableCapacity-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SliceSupportItem + +SliceSupportItem ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SliceSupportItem-ExtIEs } } OPTIONAL +} + +SliceSupportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceToReportList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceToReportItem + +SliceToReportItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIlist SNSSAI-list, + iE-Extensions ProtocolExtensionContainer { { SliceToReportItem-ExtIEs} } OPTIONAL +} + +SliceToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SlotNumber ::= INTEGER (0..79) + +SNSSAI-list ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAI-Item + +SNSSAI-Item ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SNSSAI-Item-ExtIEs } } OPTIONAL +} + +SNSSAI-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Slot-Configuration-List ::= SEQUENCE (SIZE(1.. maxnoofslots)) OF Slot-Configuration-Item + +Slot-Configuration-Item ::= SEQUENCE { + slotIndex INTEGER (0..5119, ...), + symbolAllocInSlot SymbolAllocInSlot, + iE-Extensions ProtocolExtensionContainer { { Slot-Configuration-ItemExtIEs } } OPTIONAL +} + +Slot-Configuration-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SNSSAI ::= SEQUENCE { + sST OCTET STRING (SIZE(1)), + sD OCTET STRING (SIZE(3)) OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SNSSAI-ExtIEs } } OPTIONAL +} + +SNSSAI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialDirectionInformation ::= SEQUENCE { + nR-PRSBeamInformation NR-PRSBeamInformation, + iE-Extensions ProtocolExtensionContainer { { SpatialDirectionInformation-ExtIEs } } OPTIONAL +} + +SpatialDirectionInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationInfo ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationInfo-ExtIEs} } OPTIONAL +} + +SpatialRelationInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationforResourceID ::= SEQUENCE (SIZE(1..maxnoofSpatialRelations)) OF SpatialRelationforResourceIDItem + +SpatialRelationforResourceIDItem ::= SEQUENCE { + referenceSignal ReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationforResourceIDItem-ExtIEs} } OPTIONAL +} + +SpatialRelationforResourceIDItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationPos ::= CHOICE { + sSBPos SSBPos, + pRSInformationPos PRSInformationPos, + choice-extension ProtocolIE-SingleContainer {{ SpatialInformationPos-ExtIEs }} +} + +SpatialInformationPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SpectrumSharingGroupID ::= INTEGER (1..maxCellineNB) + +SRBID ::= INTEGER (0..3, ...) + +SRBs-FailedToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Modified-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Setup-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-SetupMod-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRBs-ToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID, + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRSCarrier-List ::= SEQUENCE (SIZE(1.. maxnoSRS-Carriers)) OF SRSCarrier-List-Item + +SRSCarrier-List-Item ::= SEQUENCE { + pointA INTEGER (0..3279165,...), + uplinkChannelBW-PerSCS-List UplinkChannelBW-PerSCS-List, + activeULBWP ActiveULBWP, + pci NRPCI, + iE-Extensions ProtocolExtensionContainer { { SRSCarrier-List-Item-ExtIEs } } OPTIONAL +} + +SRSCarrier-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfig ::= SEQUENCE { + sRSResource-List SRSResource-List OPTIONAL, + posSRSResource-List PosSRSResource-List OPTIONAL, + sRSResourceSet-List SRSResourceSet-List OPTIONAL, + posSRSResourceSet-List PosSRSResourceSet-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSConfig-ExtIEs } } OPTIONAL +} + +SRSConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfiguration ::= SEQUENCE { + sRSCarrier-List SRSCarrier-List, + iE-Extensions ProtocolExtensionContainer { { SRSConfiguration-ExtIEs } } OPTIONAL +} + +SRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSPosResourceID ::= INTEGER (0..63, ...) + +SRSResource::= SEQUENCE { + sRSResourceID SRSResourceID, + nrofSRS-Ports ENUMERATED {port1, ports2, ports4}, + transmissionComb TransmissionComb, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4}, + repetitionFactor ENUMERATED {n1, n2, n4}, + freqDomainPosition INTEGER (0..67), + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + b-SRS INTEGER (0..3), + b-hop INTEGER (0..3), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceType ResourceType, + slotOffset INTEGER (0..2559), + sequenceId INTEGER (0..1023), + iE-Extensions ProtocolExtensionContainer { { SRSResource-ExtIEs } } OPTIONAL +} + +SRSResource-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceID ::= INTEGER (0..63, ...) + +SRSResourceID-List::= SEQUENCE (SIZE (1..maxnoSRS-ResourcePerSet)) OF SRSResourceID + +SRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-Resources)) OF SRSResource + +SRSResourceSet::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSResourceID-List SRSResourceID-List, + resourceSetType ResourceSetType, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSet-ExtIEs } } OPTIONAL +} + +SRSResourceSet-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSetID ::= INTEGER (0..15, ...) + +SRSResourceSetList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourceSets)) OF SRSResourceSetItem + +SRSResourceSetItem ::= SEQUENCE { + numSRSresourcesperset INTEGER (1..16, ...) OPTIONAL, + periodicityList PeriodicityList OPTIONAL, + spatialRelationInfo SpatialRelationInfo OPTIONAL, + pathlossReferenceInfo PathlossReferenceInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSetItemExtIEs } } OPTIONAL +} + +SRSResourceSetItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-ResourceSets)) OF SRSResourceSet + +SRSResourceTrigger ::= SEQUENCE { + aperiodicSRSResourceTriggerList AperiodicSRSResourceTriggerList, + iE-Extensions ProtocolExtensionContainer { {SRSResourceTrigger-ExtIEs} } OPTIONAL +} + +SRSResourceTrigger-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSSpatialRelation ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SRSSpatialRelation-ExtIEs} } OPTIONAL +} + +SRSSpatialRelation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB ::= SEQUENCE { + pCI-NR NRPCI, + ssb-index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SSB-ExtIEs} } OPTIONAL +} + +SSB-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-freqInfo ::= INTEGER (0..maxNRARFCN) + +SSB-Index ::= INTEGER(0..63) + +SSBPos ::= SEQUENCE { + pCI-NR NRPCI OPTIONAL, + ssb-index SSB-Index, + iE-Extensions ProtocolExtensionContainer { {SSBPos-ExtIEs} } OPTIONAL +} + +SSBPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-subcarrierSpacing ::= ENUMERATED {kHz15, kHz30, kHz120, kHz240, spare3, spare2, spare1, ...} + +SSB-transmissionPeriodicity ::= ENUMERATED {sf10, sf20, sf40, sf80, sf160, sf320, sf640, ...} + +SSB-transmissionTimingOffset ::= INTEGER (0..127, ...) + +SSB-transmissionBitmap ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { { SSB-transmisisonBitmap-ExtIEs} } +} + +SSB-transmisisonBitmap-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSBAreaCapacityValueList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaCapacityValueItem + +SSBAreaCapacityValueItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaCapacityValue INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { SSBAreaCapacityValueItem-ExtIEs} } OPTIONAL +} + +SSBAreaCapacityValueItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBAreaRadioResourceStatusList::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaRadioResourceStatusItem + +SSBAreaRadioResourceStatusItem::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaDLGBRPRBusage INTEGER (0..100), + sSBAreaULGBRPRBusage INTEGER (0..100), + sSBAreaDLnon-GBRPRBusage INTEGER (0..100), + sSBAreaULnon-GBRPRBusage INTEGER (0..100), + sSBAreaDLTotalPRBusage INTEGER (0..100), + sSBAreaULTotalPRBusage INTEGER (0..100), + dLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + uLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSBAreaRadioResourceStatusItem-ExtIEs} } OPTIONAL +} + +SSBAreaRadioResourceStatusItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformation ::= SEQUENCE { + sSBInformationList SSBInformationList, + iE-Extensions ProtocolExtensionContainer { { SSBInformation-ExtIEs } } OPTIONAL +} + +SSBInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformationList ::= SEQUENCE (SIZE(1.. maxnoofSSBs)) OF SSBInformationItem + +SSBInformationItem ::= SEQUENCE { + sSB-Configuration SSB-TF-Configuration, + pCI-NR NRPCI, + iE-Extensions ProtocolExtensionContainer { { SSBInformationItem-ExtIEs } } OPTIONAL +} + +SSBInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-PositionsInBurst ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { {SSB-PositionsInBurst-ExtIEs} } +} + +SSB-PositionsInBurst-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSB-TF-Configuration ::= SEQUENCE { + sSB-frequency INTEGER (0..3279165), + sSB-subcarrier-spacing ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, ...}, + sSB-Transmit-power INTEGER (-60..50), + sSB-periodicity ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, ...}, + sSB-half-frame-offset INTEGER(0..1), + sSB-SFN-offset INTEGER(0..15), + sSB-position-in-burst SSB-PositionsInBurst OPTIONAL, + sFNInitialisationTime SFNInitialisationTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSB-TF-Configuration-ExtIEs} } OPTIONAL +} + +SSB-TF-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SSBToReportList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBToReportItem + +SSBToReportItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { SSBToReportItem-ExtIEs} } OPTIONAL +} + +SSBToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SUL-Information ::= SEQUENCE { + sUL-NRARFCN INTEGER (0..maxNRARFCN), + sUL-transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { { SUL-InformationExtIEs} } OPTIONAL, + ... +} + +SUL-InformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +SubcarrierSpacing ::= ENUMERATED { kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1, ...} + +SubscriberProfileIDforRFP ::= INTEGER (1..256, ...) + +SULAccessIndication ::= ENUMERATED {true,...} + + +SupportedSULFreqBandItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + iE-Extensions ProtocolExtensionContainer { { SupportedSULFreqBandItem-ExtIEs} } OPTIONAL, + ... +} + +SupportedSULFreqBandItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SymbolAllocInSlot ::= CHOICE { + all-DL NULL, + all-UL NULL, + both-DL-and-UL NumDLULSymbols, + choice-extension ProtocolIE-SingleContainer { { SymbolAllocInSlot-ExtIEs } } +} + +SymbolAllocInSlot-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SystemFrameNumber ::= INTEGER (0..1023) + +SystemInformationAreaID ::=BIT STRING (SIZE (24)) + +-- T + +FiveGS-TAC ::= OCTET STRING (SIZE(3)) + +Configured-EPS-TAC ::= OCTET STRING (SIZE(2)) + +TargetCellList ::= SEQUENCE (SIZE(1..maxnoofCHOcells)) OF TargetCellList-Item + +TargetCellList-Item ::= SEQUENCE { + target-cell NRCGI, + iE-Extensions ProtocolExtensionContainer { { TargetCellList-Item-ExtIEs} } OPTIONAL +} + +TargetCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TDD-Info ::= SEQUENCE { + nRFreqInfo NRFreqInfo, + transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IntendedTDD-DL-ULConfig CRITICALITY ignore EXTENSION IntendedTDD-DL-ULConfig PRESENCE optional}| + {ID id-TDD-UL-DLConfigCommonNR CRITICALITY ignore EXTENSION TDD-UL-DLConfigCommonNR PRESENCE optional }| + {ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +TDD-UL-DLConfigCommonNR ::= OCTET STRING + +TimeReferenceInformation ::= SEQUENCE { + referenceTime ReferenceTime, + referenceSFN ReferenceSFN, + uncertainty Uncertainty, + timeInformationType TimeInformationType, + iE-Extensions ProtocolExtensionContainer { {TimeReferenceInformation-ExtIEs} } OPTIONAL +} + +TimeReferenceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeInformationType ::= ENUMERATED {localClock} + +TimeStamp ::= SEQUENCE { + systemFrameNumber SystemFrameNumber, + slotIndex TimeStampSlotIndex, + measurementTime SFNInitialisationTime OPTIONAL, + iE-Extension ProtocolExtensionContainer { { TimeStamp-ExtIEs} } OPTIONAL +} + +TimeStamp-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeStampSlotIndex ::= CHOICE { + sCS-15 INTEGER(0..9), + sCS-30 INTEGER(0..19), + sCS-60 INTEGER(0..39), + sCS-120 INTEGER(0..79), + choice-extension ProtocolIE-SingleContainer { { TimeStampSlotIndex-ExtIEs} } +} + +TimeStampSlotIndex-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TimeToWait ::= ENUMERATED {v1s, v2s, v5s, v10s, v20s, v60s, ...} + +TimingMeasurementQuality ::= SEQUENCE { + measurementQuality INTEGER(0..31), + resolution ENUMERATED{m0dot1, m1, m10, m30, ...}, + iE-Extensions ProtocolExtensionContainer { { TimingMeasurementQuality-ExtIEs} } OPTIONAL +} + +TimingMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TNLAssociationUsage ::= ENUMERATED { + ue, + non-ue, + both, + ... +} + +TNLCapacityIndicator::= SEQUENCE { + dLTNLOfferedCapacity INTEGER (1.. 16777216,...), + dLTNLAvailableCapacity INTEGER (0.. 100,...), + uLTNLOfferedCapacity INTEGER (1.. 16777216,...), + uLTNLAvailableCapacity INTEGER (0.. 100,...), + iE-Extensions ProtocolExtensionContainer { { TNLCapacityIndicator-ExtIEs} } OPTIONAL +} + +TNLCapacityIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TraceActivation ::= SEQUENCE { + traceID TraceID, + interfacesToTrace InterfacesToTrace, + traceDepth TraceDepth, + traceCollectionEntityIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { {TraceActivation-ExtIEs} } OPTIONAL +} + +TraceActivation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-mdtConfiguration CRITICALITY ignore EXTENSION MDTConfiguration PRESENCE optional}| + {ID id-TraceCollectionEntityURI CRITICALITY ignore EXTENSION URI-address PRESENCE optional }, + ... +} + +TraceDepth ::= ENUMERATED { + minimum, + medium, + maximum, + minimumWithoutVendorSpecificExtension, + mediumWithoutVendorSpecificExtension, + maximumWithoutVendorSpecificExtension, + ... +} + +TraceID ::= OCTET STRING (SIZE(8)) + +TrafficMappingInfo ::= CHOICE { + iPtolayer2TrafficMappingInfo IPtolayer2TrafficMappingInfo, + bAPlayerBHRLCchannelMappingInfo BAPlayerBHRLCchannelMappingInfo, + choice-extension ProtocolIE-SingleContainer { { TrafficMappingInfo-ExtIEs} } +} + +TrafficMappingInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TransactionID ::= INTEGER (0..255, ...) + +Transmission-Bandwidth ::= SEQUENCE { + nRSCS NRSCS, + nRNRB NRNRB, + iE-Extensions ProtocolExtensionContainer { { Transmission-Bandwidth-ExtIEs} } OPTIONAL, + ... +} + +Transmission-Bandwidth-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionComb ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + choice-extension ProtocolIE-SingleContainer { { TransmissionComb-ExtIEs} } +} +TransmissionComb-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransmissionCombPos ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + n8 SEQUENCE { + combOffset-n8 INTEGER (0..7), + cyclicShift-n8 INTEGER (0..5) + }, + + choice-extension ProtocolIE-SingleContainer { { TransmissionCombPos-ExtIEs} } +} +TransmissionCombPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Add-Item + +Transport-UP-Layer-Address-Info-To-Add-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToAdd GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Remove-Item + +Transport-UP-Layer-Address-Info-To-Remove-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToRemove GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionActionIndicator ::= ENUMERATED {stop, ..., restart } + +TRPID ::= INTEGER (0.. maxnoofTRPs, ...) + +TRPInformation ::= SEQUENCE { + tRPID TRPID, + tRPInformationTypeResponseList TRPInformationTypeResponseList, + iE-Extensions ProtocolExtensionContainer { { TRPInformation-ExtIEs } } OPTIONAL +} + +TRPInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationItem ::= SEQUENCE { + tRPInformation TRPInformation, + iE-Extensions ProtocolExtensionContainer { { TRPInformationItem-ExtIEs } } OPTIONAL +} + +TRPInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationTypeItem ::= ENUMERATED { + nrPCI, + nG-RAN-CGI, + arfcn, + pRSConfig, + sSBConfig, + sFNInitTime, + spatialDirectInfo, + geoCoord, +...} + + +TRPInformationTypeResponseList ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF TRPInformationTypeResponseItem + +TRPInformationTypeResponseItem ::= CHOICE { + pCI-NR NRPCI, + nG-RAN-CGI NRCGI, + nRARFCN INTEGER (0..maxNRARFCN), + pRSConfiguration PRSConfiguration, + sSBinformation SSBInformation, + sFNInitialisationTime SFNInitialisationTime, + spatialDirectionInformation SpatialDirectionInformation, + geographicalCoordinates GeographicalCoordinates, + choice-extension ProtocolIE-SingleContainer { { TRPInformationTypeResponseItem-ExtIEs} } +} + +TRPInformationTypeResponseItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +TRPList ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF TRPListItem + +TRPListItem ::= SEQUENCE { + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { TRPListItem-ExtIEs } } OPTIONAL +} + +TRPListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality ::= SEQUENCE { + tRPmeasurementQuality-Item TRPMeasurementQuality-Item, + iE-Extensions ProtocolExtensionContainer { {TRPMeasurementQuality-ExtIEs} } OPTIONAL +} + +TRPMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality-Item ::= CHOICE { + timingMeasurementQuality TimingMeasurementQuality, + angleMeasurementQuality AngleMeasurementQuality, + choice-extension ProtocolIE-SingleContainer { { TRPMeasurementQuality-Item-ExtIEs } } +} + +TRPMeasurementQuality-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRP-MeasurementRequestList ::= SEQUENCE (SIZE (1..maxNoOfMeasTRPs)) OF TRP-MeasurementRequestItem + +TRP-MeasurementRequestItem ::= SEQUENCE { + tRPID TRPID, + search-window-information Search-window-information OPTIONAL, + iE-extensions ProtocolExtensionContainer { { TRP-MeasurementRequestItem-ExtIEs } } OPTIONAL +} + +TRP-MeasurementRequestItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDefinitionType ::= CHOICE { + direct TRPPositionDirect, + referenced TRPPositionReferenced, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDefinitionType-ExtIEs } } +} + +TRPPositionDefinitionType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionDirect ::= SEQUENCE { + accuracy TRPPositionDirectAccuracy, + iE-extensions ProtocolExtensionContainer { { TRPPositionDirect-ExtIEs } } OPTIONAL +} + +TRPPositionDirect-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDirectAccuracy ::= CHOICE { + tRPPosition AccessPointPosition, + tRPHAposition NGRANHighAccuracyAccessPointPosition, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDirectAccuracy-ExtIEs } } +} + +TRPPositionDirectAccuracy-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionReferenced ::= SEQUENCE { + referencePoint ReferencePoint, + referencePointType TRPReferencePointType, + iE-extensions ProtocolExtensionContainer { { TRPPositionReferenced-ExtIEs } } OPTIONAL +} + +TRPPositionReferenced-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPReferencePointType ::= CHOICE { + tRPPositionRelativeGeodetic RelativeGeodeticLocation, + tRPPositionRelativeCartesian RelativeCartesianLocation, + choice-extension ProtocolIE-SingleContainer { { TRPReferencePointType-ExtIEs } } +} + +TRPReferencePointType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + +Transport-Layer-Address-Info ::= SEQUENCE { + transport-UP-Layer-Address-Info-To-Add-List Transport-UP-Layer-Address-Info-To-Add-List OPTIONAL, + transport-UP-Layer-Address-Info-To-Remove-List Transport-UP-Layer-Address-Info-To-Remove-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-Layer-Address-Info-ExtIEs } } OPTIONAL +} + +Transport-Layer-Address-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCAssistanceInformation ::= SEQUENCE { + periodicity Periodicity, + burstArrivalTime BurstArrivalTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCAssistanceInformation-ExtIEs} } OPTIONAL, + ... +} + +TSCAssistanceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCTrafficCharacteristics ::= SEQUENCE { + tSCAssistanceInformationDL TSCAssistanceInformation OPTIONAL, + tSCAssistanceInformationUL TSCAssistanceInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCTrafficCharacteristics-ExtIEs} } OPTIONAL, + ... +} + +TSCTrafficCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- U +UAC-Assistance-Info ::= SEQUENCE { + uACPLMN-List UACPLMN-List, + iE-Extensions ProtocolExtensionContainer { { UAC-Assistance-InfoExtIEs} } OPTIONAL +} + +UAC-Assistance-InfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACPLMN-List ::= SEQUENCE (SIZE(1..maxnoofUACPLMNs)) OF UACPLMN-Item + +UACPLMN-Item::= SEQUENCE { + pLMNIdentity PLMN-Identity, + uACType-List UACType-List, iE-Extensions ProtocolExtensionContainer { { UACPLMN-Item-ExtIEs} } OPTIONAL +} + +UACPLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NID CRITICALITY ignore EXTENSION NID PRESENCE optional }, + ... +} + +UACType-List ::= SEQUENCE (SIZE(1..maxnoofUACperPLMN)) OF UACType-Item + +UACType-Item::= SEQUENCE { + uACReductionIndication UACReductionIndication, + uACCategoryType UACCategoryType, + iE-Extensions ProtocolExtensionContainer { { UACType-Item-ExtIEs } } OPTIONAL +} + +UACType-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACCategoryType ::= CHOICE { + uACstandardized UACAction, + uACOperatorDefined UACOperatorDefined, + choice-extension ProtocolIE-SingleContainer { { UACCategoryType-ExtIEs } } +} + +UACCategoryType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UACOperatorDefined ::= SEQUENCE { + accessCategory INTEGER (32..63,...), + accessIdentity BIT STRING (SIZE(7)), + iE-Extensions ProtocolExtensionContainer { { UACOperatorDefined-ExtIEs} } OPTIONAL +} + +UACOperatorDefined-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +UACAction ::= ENUMERATED { + reject-non-emergency-mo-dt, + reject-rrc-cr-signalling, + permit-emergency-sessions-and-mobile-terminated-services-only, + permit-high-priority-sessions-and-mobile-terminated-services-only, + ... +} + +UACReductionIndication ::= INTEGER (0..100) + + +UE-associatedLogicalF1-ConnectionItem ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID OPTIONAL, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalF1-ConnectionItemExtIEs} } OPTIONAL, + ... +} + +UEAssistanceInformation ::= OCTET STRING + +UEAssistanceInformationEUTRA ::= OCTET STRING + +UE-associatedLogicalF1-ConnectionItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-CapabilityRAT-ContainerList::= OCTET STRING + +UEContextNotRetrievable ::= ENUMERATED {true, ...} + +UEIdentityIndexValue ::= CHOICE { + indexLength10 BIT STRING (SIZE (10)), + choice-extension ProtocolIE-SingleContainer { {UEIdentityIndexValueChoice-ExtIEs} } +} + +UEIdentityIndexValueChoice-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-AoA ::= SEQUENCE { + azimuthAoA INTEGER (0..3599), + zenithAoA INTEGER (0..1799) OPTIONAL, + angleCoordinateSystem ENUMERATED {lCS, gCS} OPTIONAL, + iE-extensions ProtocolExtensionContainer { { UL-AoA-ExtIEs } } +} + +UL-AoA-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping ::= SEQUENCE { + uL-BH-Non-UP-Traffic-Mapping-List UL-BH-Non-UP-Traffic-Mapping-List, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping-List ::= SEQUENCE (SIZE(1..maxnoofNonUPTrafficMappings)) OF UL-BH-Non-UP-Traffic-Mapping-Item + +UL-BH-Non-UP-Traffic-Mapping-Item ::= SEQUENCE { + nonUPTrafficType NonUPTrafficType, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULConfiguration ::= SEQUENCE { + uLUEConfiguration ULUEConfiguration, + iE-Extensions ProtocolExtensionContainer { { ULConfigurationExtIEs } } OPTIONAL, + ... +} +ULConfigurationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-Measurement ::= SEQUENCE { + uL-RTOA-MeasurementItem UL-RTOA-MeasurementItem, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UL-RTOA-Measurement-ExtIEs } } OPTIONAL +} + +UL-RTOA-Measurement-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-MeasurementItem ::= CHOICE { + k0 INTEGER (0..1970049), + k1 INTEGER (0..985025), + k2 INTEGER (0..492513), + k3 INTEGER (0..246257), + k4 INTEGER (0..123129), + k5 INTEGER (0..61565), + choice-extension ProtocolIE-SingleContainer { { UL-RTOA-MeasurementItem-ExtIEs } } +} + +UL-RTOA-MeasurementItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-SRS-RSRP ::= INTEGER (0..127) + +ULUEConfiguration ::= ENUMERATED {no-data, shared, only, ...} + +UL-UP-TNL-Information-to-Update-List-Item ::= SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + newULUPTNLInformation UPTransportLayerInformation OPTIONAL, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Information-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Information-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofULUPTNLInformation)) OF ULUPTNLInformation-ToBeSetup-Item + +ULUPTNLInformation-ToBeSetup-Item ::=SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { ULUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +ULUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-BHInfo CRITICALITY ignore EXTENSION BHInfo PRESENCE optional }, + ... +} + +Uncertainty ::= INTEGER (0..32767, ...) + +UplinkChannelBW-PerSCS-List ::= SEQUENCE (SIZE (1..maxnoSCSs)) OF SCS-SpecificCarrier + +UplinkTxDirectCurrentListInformation ::= OCTET STRING + +UPTransportLayerInformation ::= CHOICE { + gTPTunnel GTPTunnel, + choice-extension ProtocolIE-SingleContainer { { UPTransportLayerInformation-ExtIEs} } +} + +UPTransportLayerInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +URI-address ::= VisibleString + +-- V + +VictimgNBSetID ::= SEQUENCE { + victimgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { VictimgNBSetID-ExtIEs } } OPTIONAL +} + +VictimgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +VehicleUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +PedestrianUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +-- W + +-- X + +-- Y + +-- Z + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +F1AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0..65535), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + +ProtocolExtensionID ::= INTEGER (0..65535) + +ProtocolIE-ID ::= INTEGER (0..65535) + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessful-outcome } + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +F1AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ProcedureCode, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes; + + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-Reset ProcedureCode ::= 0 +id-F1Setup ProcedureCode ::= 1 +id-ErrorIndication ProcedureCode ::= 2 +id-gNBDUConfigurationUpdate ProcedureCode ::= 3 +id-gNBCUConfigurationUpdate ProcedureCode ::= 4 +id-UEContextSetup ProcedureCode ::= 5 +id-UEContextRelease ProcedureCode ::= 6 +id-UEContextModification ProcedureCode ::= 7 +id-UEContextModificationRequired ProcedureCode ::= 8 +id-UEMobilityCommand ProcedureCode ::= 9 +id-UEContextReleaseRequest ProcedureCode ::= 10 +id-InitialULRRCMessageTransfer ProcedureCode ::= 11 +id-DLRRCMessageTransfer ProcedureCode ::= 12 +id-ULRRCMessageTransfer ProcedureCode ::= 13 +id-privateMessage ProcedureCode ::= 14 +id-UEInactivityNotification ProcedureCode ::= 15 +id-GNBDUResourceCoordination ProcedureCode ::= 16 +id-SystemInformationDeliveryCommand ProcedureCode ::= 17 +id-Paging ProcedureCode ::= 18 +id-Notify ProcedureCode ::= 19 +id-WriteReplaceWarning ProcedureCode ::= 20 +id-PWSCancel ProcedureCode ::= 21 +id-PWSRestartIndication ProcedureCode ::= 22 +id-PWSFailureIndication ProcedureCode ::= 23 +id-GNBDUStatusIndication ProcedureCode ::= 24 +id-RRCDeliveryReport ProcedureCode ::= 25 +id-F1Removal ProcedureCode ::= 26 +id-NetworkAccessRateReduction ProcedureCode ::= 27 +id-TraceStart ProcedureCode ::= 28 +id-DeactivateTrace ProcedureCode ::= 29 +id-DUCURadioInformationTransfer ProcedureCode ::= 30 +id-CUDURadioInformationTransfer ProcedureCode ::= 31 +id-BAPMappingConfiguration ProcedureCode ::= 32 +id-GNBDUResourceConfiguration ProcedureCode ::= 33 +id-IABTNLAddressAllocation ProcedureCode ::= 34 +id-IABUPConfigurationUpdate ProcedureCode ::= 35 +id-resourceStatusReportingInitiation ProcedureCode ::= 36 +id-resourceStatusReporting ProcedureCode ::= 37 +id-accessAndMobilityIndication ProcedureCode ::= 38 +id-accessSuccess ProcedureCode ::= 39 +id-cellTrafficTrace ProcedureCode ::= 40 +id-PositioningMeasurementExchange ProcedureCode ::= 41 +id-PositioningAssistanceInformationControl ProcedureCode ::= 42 +id-PositioningAssistanceInformationFeedback ProcedureCode ::= 43 +id-PositioningMeasurementReport ProcedureCode ::= 44 +id-PositioningMeasurementAbort ProcedureCode ::= 45 +id-PositioningMeasurementFailureIndication ProcedureCode ::= 46 +id-PositioningMeasurementUpdate ProcedureCode ::= 47 +id-TRPInformationExchange ProcedureCode ::= 48 +id-PositioningInformationExchange ProcedureCode ::= 49 +id-PositioningActivation ProcedureCode ::= 50 +id-PositioningDeactivation ProcedureCode ::= 51 +id-E-CIDMeasurementInitiation ProcedureCode ::= 52 +id-E-CIDMeasurementFailureIndication ProcedureCode ::= 53 +id-E-CIDMeasurementReport ProcedureCode ::= 54 +id-E-CIDMeasurementTermination ProcedureCode ::= 55 +id-PositioningInformationUpdate ProcedureCode ::= 56 +id-ReferenceTimeInformationReport ProcedureCode ::= 57 +id-ReferenceTimeInformationReportingControl ProcedureCode ::= 58 + + + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxNRARFCN INTEGER ::= 3279165 +maxnoofErrors INTEGER ::= 256 +maxnoofIndividualF1ConnectionsToReset INTEGER ::= 65536 +maxCellingNBDU INTEGER ::= 512 +maxnoofSCells INTEGER ::= 32 +maxnoofSRBs INTEGER ::= 8 +maxnoofDRBs INTEGER ::= 64 +maxnoofULUPTNLInformation INTEGER ::= 2 +maxnoofDLUPTNLInformation INTEGER ::= 2 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofCandidateSpCells INTEGER ::= 64 +maxnoofPotentialSpCells INTEGER ::= 64 +maxnoofNrCellBands INTEGER ::= 32 +maxnoofSIBTypes INTEGER ::= 32 +maxnoofSITypes INTEGER ::= 32 +maxnoofPagingCells INTEGER ::= 512 +maxnoofTNLAssociations INTEGER ::= 32 +maxnoofQoSFlows INTEGER ::= 64 +maxnoofSliceItems INTEGER ::= 1024 +maxCellineNB INTEGER ::= 256 +maxnoofExtendedBPLMNs INTEGER ::= 6 +maxnoofUEIDs INTEGER ::= 65536 +maxnoofBPLMNsNR INTEGER ::= 12 +maxnoofUACPLMNs INTEGER ::= 12 +maxnoofUACperPLMN INTEGER ::= 64 +maxnoofAdditionalSIBs INTEGER ::= 63 +maxnoofslots INTEGER ::= 5120 +maxnoofTLAs INTEGER ::= 16 +maxnoofGTPTLAs INTEGER ::= 16 +maxnoofBHRLCChannels INTEGER ::= 65536 +maxnoofRoutingEntries INTEGER ::= 1024 +maxnoofIABSTCInfo INTEGER ::= 45 +maxnoofSymbols INTEGER ::= 14 +maxnoofServingCells INTEGER ::= 32 +maxnoofDUFSlots INTEGER ::= 320 +maxnoofHSNASlots INTEGER ::= 5120 +maxnoofServedCellsIAB INTEGER ::= 512 +maxnoofChildIABNodes INTEGER ::= 1024 +maxnoofNonUPTrafficMappings INTEGER ::= 32 +maxnoofTLAsIAB INTEGER ::= 1024 +maxnoofMappingEntries INTEGER ::= 67108864 +maxnoofDSInfo INTEGER ::= 64 +maxnoofEgressLinks INTEGER ::= 2 +maxnoofULUPTNLInformationforIAB INTEGER ::= 32678 +maxnoofUPTNLAddresses INTEGER ::= 8 +maxnoofSLDRBs INTEGER ::= 512 +maxnoofQoSParaSets INTEGER ::= 8 +maxnoofPC5QoSFlows INTEGER ::= 2048 +maxnoofSSBAreas INTEGER ::= 64 +maxnoofPhysicalResourceBlocks INTEGER ::= 275 +maxnoofPhysicalResourceBlocks-1 INTEGER ::= 274 +maxnoofPRACHconfigs INTEGER ::= 16 +maxnoofRACHReports INTEGER ::= 64 +maxnoofRLFReports INTEGER ::= 64 +maxnoofAdditionalPDCPDuplicationTNL INTEGER ::= 2 +maxnoofRLCDuplicationState INTEGER ::= 3 +maxnoofCHOcells INTEGER ::= 8 +maxnoofMDTPLMNs INTEGER ::= 16 +maxnoofCAGsupported INTEGER ::= 12 +maxnoofNIDsupported INTEGER ::= 12 +maxnoofNRSCSs INTEGER ::= 5 +maxnoofExtSliceItems INTEGER ::= 65535 +maxnoofPosMeas INTEGER ::= 16384 +maxnoofTRPInfoTypes INTEGER ::= 64 +maxnoofTRPs INTEGER ::= 65535 +maxnoofSRSTriggerStates INTEGER ::= 3 +maxnoofSpatialRelations INTEGER ::= 64 +maxnoBcastCell INTEGER ::= 16384 +maxnoofAngleInfo INTEGER ::= 65535 +maxnooflcs-gcs-translation INTEGER ::= 3 +maxnoofPath INTEGER ::= 2 +maxnoofMeasE-CID INTEGER ::= 64 +maxnoofSSBs INTEGER ::= 255 +maxnoSRS-ResourceSets INTEGER ::= 16 +maxnoSRS-ResourcePerSet INTEGER ::= 16 +maxnoSRS-Carriers INTEGER ::= 32 +maxnoSCSs INTEGER ::= 5 +maxnoSRS-Resources INTEGER ::= 64 +maxnoSRS-PosResources INTEGER ::= 64 +maxnoSRS-PosResourceSets INTEGER ::= 16 +maxnoSRS-PosResourcePerSet INTEGER ::= 16 +maxnoofPRS-ResourceSets INTEGER ::= 2 +maxnoofPRS-ResourcesPerSet INTEGER ::= 64 +maxNoOfMeasTRPs INTEGER ::= 64 +maxnoofPRSresourceSets INTEGER ::= 8 +maxnoofPRSresources INTEGER ::= 64 + + + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-Cause ProtocolIE-ID ::= 0 +id-Cells-Failed-to-be-Activated-List ProtocolIE-ID ::= 1 +id-Cells-Failed-to-be-Activated-List-Item ProtocolIE-ID ::= 2 +id-Cells-to-be-Activated-List ProtocolIE-ID ::= 3 +id-Cells-to-be-Activated-List-Item ProtocolIE-ID ::= 4 +id-Cells-to-be-Deactivated-List ProtocolIE-ID ::= 5 +id-Cells-to-be-Deactivated-List-Item ProtocolIE-ID ::= 6 +id-CriticalityDiagnostics ProtocolIE-ID ::= 7 +id-CUtoDURRCInformation ProtocolIE-ID ::= 9 +id-DRBs-FailedToBeModified-Item ProtocolIE-ID ::= 12 +id-DRBs-FailedToBeModified-List ProtocolIE-ID ::= 13 +id-DRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 14 +id-DRBs-FailedToBeSetup-List ProtocolIE-ID ::= 15 +id-DRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 16 +id-DRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 17 +id-DRBs-ModifiedConf-Item ProtocolIE-ID ::= 18 +id-DRBs-ModifiedConf-List ProtocolIE-ID ::= 19 +id-DRBs-Modified-Item ProtocolIE-ID ::= 20 +id-DRBs-Modified-List ProtocolIE-ID ::= 21 +id-DRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 22 +id-DRBs-Required-ToBeModified-List ProtocolIE-ID ::= 23 +id-DRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 24 +id-DRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 25 +id-DRBs-Setup-Item ProtocolIE-ID ::= 26 +id-DRBs-Setup-List ProtocolIE-ID ::= 27 +id-DRBs-SetupMod-Item ProtocolIE-ID ::= 28 +id-DRBs-SetupMod-List ProtocolIE-ID ::= 29 +id-DRBs-ToBeModified-Item ProtocolIE-ID ::= 30 +id-DRBs-ToBeModified-List ProtocolIE-ID ::= 31 +id-DRBs-ToBeReleased-Item ProtocolIE-ID ::= 32 +id-DRBs-ToBeReleased-List ProtocolIE-ID ::= 33 +id-DRBs-ToBeSetup-Item ProtocolIE-ID ::= 34 +id-DRBs-ToBeSetup-List ProtocolIE-ID ::= 35 +id-DRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 36 +id-DRBs-ToBeSetupMod-List ProtocolIE-ID ::= 37 +id-DRXCycle ProtocolIE-ID ::= 38 +id-DUtoCURRCInformation ProtocolIE-ID ::= 39 +id-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 40 +id-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 41 +id-gNB-DU-ID ProtocolIE-ID ::= 42 +id-GNB-DU-Served-Cells-Item ProtocolIE-ID ::= 43 +id-gNB-DU-Served-Cells-List ProtocolIE-ID ::= 44 +id-gNB-DU-Name ProtocolIE-ID ::= 45 +id-NRCellID ProtocolIE-ID ::= 46 +id-oldgNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 47 +id-ResetType ProtocolIE-ID ::= 48 +id-ResourceCoordinationTransferContainer ProtocolIE-ID ::= 49 +id-RRCContainer ProtocolIE-ID ::= 50 +id-SCell-ToBeRemoved-Item ProtocolIE-ID ::= 51 +id-SCell-ToBeRemoved-List ProtocolIE-ID ::= 52 +id-SCell-ToBeSetup-Item ProtocolIE-ID ::= 53 +id-SCell-ToBeSetup-List ProtocolIE-ID ::= 54 +id-SCell-ToBeSetupMod-Item ProtocolIE-ID ::= 55 +id-SCell-ToBeSetupMod-List ProtocolIE-ID ::= 56 +id-Served-Cells-To-Add-Item ProtocolIE-ID ::= 57 +id-Served-Cells-To-Add-List ProtocolIE-ID ::= 58 +id-Served-Cells-To-Delete-Item ProtocolIE-ID ::= 59 +id-Served-Cells-To-Delete-List ProtocolIE-ID ::= 60 +id-Served-Cells-To-Modify-Item ProtocolIE-ID ::= 61 +id-Served-Cells-To-Modify-List ProtocolIE-ID ::= 62 +id-SpCell-ID ProtocolIE-ID ::= 63 +id-SRBID ProtocolIE-ID ::= 64 +id-SRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 65 +id-SRBs-FailedToBeSetup-List ProtocolIE-ID ::= 66 +id-SRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 67 +id-SRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 68 +id-SRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 69 +id-SRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 70 +id-SRBs-ToBeReleased-Item ProtocolIE-ID ::= 71 +id-SRBs-ToBeReleased-List ProtocolIE-ID ::= 72 +id-SRBs-ToBeSetup-Item ProtocolIE-ID ::= 73 +id-SRBs-ToBeSetup-List ProtocolIE-ID ::= 74 +id-SRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 75 +id-SRBs-ToBeSetupMod-List ProtocolIE-ID ::= 76 +id-TimeToWait ProtocolIE-ID ::= 77 +id-TransactionID ProtocolIE-ID ::= 78 +id-TransmissionActionIndicator ProtocolIE-ID ::= 79 +id-UE-associatedLogicalF1-ConnectionItem ProtocolIE-ID ::= 80 +id-UE-associatedLogicalF1-ConnectionListResAck ProtocolIE-ID ::= 81 +id-gNB-CU-Name ProtocolIE-ID ::= 82 +id-SCell-FailedtoSetup-List ProtocolIE-ID ::= 83 +id-SCell-FailedtoSetup-Item ProtocolIE-ID ::= 84 +id-SCell-FailedtoSetupMod-List ProtocolIE-ID ::= 85 +id-SCell-FailedtoSetupMod-Item ProtocolIE-ID ::= 86 +id-RRCReconfigurationCompleteIndicator ProtocolIE-ID ::= 87 +id-Cells-Status-Item ProtocolIE-ID ::= 88 +id-Cells-Status-List ProtocolIE-ID ::= 89 +id-Candidate-SpCell-List ProtocolIE-ID ::= 90 +id-Candidate-SpCell-Item ProtocolIE-ID ::= 91 +id-Potential-SpCell-List ProtocolIE-ID ::= 92 +id-Potential-SpCell-Item ProtocolIE-ID ::= 93 +id-FullConfiguration ProtocolIE-ID ::= 94 +id-C-RNTI ProtocolIE-ID ::= 95 +id-SpCellULConfigured ProtocolIE-ID ::= 96 +id-InactivityMonitoringRequest ProtocolIE-ID ::= 97 +id-InactivityMonitoringResponse ProtocolIE-ID ::= 98 +id-DRB-Activity-Item ProtocolIE-ID ::= 99 +id-DRB-Activity-List ProtocolIE-ID ::= 100 +id-EUTRA-NR-CellResourceCoordinationReq-Container ProtocolIE-ID ::= 101 +id-EUTRA-NR-CellResourceCoordinationReqAck-Container ProtocolIE-ID ::= 102 +id-Protected-EUTRA-Resources-List ProtocolIE-ID ::= 105 +id-RequestType ProtocolIE-ID ::= 106 +id-ServCellIndex ProtocolIE-ID ::= 107 +id-RAT-FrequencyPriorityInformation ProtocolIE-ID ::= 108 +id-ExecuteDuplication ProtocolIE-ID ::= 109 +id-NRCGI ProtocolIE-ID ::= 111 +id-PagingCell-Item ProtocolIE-ID ::= 112 +id-PagingCell-List ProtocolIE-ID ::= 113 +id-PagingDRX ProtocolIE-ID ::= 114 +id-PagingPriority ProtocolIE-ID ::= 115 +id-SItype-List ProtocolIE-ID ::= 116 +id-UEIdentityIndexValue ProtocolIE-ID ::= 117 +id-gNB-CUSystemInformation ProtocolIE-ID ::= 118 +id-HandoverPreparationInformation ProtocolIE-ID ::= 119 +id-GNB-CU-TNL-Association-To-Add-Item ProtocolIE-ID ::= 120 +id-GNB-CU-TNL-Association-To-Add-List ProtocolIE-ID ::= 121 +id-GNB-CU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 122 +id-GNB-CU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 123 +id-GNB-CU-TNL-Association-To-Update-Item ProtocolIE-ID ::= 124 +id-GNB-CU-TNL-Association-To-Update-List ProtocolIE-ID ::= 125 +id-MaskedIMEISV ProtocolIE-ID ::= 126 +id-PagingIdentity ProtocolIE-ID ::= 127 +id-DUtoCURRCContainer ProtocolIE-ID ::= 128 +id-Cells-to-be-Barred-List ProtocolIE-ID ::= 129 +id-Cells-to-be-Barred-Item ProtocolIE-ID ::= 130 +id-TAISliceSupportList ProtocolIE-ID ::= 131 +id-GNB-CU-TNL-Association-Setup-List ProtocolIE-ID ::= 132 +id-GNB-CU-TNL-Association-Setup-Item ProtocolIE-ID ::= 133 +id-GNB-CU-TNL-Association-Failed-To-Setup-List ProtocolIE-ID ::= 134 +id-GNB-CU-TNL-Association-Failed-To-Setup-Item ProtocolIE-ID ::= 135 +id-DRB-Notify-Item ProtocolIE-ID ::= 136 +id-DRB-Notify-List ProtocolIE-ID ::= 137 +id-NotficationControl ProtocolIE-ID ::= 138 +id-RANAC ProtocolIE-ID ::= 139 +id-PWSSystemInformation ProtocolIE-ID ::= 140 +id-RepetitionPeriod ProtocolIE-ID ::= 141 +id-NumberofBroadcastRequest ProtocolIE-ID ::= 142 +id-Cells-To-Be-Broadcast-List ProtocolIE-ID ::= 144 +id-Cells-To-Be-Broadcast-Item ProtocolIE-ID ::= 145 +id-Cells-Broadcast-Completed-List ProtocolIE-ID ::= 146 +id-Cells-Broadcast-Completed-Item ProtocolIE-ID ::= 147 +id-Broadcast-To-Be-Cancelled-List ProtocolIE-ID ::= 148 +id-Broadcast-To-Be-Cancelled-Item ProtocolIE-ID ::= 149 +id-Cells-Broadcast-Cancelled-List ProtocolIE-ID ::= 150 +id-Cells-Broadcast-Cancelled-Item ProtocolIE-ID ::= 151 +id-NR-CGI-List-For-Restart-List ProtocolIE-ID ::= 152 +id-NR-CGI-List-For-Restart-Item ProtocolIE-ID ::= 153 +id-PWS-Failed-NR-CGI-List ProtocolIE-ID ::= 154 +id-PWS-Failed-NR-CGI-Item ProtocolIE-ID ::= 155 +id-ConfirmedUEID ProtocolIE-ID ::= 156 +id-Cancel-all-Warning-Messages-Indicator ProtocolIE-ID ::= 157 +id-GNB-DU-UE-AMBR-UL ProtocolIE-ID ::= 158 +id-DRXConfigurationIndicator ProtocolIE-ID ::= 159 +id-RLC-Status ProtocolIE-ID ::= 160 +id-DLPDCPSNLength ProtocolIE-ID ::= 161 +id-GNB-DUConfigurationQuery ProtocolIE-ID ::= 162 +id-MeasurementTimingConfiguration ProtocolIE-ID ::= 163 +id-DRB-Information ProtocolIE-ID ::= 164 +id-ServingPLMN ProtocolIE-ID ::= 165 +id-Protected-EUTRA-Resources-Item ProtocolIE-ID ::= 168 +id-GNB-CU-RRC-Version ProtocolIE-ID ::= 170 +id-GNB-DU-RRC-Version ProtocolIE-ID ::= 171 +id-GNBDUOverloadInformation ProtocolIE-ID ::= 172 +id-CellGroupConfig ProtocolIE-ID ::= 173 +id-RLCFailureIndication ProtocolIE-ID ::= 174 +id-UplinkTxDirectCurrentListInformation ProtocolIE-ID ::= 175 +id-DC-Based-Duplication-Configured ProtocolIE-ID ::= 176 +id-DC-Based-Duplication-Activation ProtocolIE-ID ::= 177 +id-SULAccessIndication ProtocolIE-ID ::= 178 +id-AvailablePLMNList ProtocolIE-ID ::= 179 +id-PDUSessionID ProtocolIE-ID ::= 180 +id-ULPDUSessionAggregateMaximumBitRate ProtocolIE-ID ::= 181 +id-ServingCellMO ProtocolIE-ID ::= 182 +id-QoSFlowMappingIndication ProtocolIE-ID ::= 183 +id-RRCDeliveryStatusRequest ProtocolIE-ID ::= 184 +id-RRCDeliveryStatus ProtocolIE-ID ::= 185 +id-BearerTypeChange ProtocolIE-ID ::= 186 +id-RLCMode ProtocolIE-ID ::= 187 +id-Duplication-Activation ProtocolIE-ID ::= 188 +id-Dedicated-SIDelivery-NeededUE-List ProtocolIE-ID ::= 189 +id-Dedicated-SIDelivery-NeededUE-Item ProtocolIE-ID ::= 190 +id-DRX-LongCycleStartOffset ProtocolIE-ID ::= 191 +id-ULPDCPSNLength ProtocolIE-ID ::= 192 +id-SelectedBandCombinationIndex ProtocolIE-ID ::= 193 +id-SelectedFeatureSetEntryIndex ProtocolIE-ID ::= 194 +id-ResourceCoordinationTransferInformation ProtocolIE-ID ::= 195 +id-ExtendedServedPLMNs-List ProtocolIE-ID ::= 196 +id-ExtendedAvailablePLMN-List ProtocolIE-ID ::= 197 +id-Associated-SCell-List ProtocolIE-ID ::= 198 +id-latest-RRC-Version-Enhanced ProtocolIE-ID ::= 199 +id-Associated-SCell-Item ProtocolIE-ID ::= 200 +id-Cell-Direction ProtocolIE-ID ::= 201 +id-SRBs-Setup-List ProtocolIE-ID ::= 202 +id-SRBs-Setup-Item ProtocolIE-ID ::= 203 +id-SRBs-SetupMod-List ProtocolIE-ID ::= 204 +id-SRBs-SetupMod-Item ProtocolIE-ID ::= 205 +id-SRBs-Modified-List ProtocolIE-ID ::= 206 +id-SRBs-Modified-Item ProtocolIE-ID ::= 207 +id-Ph-InfoSCG ProtocolIE-ID ::= 208 +id-RequestedBandCombinationIndex ProtocolIE-ID ::= 209 +id-RequestedFeatureSetEntryIndex ProtocolIE-ID ::= 210 +id-RequestedP-MaxFR2 ProtocolIE-ID ::= 211 +id-DRX-Config ProtocolIE-ID ::= 212 +id-IgnoreResourceCoordinationContainer ProtocolIE-ID ::= 213 +id-UEAssistanceInformation ProtocolIE-ID ::= 214 +id-NeedforGap ProtocolIE-ID ::= 215 +id-PagingOrigin ProtocolIE-ID ::= 216 +id-new-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 217 +id-RedirectedRRCmessage ProtocolIE-ID ::= 218 +id-new-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 219 +id-NotificationInformation ProtocolIE-ID ::= 220 +id-PLMNAssistanceInfoForNetShar ProtocolIE-ID ::= 221 +id-UEContextNotRetrievable ProtocolIE-ID ::= 222 +id-BPLMN-ID-Info-List ProtocolIE-ID ::= 223 +id-SelectedPLMNID ProtocolIE-ID ::= 224 +id-UAC-Assistance-Info ProtocolIE-ID ::= 225 +id-RANUEID ProtocolIE-ID ::= 226 +id-GNB-DU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 227 +id-GNB-DU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 228 +id-TNLAssociationTransportLayerAddressgNBDU ProtocolIE-ID ::= 229 +id-portNumber ProtocolIE-ID ::= 230 +id-AdditionalSIBMessageList ProtocolIE-ID ::= 231 +id-Cell-Type ProtocolIE-ID ::= 232 +id-IgnorePRACHConfiguration ProtocolIE-ID ::= 233 +id-CG-Config ProtocolIE-ID ::= 234 +id-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 235 +id-Requested-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 236 +id-Ph-InfoMCG ProtocolIE-ID ::= 237 +id-MeasGapSharingConfig ProtocolIE-ID ::= 238 +id-systemInformationAreaID ProtocolIE-ID ::= 239 +id-areaScope ProtocolIE-ID ::= 240 +id-RRCContainer-RRCSetupComplete ProtocolIE-ID ::= 241 +id-TraceActivation ProtocolIE-ID ::= 242 +id-TraceID ProtocolIE-ID ::= 243 +id-Neighbour-Cell-Information-List ProtocolIE-ID ::= 244 +id-SymbolAllocInSlot ProtocolIE-ID ::= 246 +id-NumDLULSymbols ProtocolIE-ID ::= 247 +id-AdditionalRRMPriorityIndex ProtocolIE-ID ::= 248 +id-DUCURadioInformationType ProtocolIE-ID ::= 249 +id-CUDURadioInformationType ProtocolIE-ID ::= 250 +id-AggressorgNBSetID ProtocolIE-ID ::= 251 +id-VictimgNBSetID ProtocolIE-ID ::= 252 +id-LowerLayerPresenceStatusChange ProtocolIE-ID ::= 253 +id-Transport-Layer-Address-Info ProtocolIE-ID ::= 254 +id-Neighbour-Cell-Information-Item ProtocolIE-ID ::= 255 +id-IntendedTDD-DL-ULConfig ProtocolIE-ID ::= 256 +id-QosMonitoringRequest ProtocolIE-ID ::= 257 +id-BHChannels-ToBeSetup-List ProtocolIE-ID ::= 258 +id-BHChannels-ToBeSetup-Item ProtocolIE-ID ::= 259 +id-BHChannels-Setup-List ProtocolIE-ID ::= 260 +id-BHChannels-Setup-Item ProtocolIE-ID ::= 261 +id-BHChannels-ToBeModified-Item ProtocolIE-ID ::= 262 +id-BHChannels-ToBeModified-List ProtocolIE-ID ::= 263 +id-BHChannels-ToBeReleased-Item ProtocolIE-ID ::= 264 +id-BHChannels-ToBeReleased-List ProtocolIE-ID ::= 265 +id-BHChannels-ToBeSetupMod-Item ProtocolIE-ID ::= 266 +id-BHChannels-ToBeSetupMod-List ProtocolIE-ID ::= 267 +id-BHChannels-FailedToBeModified-Item ProtocolIE-ID ::= 268 +id-BHChannels-FailedToBeModified-List ProtocolIE-ID ::= 269 +id-BHChannels-FailedToBeSetupMod-Item ProtocolIE-ID ::= 270 +id-BHChannels-FailedToBeSetupMod-List ProtocolIE-ID ::= 271 +id-BHChannels-Modified-Item ProtocolIE-ID ::= 272 +id-BHChannels-Modified-List ProtocolIE-ID ::= 273 +id-BHChannels-SetupMod-Item ProtocolIE-ID ::= 274 +id-BHChannels-SetupMod-List ProtocolIE-ID ::= 275 +id-BHChannels-Required-ToBeReleased-Item ProtocolIE-ID ::= 276 +id-BHChannels-Required-ToBeReleased-List ProtocolIE-ID ::= 277 +id-BHChannels-FailedToBeSetup-Item ProtocolIE-ID ::= 278 +id-BHChannels-FailedToBeSetup-List ProtocolIE-ID ::= 279 +id-BHInfo ProtocolIE-ID ::= 280 +id-BAPAddress ProtocolIE-ID ::= 281 +id-ConfiguredBAPAddress ProtocolIE-ID ::= 282 +id-BH-Routing-Information-Added-List ProtocolIE-ID ::= 283 +id-BH-Routing-Information-Added-List-Item ProtocolIE-ID ::= 284 +id-BH-Routing-Information-Removed-List ProtocolIE-ID ::= 285 +id-BH-Routing-Information-Removed-List-Item ProtocolIE-ID ::= 286 +id-UL-BH-Non-UP-Traffic-Mapping ProtocolIE-ID ::= 287 +id-Activated-Cells-to-be-Updated-List ProtocolIE-ID ::= 288 +id-Child-Nodes-List ProtocolIE-ID ::= 289 +id-IAB-Info-IAB-DU ProtocolIE-ID ::= 290 +id-IAB-Info-IAB-donor-CU ProtocolIE-ID ::= 291 +id-IAB-TNL-Addresses-To-Remove-List ProtocolIE-ID ::= 292 +id-IAB-TNL-Addresses-To-Remove-Item ProtocolIE-ID ::= 293 +id-IAB-Allocated-TNL-Address-List ProtocolIE-ID ::= 294 +id-IAB-Allocated-TNL-Address-Item ProtocolIE-ID ::= 295 +id-IABIPv6RequestType ProtocolIE-ID ::= 296 +id-IABv4AddressesRequested ProtocolIE-ID ::= 297 +id-IAB-Barred ProtocolIE-ID ::= 298 +id-TrafficMappingInformation ProtocolIE-ID ::= 299 +id-UL-UP-TNL-Information-to-Update-List ProtocolIE-ID ::= 300 +id-UL-UP-TNL-Information-to-Update-List-Item ProtocolIE-ID ::= 301 +id-UL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 302 +id-UL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 303 +id-DL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 304 +id-DL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 305 +id-NRV2XServicesAuthorized ProtocolIE-ID ::= 306 +id-LTEV2XServicesAuthorized ProtocolIE-ID ::= 307 +id-NRUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 308 +id-LTEUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 309 +id-SIB12-message ProtocolIE-ID ::= 310 +id-SIB13-message ProtocolIE-ID ::= 311 +id-SIB14-message ProtocolIE-ID ::= 312 +id-SLDRBs-FailedToBeModified-Item ProtocolIE-ID ::= 313 +id-SLDRBs-FailedToBeModified-List ProtocolIE-ID ::= 314 +id-SLDRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 315 +id-SLDRBs-FailedToBeSetup-List ProtocolIE-ID ::= 316 +id-SLDRBs-Modified-Item ProtocolIE-ID ::= 317 +id-SLDRBs-Modified-List ProtocolIE-ID ::= 318 +id-SLDRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 319 +id-SLDRBs-Required-ToBeModified-List ProtocolIE-ID ::= 320 +id-SLDRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 321 +id-SLDRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 322 +id-SLDRBs-Setup-Item ProtocolIE-ID ::= 323 +id-SLDRBs-Setup-List ProtocolIE-ID ::= 324 +id-SLDRBs-ToBeModified-Item ProtocolIE-ID ::= 325 +id-SLDRBs-ToBeModified-List ProtocolIE-ID ::= 326 +id-SLDRBs-ToBeReleased-Item ProtocolIE-ID ::= 327 +id-SLDRBs-ToBeReleased-List ProtocolIE-ID ::= 328 +id-SLDRBs-ToBeSetup-Item ProtocolIE-ID ::= 329 +id-SLDRBs-ToBeSetup-List ProtocolIE-ID ::= 330 +id-SLDRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 331 +id-SLDRBs-ToBeSetupMod-List ProtocolIE-ID ::= 332 +id-SLDRBs-SetupMod-List ProtocolIE-ID ::= 333 +id-SLDRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 334 +id-SLDRBs-SetupMod-Item ProtocolIE-ID ::= 335 +id-SLDRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 336 +id-SLDRBs-ModifiedConf-List ProtocolIE-ID ::= 337 +id-SLDRBs-ModifiedConf-Item ProtocolIE-ID ::= 338 +id-UEAssistanceInformationEUTRA ProtocolIE-ID ::= 339 +id-PC5LinkAMBR ProtocolIE-ID ::= 340 +id-SL-PHY-MAC-RLC-Config ProtocolIE-ID ::= 341 +id-SL-ConfigDedicatedEUTRA ProtocolIE-ID ::= 342 +id-AlternativeQoSParaSetList ProtocolIE-ID ::= 343 +id-CurrentQoSParaSetIndex ProtocolIE-ID ::= 344 +id-gNBCUMeasurementID ProtocolIE-ID ::= 345 +id-gNBDUMeasurementID ProtocolIE-ID ::= 346 +id-RegistrationRequest ProtocolIE-ID ::= 347 +id-ReportCharacteristics ProtocolIE-ID ::= 348 +id-CellToReportList ProtocolIE-ID ::= 349 +id-CellMeasurementResultList ProtocolIE-ID ::= 350 +id-HardwareLoadIndicator ProtocolIE-ID ::= 351 +id-ReportingPeriodicity ProtocolIE-ID ::= 352 +id-TNLCapacityIndicator ProtocolIE-ID ::= 353 +id-CarrierList ProtocolIE-ID ::= 354 +id-ULCarrierList ProtocolIE-ID ::= 355 +id-FrequencyShift7p5khz ProtocolIE-ID ::= 356 +id-SSB-PositionsInBurst ProtocolIE-ID ::= 357 +id-NRPRACHConfig ProtocolIE-ID ::= 358 +id-RACHReportInformationList ProtocolIE-ID ::= 359 +id-RLFReportInformationList ProtocolIE-ID ::= 360 +id-TDD-UL-DLConfigCommonNR ProtocolIE-ID ::= 361 +id-CNPacketDelayBudgetDownlink ProtocolIE-ID ::= 362 +id-ExtendedPacketDelayBudget ProtocolIE-ID ::= 363 +id-TSCTrafficCharacteristics ProtocolIE-ID ::= 364 +id-ReportingRequestType ProtocolIE-ID ::= 365 +id-TimeReferenceInformation ProtocolIE-ID ::= 366 +id-CNPacketDelayBudgetUplink ProtocolIE-ID ::= 369 +id-AdditionalPDCPDuplicationTNL-List ProtocolIE-ID ::= 370 +id-RLCDuplicationInformation ProtocolIE-ID ::= 371 +id-AdditionalDuplicationIndication ProtocolIE-ID ::= 372 +id-ConditionalInterDUMobilityInformation ProtocolIE-ID ::= 373 +id-ConditionalIntraDUMobilityInformation ProtocolIE-ID ::= 374 +id-targetCellsToCancel ProtocolIE-ID ::= 375 +id-requestedTargetCellGlobalID ProtocolIE-ID ::= 376 +id-ManagementBasedMDTPLMNList ProtocolIE-ID ::= 377 +id-TraceCollectionEntityIPAddress ProtocolIE-ID ::= 378 +id-PrivacyIndicator ProtocolIE-ID ::= 379 +id-TraceCollectionEntityURI ProtocolIE-ID ::= 380 +id-mdtConfiguration ProtocolIE-ID ::= 381 +id-ServingNID ProtocolIE-ID ::= 382 +id-NPNBroadcastInformation ProtocolIE-ID ::= 383 +id-NPNSupportInfo ProtocolIE-ID ::= 384 +id-NID ProtocolIE-ID ::= 385 +id-AvailableSNPN-ID-List ProtocolIE-ID ::= 386 +id-SIB10-message ProtocolIE-ID ::= 387 +id-DLCarrierList ProtocolIE-ID ::= 389 + id-ExtendedTAISliceSupportList ProtocolIE-ID ::= 390 +id-RequestedSRSTransmissionCharacteristics ProtocolIE-ID ::= 391 +id-PosAssistance-Information ProtocolIE-ID ::= 392 +id-PosBroadcast ProtocolIE-ID ::= 393 +id-RoutingID ProtocolIE-ID ::= 394 +id-PosAssistanceInformationFailureList ProtocolIE-ID ::= 395 +id-PosMeasurementQuantities ProtocolIE-ID ::= 396 +id-PosMeasurementResultList ProtocolIE-ID ::= 397 +id-TRPInformationTypeListTRPReq ProtocolIE-ID ::= 398 +id-TRPInformationTypeItem ProtocolIE-ID ::= 399 +id-TRPInformationListTRPResp ProtocolIE-ID ::= 400 +id-TRPInformationItem ProtocolIE-ID ::= 401 +id-LMF-MeasurementID ProtocolIE-ID ::= 402 +id-SRSType ProtocolIE-ID ::= 403 +id-ActivationTime ProtocolIE-ID ::= 404 +id-AbortTransmission ProtocolIE-ID ::= 405 +id-PositioningBroadcastCells ProtocolIE-ID ::= 406 +id-SRSConfiguration ProtocolIE-ID ::= 407 +id-PosReportCharacteristics ProtocolIE-ID ::= 408 +id-PosMeasurementPeriodicity ProtocolIE-ID ::= 409 +id-TRPList ProtocolIE-ID ::= 410 +id-RAN-MeasurementID ProtocolIE-ID ::= 411 +id-LMF-UE-MeasurementID ProtocolIE-ID ::= 412 +id-RAN-UE-MeasurementID ProtocolIE-ID ::= 413 +id-E-CID-MeasurementQuantities ProtocolIE-ID ::= 414 +id-E-CID-MeasurementQuantities-Item ProtocolIE-ID ::= 415 +id-E-CID-MeasurementPeriodicity ProtocolIE-ID ::= 416 +id-E-CID-MeasurementResult ProtocolIE-ID ::= 417 +id-Cell-Portion-ID ProtocolIE-ID ::= 418 +id-SFNInitialisationTime ProtocolIE-ID ::= 419 +id-SystemFrameNumber ProtocolIE-ID ::= 420 +id-SlotNumber ProtocolIE-ID ::= 421 +id-TRP-MeasurementRequestList ProtocolIE-ID ::= 422 +id-MeasurementBeamInfoRequest ProtocolIE-ID ::= 423 +id-E-CID-ReportCharacteristics ProtocolIE-ID ::= 424 +id-ConfiguredTACIndication ProtocolIE-ID ::= 425 +id-Extended-GNB-DU-Name ProtocolIE-ID ::= 426 +id-Extended-GNB-CU-Name ProtocolIE-ID ::= 427 + + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- Container definitions +-- +-- ************************************************************** + +F1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs + +FROM F1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +F1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +F1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {F1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {F1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {F1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality F1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality F1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue F1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality F1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue F1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality F1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue F1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {F1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {F1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality F1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END +-- ASN1STOP diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-CommonDataTypes.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-CommonDataTypes.asn new file mode 100644 index 0000000000000000000000000000000000000000..da3092376eb76a13281ef91adcfe001c1bcda040 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-CommonDataTypes.asn @@ -0,0 +1,32 @@ +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +F1AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0..65535), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + +ProtocolExtensionID ::= INTEGER (0..65535) + +ProtocolIE-ID ::= INTEGER (0..65535) + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessful-outcome } + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Constants.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Constants.asn new file mode 100644 index 0000000000000000000000000000000000000000..9b5a3dd6246d47a59d35760e55cbe4339b89746a --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Constants.asn @@ -0,0 +1,622 @@ +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +F1AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ProcedureCode, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes; + + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-Reset ProcedureCode ::= 0 +id-F1Setup ProcedureCode ::= 1 +id-ErrorIndication ProcedureCode ::= 2 +id-gNBDUConfigurationUpdate ProcedureCode ::= 3 +id-gNBCUConfigurationUpdate ProcedureCode ::= 4 +id-UEContextSetup ProcedureCode ::= 5 +id-UEContextRelease ProcedureCode ::= 6 +id-UEContextModification ProcedureCode ::= 7 +id-UEContextModificationRequired ProcedureCode ::= 8 +id-UEMobilityCommand ProcedureCode ::= 9 +id-UEContextReleaseRequest ProcedureCode ::= 10 +id-InitialULRRCMessageTransfer ProcedureCode ::= 11 +id-DLRRCMessageTransfer ProcedureCode ::= 12 +id-ULRRCMessageTransfer ProcedureCode ::= 13 +id-privateMessage ProcedureCode ::= 14 +id-UEInactivityNotification ProcedureCode ::= 15 +id-GNBDUResourceCoordination ProcedureCode ::= 16 +id-SystemInformationDeliveryCommand ProcedureCode ::= 17 +id-Paging ProcedureCode ::= 18 +id-Notify ProcedureCode ::= 19 +id-WriteReplaceWarning ProcedureCode ::= 20 +id-PWSCancel ProcedureCode ::= 21 +id-PWSRestartIndication ProcedureCode ::= 22 +id-PWSFailureIndication ProcedureCode ::= 23 +id-GNBDUStatusIndication ProcedureCode ::= 24 +id-RRCDeliveryReport ProcedureCode ::= 25 +id-F1Removal ProcedureCode ::= 26 +id-NetworkAccessRateReduction ProcedureCode ::= 27 +id-TraceStart ProcedureCode ::= 28 +id-DeactivateTrace ProcedureCode ::= 29 +id-DUCURadioInformationTransfer ProcedureCode ::= 30 +id-CUDURadioInformationTransfer ProcedureCode ::= 31 +id-BAPMappingConfiguration ProcedureCode ::= 32 +id-GNBDUResourceConfiguration ProcedureCode ::= 33 +id-IABTNLAddressAllocation ProcedureCode ::= 34 +id-IABUPConfigurationUpdate ProcedureCode ::= 35 +id-resourceStatusReportingInitiation ProcedureCode ::= 36 +id-resourceStatusReporting ProcedureCode ::= 37 +id-accessAndMobilityIndication ProcedureCode ::= 38 +id-accessSuccess ProcedureCode ::= 39 +id-cellTrafficTrace ProcedureCode ::= 40 +id-PositioningMeasurementExchange ProcedureCode ::= 41 +id-PositioningAssistanceInformationControl ProcedureCode ::= 42 +id-PositioningAssistanceInformationFeedback ProcedureCode ::= 43 +id-PositioningMeasurementReport ProcedureCode ::= 44 +id-PositioningMeasurementAbort ProcedureCode ::= 45 +id-PositioningMeasurementFailureIndication ProcedureCode ::= 46 +id-PositioningMeasurementUpdate ProcedureCode ::= 47 +id-TRPInformationExchange ProcedureCode ::= 48 +id-PositioningInformationExchange ProcedureCode ::= 49 +id-PositioningActivation ProcedureCode ::= 50 +id-PositioningDeactivation ProcedureCode ::= 51 +id-E-CIDMeasurementInitiation ProcedureCode ::= 52 +id-E-CIDMeasurementFailureIndication ProcedureCode ::= 53 +id-E-CIDMeasurementReport ProcedureCode ::= 54 +id-E-CIDMeasurementTermination ProcedureCode ::= 55 +id-PositioningInformationUpdate ProcedureCode ::= 56 +id-ReferenceTimeInformationReport ProcedureCode ::= 57 +id-ReferenceTimeInformationReportingControl ProcedureCode ::= 58 + + + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxNRARFCN INTEGER ::= 3279165 +maxnoofErrors INTEGER ::= 256 +maxnoofIndividualF1ConnectionsToReset INTEGER ::= 65536 +maxCellingNBDU INTEGER ::= 512 +maxnoofSCells INTEGER ::= 32 +maxnoofSRBs INTEGER ::= 8 +maxnoofDRBs INTEGER ::= 64 +maxnoofULUPTNLInformation INTEGER ::= 2 +maxnoofDLUPTNLInformation INTEGER ::= 2 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofCandidateSpCells INTEGER ::= 64 +maxnoofPotentialSpCells INTEGER ::= 64 +maxnoofNrCellBands INTEGER ::= 32 +maxnoofSIBTypes INTEGER ::= 32 +maxnoofSITypes INTEGER ::= 32 +maxnoofPagingCells INTEGER ::= 512 +maxnoofTNLAssociations INTEGER ::= 32 +maxnoofQoSFlows INTEGER ::= 64 +maxnoofSliceItems INTEGER ::= 1024 +maxCellineNB INTEGER ::= 256 +maxnoofExtendedBPLMNs INTEGER ::= 6 +maxnoofUEIDs INTEGER ::= 65536 +maxnoofBPLMNsNR INTEGER ::= 12 +maxnoofUACPLMNs INTEGER ::= 12 +maxnoofUACperPLMN INTEGER ::= 64 +maxnoofAdditionalSIBs INTEGER ::= 63 +maxnoofslots INTEGER ::= 5120 +maxnoofTLAs INTEGER ::= 16 +maxnoofGTPTLAs INTEGER ::= 16 +maxnoofBHRLCChannels INTEGER ::= 65536 +maxnoofRoutingEntries INTEGER ::= 1024 +maxnoofIABSTCInfo INTEGER ::= 45 +maxnoofSymbols INTEGER ::= 14 +maxnoofServingCells INTEGER ::= 32 +maxnoofDUFSlots INTEGER ::= 320 +maxnoofHSNASlots INTEGER ::= 5120 +maxnoofServedCellsIAB INTEGER ::= 512 +maxnoofChildIABNodes INTEGER ::= 1024 +maxnoofNonUPTrafficMappings INTEGER ::= 32 +maxnoofTLAsIAB INTEGER ::= 1024 +maxnoofMappingEntries INTEGER ::= 67108864 +maxnoofDSInfo INTEGER ::= 64 +maxnoofEgressLinks INTEGER ::= 2 +maxnoofULUPTNLInformationforIAB INTEGER ::= 32678 +maxnoofUPTNLAddresses INTEGER ::= 8 +maxnoofSLDRBs INTEGER ::= 512 +maxnoofQoSParaSets INTEGER ::= 8 +maxnoofPC5QoSFlows INTEGER ::= 2048 +maxnoofSSBAreas INTEGER ::= 64 +maxnoofPhysicalResourceBlocks INTEGER ::= 275 +maxnoofPhysicalResourceBlocks-1 INTEGER ::= 274 +maxnoofPRACHconfigs INTEGER ::= 16 +maxnoofRACHReports INTEGER ::= 64 +maxnoofRLFReports INTEGER ::= 64 +maxnoofAdditionalPDCPDuplicationTNL INTEGER ::= 2 +maxnoofRLCDuplicationState INTEGER ::= 3 +maxnoofCHOcells INTEGER ::= 8 +maxnoofMDTPLMNs INTEGER ::= 16 +maxnoofCAGsupported INTEGER ::= 12 +maxnoofNIDsupported INTEGER ::= 12 +maxnoofNRSCSs INTEGER ::= 5 +maxnoofExtSliceItems INTEGER ::= 65535 +maxnoofPosMeas INTEGER ::= 16384 +maxnoofTRPInfoTypes INTEGER ::= 64 +maxnoofTRPs INTEGER ::= 65535 +maxnoofSRSTriggerStates INTEGER ::= 3 +maxnoofSpatialRelations INTEGER ::= 64 +maxnoBcastCell INTEGER ::= 16384 +maxnoofAngleInfo INTEGER ::= 65535 +maxnooflcs-gcs-translation INTEGER ::= 3 +maxnoofPath INTEGER ::= 2 +maxnoofMeasE-CID INTEGER ::= 64 +maxnoofSSBs INTEGER ::= 255 +maxnoSRS-ResourceSets INTEGER ::= 16 +maxnoSRS-ResourcePerSet INTEGER ::= 16 +maxnoSRS-Carriers INTEGER ::= 32 +maxnoSCSs INTEGER ::= 5 +maxnoSRS-Resources INTEGER ::= 64 +maxnoSRS-PosResources INTEGER ::= 64 +maxnoSRS-PosResourceSets INTEGER ::= 16 +maxnoSRS-PosResourcePerSet INTEGER ::= 16 +maxnoofPRS-ResourceSets INTEGER ::= 2 +maxnoofPRS-ResourcesPerSet INTEGER ::= 64 +maxNoOfMeasTRPs INTEGER ::= 64 +maxnoofPRSresourceSets INTEGER ::= 8 +maxnoofPRSresources INTEGER ::= 64 + + + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-Cause ProtocolIE-ID ::= 0 +id-Cells-Failed-to-be-Activated-List ProtocolIE-ID ::= 1 +id-Cells-Failed-to-be-Activated-List-Item ProtocolIE-ID ::= 2 +id-Cells-to-be-Activated-List ProtocolIE-ID ::= 3 +id-Cells-to-be-Activated-List-Item ProtocolIE-ID ::= 4 +id-Cells-to-be-Deactivated-List ProtocolIE-ID ::= 5 +id-Cells-to-be-Deactivated-List-Item ProtocolIE-ID ::= 6 +id-CriticalityDiagnostics ProtocolIE-ID ::= 7 +id-CUtoDURRCInformation ProtocolIE-ID ::= 9 +id-DRBs-FailedToBeModified-Item ProtocolIE-ID ::= 12 +id-DRBs-FailedToBeModified-List ProtocolIE-ID ::= 13 +id-DRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 14 +id-DRBs-FailedToBeSetup-List ProtocolIE-ID ::= 15 +id-DRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 16 +id-DRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 17 +id-DRBs-ModifiedConf-Item ProtocolIE-ID ::= 18 +id-DRBs-ModifiedConf-List ProtocolIE-ID ::= 19 +id-DRBs-Modified-Item ProtocolIE-ID ::= 20 +id-DRBs-Modified-List ProtocolIE-ID ::= 21 +id-DRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 22 +id-DRBs-Required-ToBeModified-List ProtocolIE-ID ::= 23 +id-DRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 24 +id-DRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 25 +id-DRBs-Setup-Item ProtocolIE-ID ::= 26 +id-DRBs-Setup-List ProtocolIE-ID ::= 27 +id-DRBs-SetupMod-Item ProtocolIE-ID ::= 28 +id-DRBs-SetupMod-List ProtocolIE-ID ::= 29 +id-DRBs-ToBeModified-Item ProtocolIE-ID ::= 30 +id-DRBs-ToBeModified-List ProtocolIE-ID ::= 31 +id-DRBs-ToBeReleased-Item ProtocolIE-ID ::= 32 +id-DRBs-ToBeReleased-List ProtocolIE-ID ::= 33 +id-DRBs-ToBeSetup-Item ProtocolIE-ID ::= 34 +id-DRBs-ToBeSetup-List ProtocolIE-ID ::= 35 +id-DRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 36 +id-DRBs-ToBeSetupMod-List ProtocolIE-ID ::= 37 +id-DRXCycle ProtocolIE-ID ::= 38 +id-DUtoCURRCInformation ProtocolIE-ID ::= 39 +id-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 40 +id-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 41 +id-gNB-DU-ID ProtocolIE-ID ::= 42 +id-GNB-DU-Served-Cells-Item ProtocolIE-ID ::= 43 +id-gNB-DU-Served-Cells-List ProtocolIE-ID ::= 44 +id-gNB-DU-Name ProtocolIE-ID ::= 45 +id-NRCellID ProtocolIE-ID ::= 46 +id-oldgNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 47 +id-ResetType ProtocolIE-ID ::= 48 +id-ResourceCoordinationTransferContainer ProtocolIE-ID ::= 49 +id-RRCContainer ProtocolIE-ID ::= 50 +id-SCell-ToBeRemoved-Item ProtocolIE-ID ::= 51 +id-SCell-ToBeRemoved-List ProtocolIE-ID ::= 52 +id-SCell-ToBeSetup-Item ProtocolIE-ID ::= 53 +id-SCell-ToBeSetup-List ProtocolIE-ID ::= 54 +id-SCell-ToBeSetupMod-Item ProtocolIE-ID ::= 55 +id-SCell-ToBeSetupMod-List ProtocolIE-ID ::= 56 +id-Served-Cells-To-Add-Item ProtocolIE-ID ::= 57 +id-Served-Cells-To-Add-List ProtocolIE-ID ::= 58 +id-Served-Cells-To-Delete-Item ProtocolIE-ID ::= 59 +id-Served-Cells-To-Delete-List ProtocolIE-ID ::= 60 +id-Served-Cells-To-Modify-Item ProtocolIE-ID ::= 61 +id-Served-Cells-To-Modify-List ProtocolIE-ID ::= 62 +id-SpCell-ID ProtocolIE-ID ::= 63 +id-SRBID ProtocolIE-ID ::= 64 +id-SRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 65 +id-SRBs-FailedToBeSetup-List ProtocolIE-ID ::= 66 +id-SRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 67 +id-SRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 68 +id-SRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 69 +id-SRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 70 +id-SRBs-ToBeReleased-Item ProtocolIE-ID ::= 71 +id-SRBs-ToBeReleased-List ProtocolIE-ID ::= 72 +id-SRBs-ToBeSetup-Item ProtocolIE-ID ::= 73 +id-SRBs-ToBeSetup-List ProtocolIE-ID ::= 74 +id-SRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 75 +id-SRBs-ToBeSetupMod-List ProtocolIE-ID ::= 76 +id-TimeToWait ProtocolIE-ID ::= 77 +id-TransactionID ProtocolIE-ID ::= 78 +id-TransmissionActionIndicator ProtocolIE-ID ::= 79 +id-UE-associatedLogicalF1-ConnectionItem ProtocolIE-ID ::= 80 +id-UE-associatedLogicalF1-ConnectionListResAck ProtocolIE-ID ::= 81 +id-gNB-CU-Name ProtocolIE-ID ::= 82 +id-SCell-FailedtoSetup-List ProtocolIE-ID ::= 83 +id-SCell-FailedtoSetup-Item ProtocolIE-ID ::= 84 +id-SCell-FailedtoSetupMod-List ProtocolIE-ID ::= 85 +id-SCell-FailedtoSetupMod-Item ProtocolIE-ID ::= 86 +id-RRCReconfigurationCompleteIndicator ProtocolIE-ID ::= 87 +id-Cells-Status-Item ProtocolIE-ID ::= 88 +id-Cells-Status-List ProtocolIE-ID ::= 89 +id-Candidate-SpCell-List ProtocolIE-ID ::= 90 +id-Candidate-SpCell-Item ProtocolIE-ID ::= 91 +id-Potential-SpCell-List ProtocolIE-ID ::= 92 +id-Potential-SpCell-Item ProtocolIE-ID ::= 93 +id-FullConfiguration ProtocolIE-ID ::= 94 +id-C-RNTI ProtocolIE-ID ::= 95 +id-SpCellULConfigured ProtocolIE-ID ::= 96 +id-InactivityMonitoringRequest ProtocolIE-ID ::= 97 +id-InactivityMonitoringResponse ProtocolIE-ID ::= 98 +id-DRB-Activity-Item ProtocolIE-ID ::= 99 +id-DRB-Activity-List ProtocolIE-ID ::= 100 +id-EUTRA-NR-CellResourceCoordinationReq-Container ProtocolIE-ID ::= 101 +id-EUTRA-NR-CellResourceCoordinationReqAck-Container ProtocolIE-ID ::= 102 +id-Protected-EUTRA-Resources-List ProtocolIE-ID ::= 105 +id-RequestType ProtocolIE-ID ::= 106 +id-ServCellIndex ProtocolIE-ID ::= 107 +id-RAT-FrequencyPriorityInformation ProtocolIE-ID ::= 108 +id-ExecuteDuplication ProtocolIE-ID ::= 109 +id-NRCGI ProtocolIE-ID ::= 111 +id-PagingCell-Item ProtocolIE-ID ::= 112 +id-PagingCell-List ProtocolIE-ID ::= 113 +id-PagingDRX ProtocolIE-ID ::= 114 +id-PagingPriority ProtocolIE-ID ::= 115 +id-SItype-List ProtocolIE-ID ::= 116 +id-UEIdentityIndexValue ProtocolIE-ID ::= 117 +id-gNB-CUSystemInformation ProtocolIE-ID ::= 118 +id-HandoverPreparationInformation ProtocolIE-ID ::= 119 +id-GNB-CU-TNL-Association-To-Add-Item ProtocolIE-ID ::= 120 +id-GNB-CU-TNL-Association-To-Add-List ProtocolIE-ID ::= 121 +id-GNB-CU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 122 +id-GNB-CU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 123 +id-GNB-CU-TNL-Association-To-Update-Item ProtocolIE-ID ::= 124 +id-GNB-CU-TNL-Association-To-Update-List ProtocolIE-ID ::= 125 +id-MaskedIMEISV ProtocolIE-ID ::= 126 +id-PagingIdentity ProtocolIE-ID ::= 127 +id-DUtoCURRCContainer ProtocolIE-ID ::= 128 +id-Cells-to-be-Barred-List ProtocolIE-ID ::= 129 +id-Cells-to-be-Barred-Item ProtocolIE-ID ::= 130 +id-TAISliceSupportList ProtocolIE-ID ::= 131 +id-GNB-CU-TNL-Association-Setup-List ProtocolIE-ID ::= 132 +id-GNB-CU-TNL-Association-Setup-Item ProtocolIE-ID ::= 133 +id-GNB-CU-TNL-Association-Failed-To-Setup-List ProtocolIE-ID ::= 134 +id-GNB-CU-TNL-Association-Failed-To-Setup-Item ProtocolIE-ID ::= 135 +id-DRB-Notify-Item ProtocolIE-ID ::= 136 +id-DRB-Notify-List ProtocolIE-ID ::= 137 +id-NotficationControl ProtocolIE-ID ::= 138 +id-RANAC ProtocolIE-ID ::= 139 +id-PWSSystemInformation ProtocolIE-ID ::= 140 +id-RepetitionPeriod ProtocolIE-ID ::= 141 +id-NumberofBroadcastRequest ProtocolIE-ID ::= 142 +id-Cells-To-Be-Broadcast-List ProtocolIE-ID ::= 144 +id-Cells-To-Be-Broadcast-Item ProtocolIE-ID ::= 145 +id-Cells-Broadcast-Completed-List ProtocolIE-ID ::= 146 +id-Cells-Broadcast-Completed-Item ProtocolIE-ID ::= 147 +id-Broadcast-To-Be-Cancelled-List ProtocolIE-ID ::= 148 +id-Broadcast-To-Be-Cancelled-Item ProtocolIE-ID ::= 149 +id-Cells-Broadcast-Cancelled-List ProtocolIE-ID ::= 150 +id-Cells-Broadcast-Cancelled-Item ProtocolIE-ID ::= 151 +id-NR-CGI-List-For-Restart-List ProtocolIE-ID ::= 152 +id-NR-CGI-List-For-Restart-Item ProtocolIE-ID ::= 153 +id-PWS-Failed-NR-CGI-List ProtocolIE-ID ::= 154 +id-PWS-Failed-NR-CGI-Item ProtocolIE-ID ::= 155 +id-ConfirmedUEID ProtocolIE-ID ::= 156 +id-Cancel-all-Warning-Messages-Indicator ProtocolIE-ID ::= 157 +id-GNB-DU-UE-AMBR-UL ProtocolIE-ID ::= 158 +id-DRXConfigurationIndicator ProtocolIE-ID ::= 159 +id-RLC-Status ProtocolIE-ID ::= 160 +id-DLPDCPSNLength ProtocolIE-ID ::= 161 +id-GNB-DUConfigurationQuery ProtocolIE-ID ::= 162 +id-MeasurementTimingConfiguration ProtocolIE-ID ::= 163 +id-DRB-Information ProtocolIE-ID ::= 164 +id-ServingPLMN ProtocolIE-ID ::= 165 +id-Protected-EUTRA-Resources-Item ProtocolIE-ID ::= 168 +id-GNB-CU-RRC-Version ProtocolIE-ID ::= 170 +id-GNB-DU-RRC-Version ProtocolIE-ID ::= 171 +id-GNBDUOverloadInformation ProtocolIE-ID ::= 172 +id-CellGroupConfig ProtocolIE-ID ::= 173 +id-RLCFailureIndication ProtocolIE-ID ::= 174 +id-UplinkTxDirectCurrentListInformation ProtocolIE-ID ::= 175 +id-DC-Based-Duplication-Configured ProtocolIE-ID ::= 176 +id-DC-Based-Duplication-Activation ProtocolIE-ID ::= 177 +id-SULAccessIndication ProtocolIE-ID ::= 178 +id-AvailablePLMNList ProtocolIE-ID ::= 179 +id-PDUSessionID ProtocolIE-ID ::= 180 +id-ULPDUSessionAggregateMaximumBitRate ProtocolIE-ID ::= 181 +id-ServingCellMO ProtocolIE-ID ::= 182 +id-QoSFlowMappingIndication ProtocolIE-ID ::= 183 +id-RRCDeliveryStatusRequest ProtocolIE-ID ::= 184 +id-RRCDeliveryStatus ProtocolIE-ID ::= 185 +id-BearerTypeChange ProtocolIE-ID ::= 186 +id-RLCMode ProtocolIE-ID ::= 187 +id-Duplication-Activation ProtocolIE-ID ::= 188 +id-Dedicated-SIDelivery-NeededUE-List ProtocolIE-ID ::= 189 +id-Dedicated-SIDelivery-NeededUE-Item ProtocolIE-ID ::= 190 +id-DRX-LongCycleStartOffset ProtocolIE-ID ::= 191 +id-ULPDCPSNLength ProtocolIE-ID ::= 192 +id-SelectedBandCombinationIndex ProtocolIE-ID ::= 193 +id-SelectedFeatureSetEntryIndex ProtocolIE-ID ::= 194 +id-ResourceCoordinationTransferInformation ProtocolIE-ID ::= 195 +id-ExtendedServedPLMNs-List ProtocolIE-ID ::= 196 +id-ExtendedAvailablePLMN-List ProtocolIE-ID ::= 197 +id-Associated-SCell-List ProtocolIE-ID ::= 198 +id-latest-RRC-Version-Enhanced ProtocolIE-ID ::= 199 +id-Associated-SCell-Item ProtocolIE-ID ::= 200 +id-Cell-Direction ProtocolIE-ID ::= 201 +id-SRBs-Setup-List ProtocolIE-ID ::= 202 +id-SRBs-Setup-Item ProtocolIE-ID ::= 203 +id-SRBs-SetupMod-List ProtocolIE-ID ::= 204 +id-SRBs-SetupMod-Item ProtocolIE-ID ::= 205 +id-SRBs-Modified-List ProtocolIE-ID ::= 206 +id-SRBs-Modified-Item ProtocolIE-ID ::= 207 +id-Ph-InfoSCG ProtocolIE-ID ::= 208 +id-RequestedBandCombinationIndex ProtocolIE-ID ::= 209 +id-RequestedFeatureSetEntryIndex ProtocolIE-ID ::= 210 +id-RequestedP-MaxFR2 ProtocolIE-ID ::= 211 +id-DRX-Config ProtocolIE-ID ::= 212 +id-IgnoreResourceCoordinationContainer ProtocolIE-ID ::= 213 +id-UEAssistanceInformation ProtocolIE-ID ::= 214 +id-NeedforGap ProtocolIE-ID ::= 215 +id-PagingOrigin ProtocolIE-ID ::= 216 +id-new-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 217 +id-RedirectedRRCmessage ProtocolIE-ID ::= 218 +id-new-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 219 +id-NotificationInformation ProtocolIE-ID ::= 220 +id-PLMNAssistanceInfoForNetShar ProtocolIE-ID ::= 221 +id-UEContextNotRetrievable ProtocolIE-ID ::= 222 +id-BPLMN-ID-Info-List ProtocolIE-ID ::= 223 +id-SelectedPLMNID ProtocolIE-ID ::= 224 +id-UAC-Assistance-Info ProtocolIE-ID ::= 225 +id-RANUEID ProtocolIE-ID ::= 226 +id-GNB-DU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 227 +id-GNB-DU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 228 +id-TNLAssociationTransportLayerAddressgNBDU ProtocolIE-ID ::= 229 +id-portNumber ProtocolIE-ID ::= 230 +id-AdditionalSIBMessageList ProtocolIE-ID ::= 231 +id-Cell-Type ProtocolIE-ID ::= 232 +id-IgnorePRACHConfiguration ProtocolIE-ID ::= 233 +id-CG-Config ProtocolIE-ID ::= 234 +id-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 235 +id-Requested-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 236 +id-Ph-InfoMCG ProtocolIE-ID ::= 237 +id-MeasGapSharingConfig ProtocolIE-ID ::= 238 +id-systemInformationAreaID ProtocolIE-ID ::= 239 +id-areaScope ProtocolIE-ID ::= 240 +id-RRCContainer-RRCSetupComplete ProtocolIE-ID ::= 241 +id-TraceActivation ProtocolIE-ID ::= 242 +id-TraceID ProtocolIE-ID ::= 243 +id-Neighbour-Cell-Information-List ProtocolIE-ID ::= 244 +id-SymbolAllocInSlot ProtocolIE-ID ::= 246 +id-NumDLULSymbols ProtocolIE-ID ::= 247 +id-AdditionalRRMPriorityIndex ProtocolIE-ID ::= 248 +id-DUCURadioInformationType ProtocolIE-ID ::= 249 +id-CUDURadioInformationType ProtocolIE-ID ::= 250 +id-AggressorgNBSetID ProtocolIE-ID ::= 251 +id-VictimgNBSetID ProtocolIE-ID ::= 252 +id-LowerLayerPresenceStatusChange ProtocolIE-ID ::= 253 +id-Transport-Layer-Address-Info ProtocolIE-ID ::= 254 +id-Neighbour-Cell-Information-Item ProtocolIE-ID ::= 255 +id-IntendedTDD-DL-ULConfig ProtocolIE-ID ::= 256 +id-QosMonitoringRequest ProtocolIE-ID ::= 257 +id-BHChannels-ToBeSetup-List ProtocolIE-ID ::= 258 +id-BHChannels-ToBeSetup-Item ProtocolIE-ID ::= 259 +id-BHChannels-Setup-List ProtocolIE-ID ::= 260 +id-BHChannels-Setup-Item ProtocolIE-ID ::= 261 +id-BHChannels-ToBeModified-Item ProtocolIE-ID ::= 262 +id-BHChannels-ToBeModified-List ProtocolIE-ID ::= 263 +id-BHChannels-ToBeReleased-Item ProtocolIE-ID ::= 264 +id-BHChannels-ToBeReleased-List ProtocolIE-ID ::= 265 +id-BHChannels-ToBeSetupMod-Item ProtocolIE-ID ::= 266 +id-BHChannels-ToBeSetupMod-List ProtocolIE-ID ::= 267 +id-BHChannels-FailedToBeModified-Item ProtocolIE-ID ::= 268 +id-BHChannels-FailedToBeModified-List ProtocolIE-ID ::= 269 +id-BHChannels-FailedToBeSetupMod-Item ProtocolIE-ID ::= 270 +id-BHChannels-FailedToBeSetupMod-List ProtocolIE-ID ::= 271 +id-BHChannels-Modified-Item ProtocolIE-ID ::= 272 +id-BHChannels-Modified-List ProtocolIE-ID ::= 273 +id-BHChannels-SetupMod-Item ProtocolIE-ID ::= 274 +id-BHChannels-SetupMod-List ProtocolIE-ID ::= 275 +id-BHChannels-Required-ToBeReleased-Item ProtocolIE-ID ::= 276 +id-BHChannels-Required-ToBeReleased-List ProtocolIE-ID ::= 277 +id-BHChannels-FailedToBeSetup-Item ProtocolIE-ID ::= 278 +id-BHChannels-FailedToBeSetup-List ProtocolIE-ID ::= 279 +id-BHInfo ProtocolIE-ID ::= 280 +id-BAPAddress ProtocolIE-ID ::= 281 +id-ConfiguredBAPAddress ProtocolIE-ID ::= 282 +id-BH-Routing-Information-Added-List ProtocolIE-ID ::= 283 +id-BH-Routing-Information-Added-List-Item ProtocolIE-ID ::= 284 +id-BH-Routing-Information-Removed-List ProtocolIE-ID ::= 285 +id-BH-Routing-Information-Removed-List-Item ProtocolIE-ID ::= 286 +id-UL-BH-Non-UP-Traffic-Mapping ProtocolIE-ID ::= 287 +id-Activated-Cells-to-be-Updated-List ProtocolIE-ID ::= 288 +id-Child-Nodes-List ProtocolIE-ID ::= 289 +id-IAB-Info-IAB-DU ProtocolIE-ID ::= 290 +id-IAB-Info-IAB-donor-CU ProtocolIE-ID ::= 291 +id-IAB-TNL-Addresses-To-Remove-List ProtocolIE-ID ::= 292 +id-IAB-TNL-Addresses-To-Remove-Item ProtocolIE-ID ::= 293 +id-IAB-Allocated-TNL-Address-List ProtocolIE-ID ::= 294 +id-IAB-Allocated-TNL-Address-Item ProtocolIE-ID ::= 295 +id-IABIPv6RequestType ProtocolIE-ID ::= 296 +id-IABv4AddressesRequested ProtocolIE-ID ::= 297 +id-IAB-Barred ProtocolIE-ID ::= 298 +id-TrafficMappingInformation ProtocolIE-ID ::= 299 +id-UL-UP-TNL-Information-to-Update-List ProtocolIE-ID ::= 300 +id-UL-UP-TNL-Information-to-Update-List-Item ProtocolIE-ID ::= 301 +id-UL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 302 +id-UL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 303 +id-DL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 304 +id-DL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 305 +id-NRV2XServicesAuthorized ProtocolIE-ID ::= 306 +id-LTEV2XServicesAuthorized ProtocolIE-ID ::= 307 +id-NRUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 308 +id-LTEUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 309 +id-SIB12-message ProtocolIE-ID ::= 310 +id-SIB13-message ProtocolIE-ID ::= 311 +id-SIB14-message ProtocolIE-ID ::= 312 +id-SLDRBs-FailedToBeModified-Item ProtocolIE-ID ::= 313 +id-SLDRBs-FailedToBeModified-List ProtocolIE-ID ::= 314 +id-SLDRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 315 +id-SLDRBs-FailedToBeSetup-List ProtocolIE-ID ::= 316 +id-SLDRBs-Modified-Item ProtocolIE-ID ::= 317 +id-SLDRBs-Modified-List ProtocolIE-ID ::= 318 +id-SLDRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 319 +id-SLDRBs-Required-ToBeModified-List ProtocolIE-ID ::= 320 +id-SLDRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 321 +id-SLDRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 322 +id-SLDRBs-Setup-Item ProtocolIE-ID ::= 323 +id-SLDRBs-Setup-List ProtocolIE-ID ::= 324 +id-SLDRBs-ToBeModified-Item ProtocolIE-ID ::= 325 +id-SLDRBs-ToBeModified-List ProtocolIE-ID ::= 326 +id-SLDRBs-ToBeReleased-Item ProtocolIE-ID ::= 327 +id-SLDRBs-ToBeReleased-List ProtocolIE-ID ::= 328 +id-SLDRBs-ToBeSetup-Item ProtocolIE-ID ::= 329 +id-SLDRBs-ToBeSetup-List ProtocolIE-ID ::= 330 +id-SLDRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 331 +id-SLDRBs-ToBeSetupMod-List ProtocolIE-ID ::= 332 +id-SLDRBs-SetupMod-List ProtocolIE-ID ::= 333 +id-SLDRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 334 +id-SLDRBs-SetupMod-Item ProtocolIE-ID ::= 335 +id-SLDRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 336 +id-SLDRBs-ModifiedConf-List ProtocolIE-ID ::= 337 +id-SLDRBs-ModifiedConf-Item ProtocolIE-ID ::= 338 +id-UEAssistanceInformationEUTRA ProtocolIE-ID ::= 339 +id-PC5LinkAMBR ProtocolIE-ID ::= 340 +id-SL-PHY-MAC-RLC-Config ProtocolIE-ID ::= 341 +id-SL-ConfigDedicatedEUTRA ProtocolIE-ID ::= 342 +id-AlternativeQoSParaSetList ProtocolIE-ID ::= 343 +id-CurrentQoSParaSetIndex ProtocolIE-ID ::= 344 +id-gNBCUMeasurementID ProtocolIE-ID ::= 345 +id-gNBDUMeasurementID ProtocolIE-ID ::= 346 +id-RegistrationRequest ProtocolIE-ID ::= 347 +id-ReportCharacteristics ProtocolIE-ID ::= 348 +id-CellToReportList ProtocolIE-ID ::= 349 +id-CellMeasurementResultList ProtocolIE-ID ::= 350 +id-HardwareLoadIndicator ProtocolIE-ID ::= 351 +id-ReportingPeriodicity ProtocolIE-ID ::= 352 +id-TNLCapacityIndicator ProtocolIE-ID ::= 353 +id-CarrierList ProtocolIE-ID ::= 354 +id-ULCarrierList ProtocolIE-ID ::= 355 +id-FrequencyShift7p5khz ProtocolIE-ID ::= 356 +id-SSB-PositionsInBurst ProtocolIE-ID ::= 357 +id-NRPRACHConfig ProtocolIE-ID ::= 358 +id-RACHReportInformationList ProtocolIE-ID ::= 359 +id-RLFReportInformationList ProtocolIE-ID ::= 360 +id-TDD-UL-DLConfigCommonNR ProtocolIE-ID ::= 361 +id-CNPacketDelayBudgetDownlink ProtocolIE-ID ::= 362 +id-ExtendedPacketDelayBudget ProtocolIE-ID ::= 363 +id-TSCTrafficCharacteristics ProtocolIE-ID ::= 364 +id-ReportingRequestType ProtocolIE-ID ::= 365 +id-TimeReferenceInformation ProtocolIE-ID ::= 366 +id-CNPacketDelayBudgetUplink ProtocolIE-ID ::= 369 +id-AdditionalPDCPDuplicationTNL-List ProtocolIE-ID ::= 370 +id-RLCDuplicationInformation ProtocolIE-ID ::= 371 +id-AdditionalDuplicationIndication ProtocolIE-ID ::= 372 +id-ConditionalInterDUMobilityInformation ProtocolIE-ID ::= 373 +id-ConditionalIntraDUMobilityInformation ProtocolIE-ID ::= 374 +id-targetCellsToCancel ProtocolIE-ID ::= 375 +id-requestedTargetCellGlobalID ProtocolIE-ID ::= 376 +id-ManagementBasedMDTPLMNList ProtocolIE-ID ::= 377 +id-TraceCollectionEntityIPAddress ProtocolIE-ID ::= 378 +id-PrivacyIndicator ProtocolIE-ID ::= 379 +id-TraceCollectionEntityURI ProtocolIE-ID ::= 380 +id-mdtConfiguration ProtocolIE-ID ::= 381 +id-ServingNID ProtocolIE-ID ::= 382 +id-NPNBroadcastInformation ProtocolIE-ID ::= 383 +id-NPNSupportInfo ProtocolIE-ID ::= 384 +id-NID ProtocolIE-ID ::= 385 +id-AvailableSNPN-ID-List ProtocolIE-ID ::= 386 +id-SIB10-message ProtocolIE-ID ::= 387 +id-DLCarrierList ProtocolIE-ID ::= 389 + id-ExtendedTAISliceSupportList ProtocolIE-ID ::= 390 +id-RequestedSRSTransmissionCharacteristics ProtocolIE-ID ::= 391 +id-PosAssistance-Information ProtocolIE-ID ::= 392 +id-PosBroadcast ProtocolIE-ID ::= 393 +id-RoutingID ProtocolIE-ID ::= 394 +id-PosAssistanceInformationFailureList ProtocolIE-ID ::= 395 +id-PosMeasurementQuantities ProtocolIE-ID ::= 396 +id-PosMeasurementResultList ProtocolIE-ID ::= 397 +id-TRPInformationTypeListTRPReq ProtocolIE-ID ::= 398 +id-TRPInformationTypeItem ProtocolIE-ID ::= 399 +id-TRPInformationListTRPResp ProtocolIE-ID ::= 400 +id-TRPInformationItem ProtocolIE-ID ::= 401 +id-LMF-MeasurementID ProtocolIE-ID ::= 402 +id-SRSType ProtocolIE-ID ::= 403 +id-ActivationTime ProtocolIE-ID ::= 404 +id-AbortTransmission ProtocolIE-ID ::= 405 +id-PositioningBroadcastCells ProtocolIE-ID ::= 406 +id-SRSConfiguration ProtocolIE-ID ::= 407 +id-PosReportCharacteristics ProtocolIE-ID ::= 408 +id-PosMeasurementPeriodicity ProtocolIE-ID ::= 409 +id-TRPList ProtocolIE-ID ::= 410 +id-RAN-MeasurementID ProtocolIE-ID ::= 411 +id-LMF-UE-MeasurementID ProtocolIE-ID ::= 412 +id-RAN-UE-MeasurementID ProtocolIE-ID ::= 413 +id-E-CID-MeasurementQuantities ProtocolIE-ID ::= 414 +id-E-CID-MeasurementQuantities-Item ProtocolIE-ID ::= 415 +id-E-CID-MeasurementPeriodicity ProtocolIE-ID ::= 416 +id-E-CID-MeasurementResult ProtocolIE-ID ::= 417 +id-Cell-Portion-ID ProtocolIE-ID ::= 418 +id-SFNInitialisationTime ProtocolIE-ID ::= 419 +id-SystemFrameNumber ProtocolIE-ID ::= 420 +id-SlotNumber ProtocolIE-ID ::= 421 +id-TRP-MeasurementRequestList ProtocolIE-ID ::= 422 +id-MeasurementBeamInfoRequest ProtocolIE-ID ::= 423 +id-E-CID-ReportCharacteristics ProtocolIE-ID ::= 424 +id-ConfiguredTACIndication ProtocolIE-ID ::= 425 +id-Extended-GNB-DU-Name ProtocolIE-ID ::= 426 +id-Extended-GNB-CU-Name ProtocolIE-ID ::= 427 + + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Containers.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Containers.asn new file mode 100644 index 0000000000000000000000000000000000000000..72c6d6e5512777355ab2e5f0dcb5db06dd4a0450 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Containers.asn @@ -0,0 +1,178 @@ +F1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs + +FROM F1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +F1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +F1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {F1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {F1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {F1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality F1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality F1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue F1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality F1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue F1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality F1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue F1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {F1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {F1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality F1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-IEs.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-IEs.asn new file mode 100644 index 0000000000000000000000000000000000000000..3e02e1b27ee2d62c7d629766d062670636e838be --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-IEs.asn @@ -0,0 +1,5509 @@ +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +F1AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + id-gNB-CUSystemInformation, + id-HandoverPreparationInformation, + id-TAISliceSupportList, + id-RANAC, + id-BearerTypeChange, + id-Cell-Direction, + id-Cell-Type, + id-CellGroupConfig, + id-AvailablePLMNList, + id-PDUSessionID, + id-ULPDUSessionAggregateMaximumBitRate, + id-DC-Based-Duplication-Configured, + id-DC-Based-Duplication-Activation, + id-Duplication-Activation, + id-DLPDCPSNLength, + id-ULPDCPSNLength, + id-RLC-Status, + id-MeasurementTimingConfiguration, + id-DRB-Information, + id-QoSFlowMappingIndication, + id-ServingCellMO, + id-RLCMode, + id-ExtendedServedPLMNs-List, + id-ExtendedAvailablePLMN-List, + id-DRX-LongCycleStartOffset, + id-SelectedBandCombinationIndex, + id-SelectedFeatureSetEntryIndex, + id-Ph-InfoSCG, + id-latest-RRC-Version-Enhanced, + id-RequestedBandCombinationIndex, + id-RequestedFeatureSetEntryIndex, + id-DRX-Config, + id-UEAssistanceInformation, + id-PDCCH-BlindDetectionSCG, + id-Requested-PDCCH-BlindDetectionSCG, + id-BPLMN-ID-Info-List, + id-NotificationInformation, + id-TNLAssociationTransportLayerAddressgNBDU, + id-portNumber, + id-AdditionalSIBMessageList, + id-IgnorePRACHConfiguration, + id-CG-Config, + id-Ph-InfoMCG, + id-AggressorgNBSetID, + id-VictimgNBSetID, + id-MeasGapSharingConfig, + id-systemInformationAreaID, + id-areaScope, + id-IntendedTDD-DL-ULConfig, + id-QosMonitoringRequest, + id-BHInfo, + id-IAB-Info-IAB-DU, + id-IAB-Info-IAB-donor-CU, + id-IAB-Barred, + id-SIB12-message, + id-SIB13-message, + id-SIB14-message, + id-UEAssistanceInformationEUTRA, + id-SL-PHY-MAC-RLC-Config, + id-SL-ConfigDedicatedEUTRA, + id-AlternativeQoSParaSetList, + id-CurrentQoSParaSetIndex, + id-CarrierList, + id-ULCarrierList, + id-FrequencyShift7p5khz, + id-SSB-PositionsInBurst, + id-NRPRACHConfig, + id-TDD-UL-DLConfigCommonNR, + id-CNPacketDelayBudgetDownlink, + id-CNPacketDelayBudgetUplink, + id-ExtendedPacketDelayBudget, + id-TSCTrafficCharacteristics, + id-AdditionalPDCPDuplicationTNL-List, + id-RLCDuplicationInformation, + id-AdditionalDuplicationIndication, + id-mdtConfiguration, + id-TraceCollectionEntityURI, + id-NID, + id-NPNSupportInfo, + id-NPNBroadcastInformation, + id-AvailableSNPN-ID-List, + id-SIB10-message, + id-RequestedP-MaxFR2, + id-DLCarrierList, + id-ExtendedTAISliceSupportList, + id-E-CID-MeasurementQuantities-Item, + id-ConfiguredTACIndication, + maxNRARFCN, + maxnoofErrors, + maxnoofBPLMNs, + maxnoofBPLMNsNR, + maxnoofDLUPTNLInformation, + maxnoofNrCellBands, + maxnoofULUPTNLInformation, + maxnoofQoSFlows, + maxnoofSliceItems, + maxnoofSIBTypes, + maxnoofSITypes, + maxCellineNB, + maxnoofExtendedBPLMNs, + maxnoofAdditionalSIBs, + maxnoofUACPLMNs, + maxnoofUACperPLMN, + maxCellingNBDU, + maxnoofTLAs, + maxnoofGTPTLAs, + maxnoofslots, + maxnoofNonUPTrafficMappings, + maxnoofServingCells, + maxnoofServedCellsIAB, + maxnoofChildIABNodes, + maxnoofIABSTCInfo, + maxnoofSymbols, + maxnoofDUFSlots, + maxnoofHSNASlots, + maxnoofEgressLinks, + maxnoofMappingEntries, + maxnoofDSInfo, + maxnoofQoSParaSets, + maxnoofPC5QoSFlows, + maxnoofSSBAreas, + maxnoofBPLMNsNR, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofPhysicalResourceBlocks-1, + maxnoofPRACHconfigs, + maxnoofRACHReports, + maxnoofRLFReports, + maxnoofAdditionalPDCPDuplicationTNL, + maxnoofRLCDuplicationState, + maxnoofCHOcells, + maxnoofMDTPLMNs, + maxnoofCAGsupported, + maxnoofNIDsupported, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofExtSliceItems, + maxnoofPosMeas, + maxnoofTRPInfoTypes, + maxnoofSRSTriggerStates, + maxnoofSpatialRelations, + maxnoBcastCell, + maxnoofTRPs, + maxnoofAngleInfo, + maxnooflcs-gcs-translation, + maxnoofPath, + maxnoofMeasE-CID, + maxnoofSSBs, + maxnoSRS-ResourceSets, + maxnoSRS-ResourcePerSet, + maxnoSRS-Carriers, + maxnoSCSs, + maxnoSRS-Resources, + maxnoSRS-PosResources, + maxnoSRS-PosResourceSets, + maxnoSRS-PosResourcePerSet, + maxnoofPRS-ResourceSets, + maxnoofPRS-ResourcesPerSet, + maxNoOfMeasTRPs, + maxnoofPRSresourceSets, + maxnoofPRSresources + + + +FROM F1AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage + +FROM F1AP-CommonDataTypes + + ProtocolExtensionContainer{}, + F1AP-PROTOCOL-EXTENSION, + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + +-- A + +AbortTransmission ::= CHOICE { + sRSResourceSetID SRSResourceSetID, + releaseALL NULL, + choice-extension ProtocolIE-SingleContainer { { AbortTransmission-ExtIEs } } +} + +AbortTransmission-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +AccessPointPosition ::= SEQUENCE { + latitudeSign ENUMERATED {north, south}, + latitude INTEGER (0..8388607), + longitude INTEGER (-8388608..8388607), + directionOfAltitude ENUMERATED {height, depth}, + altitude INTEGER (0..32767), + uncertaintySemi-major INTEGER (0..127), + uncertaintySemi-minor INTEGER (0..127), + orientationOfMajorAxis INTEGER (0..179), + uncertaintyAltitude INTEGER (0..127), + confidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { AccessPointPosition-ExtIEs} } OPTIONAL +} + +AccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Activated-Cells-to-be-Updated-List ::= SEQUENCE (SIZE(1..maxnoofServedCellsIAB)) OF Activated-Cells-to-be-Updated-List-Item + +Activated-Cells-to-be-Updated-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info, + iE-Extensions ProtocolExtensionContainer { { Activated-Cells-to-be-Updated-List-Item-ExtIEs} } OPTIONAL +} + +Activated-Cells-to-be-Updated-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ActiveULBWP ::= SEQUENCE { + locationAndBandwidth INTEGER (0..37949,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + cyclicPrefix ENUMERATED {normal, extended}, + txDirectCurrentLocation INTEGER (0..3301,...), + shift7dot5kHz ENUMERATED {true, ...} OPTIONAL, + sRSConfig SRSConfig, + iE-Extensions ProtocolExtensionContainer { { ActiveULBWP-ExtIEs} } OPTIONAL +} + +ActiveULBWP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalDuplicationIndication ::= ENUMERATED { + three, + four, + ... +} + + +AdditionalPath-List::= SEQUENCE (SIZE(1..maxnoofPath)) OF AdditionalPath-Item + +AdditionalPath-Item ::=SEQUENCE { + relativePathDelay RelativePathDelay, + pathQuality TRPMeasurementQuality OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { AdditionalPath-Item-ExtIEs } } OPTIONAL +} + +AdditionalPath-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AdditionalPDCPDuplicationTNL-List ::= SEQUENCE (SIZE(1..maxnoofAdditionalPDCPDuplicationTNL)) OF AdditionalPDCPDuplicationTNL-Item + +AdditionalPDCPDuplicationTNL-Item ::=SEQUENCE { + additionalPDCPDuplicationUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { AdditionalPDCPDuplicationTNL-ItemExtIEs } } OPTIONAL, + ... +} + +AdditionalPDCPDuplicationTNL-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalSIBMessageList ::= SEQUENCE (SIZE(1..maxnoofAdditionalSIBs)) OF AdditionalSIBMessageList-Item + +AdditionalSIBMessageList-Item ::= SEQUENCE { + additionalSIB OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { AdditionalSIBMessageList-Item-ExtIEs} } OPTIONAL +} + +AdditionalSIBMessageList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalRRMPriorityIndex ::= BIT STRING (SIZE(32)) + +AggressorCellList ::= SEQUENCE (SIZE(1..maxCellingNBDU)) OF AggressorCellList-Item + +AggressorCellList-Item ::= SEQUENCE { + aggressorCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { AggressorCellList-Item-ExtIEs } } OPTIONAL +} + +AggressorCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AggressorgNBSetID ::= SEQUENCE { + aggressorgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { AggressorgNBSetID-ExtIEs } } OPTIONAL +} + +AggressorgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AlternativeQoSParaSetList ::= SEQUENCE (SIZE(1..maxnoofQoSParaSets)) OF AlternativeQoSParaSetItem + +AlternativeQoSParaSetItem ::= SEQUENCE { + alternativeQoSParaSetIndex QoSParaSetIndex, + guaranteedFlowBitRateDL BitRate OPTIONAL, + guaranteedFlowBitRateUL BitRate OPTIONAL, + packetDelayBudget PacketDelayBudget OPTIONAL, + packetErrorRate PacketErrorRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AlternativeQoSParaSetItem-ExtIEs} } OPTIONAL, + ... +} + +AlternativeQoSParaSetItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AngleMeasurementQuality ::= SEQUENCE { + azimuthQuality INTEGER(0..255), + zenithQuality INTEGER(0..255) OPTIONAL, + resolution ENUMERATED{deg0dot1,...}, + iE-Extensions ProtocolExtensionContainer { { AngleMeasurementQuality-ExtIEs } } OPTIONAL +} + +AngleMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AperiodicSRSResourceTriggerList ::= SEQUENCE (SIZE(1..maxnoofSRSTriggerStates)) OF AperiodicSRSResourceTrigger + +AperiodicSRSResourceTrigger ::= INTEGER (0..3, ...) + +Associated-SCell-Item ::= SEQUENCE { + sCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { Associated-SCell-ItemExtIEs } } OPTIONAL +} + +Associated-SCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailablePLMNList ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF AvailablePLMNList-Item + +AvailablePLMNList-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { AvailablePLMNList-Item-ExtIEs} } OPTIONAL +} + +AvailablePLMNList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailableSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF AvailableSNPN-ID-List-Item + +AvailableSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + availableNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { AvailableSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +AvailableSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AveragingWindow ::= INTEGER (0..4095, ...) + +AreaScope ::= ENUMERATED {true, ...} + +-- B + +BandwidthSRS ::= CHOICE { + fR1 FR1-Bandwidth, + fR2 FR2-Bandwidth, + choice-extension ProtocolIE-SingleContainer {{ BandwidthSRS-ExtIEs }} +} + +BandwidthSRS-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +BAPAddress ::= BIT STRING (SIZE(10)) + +BAPCtrlPDUChannel ::= ENUMERATED {true, ...} + +BAPlayerBHRLCchannelMappingInfo ::= SEQUENCE { + bAPlayerBHRLCchannelMappingInfoToAdd BAPlayerBHRLCchannelMappingInfoList OPTIONAL, + bAPlayerBHRLCchannelMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPlayerBHRLCchannelMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF BAPlayerBHRLCchannelMappingInfo-Item + +BAPlayerBHRLCchannelMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + priorHopBAPAddress BAPAddress OPTIONAL, + ingressbHRLCChannelID BHRLCChannelID OPTIONAL, + nextHopBAPAddress BAPAddress OPTIONAL, + egressbHRLCChannelID BHRLCChannelID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPPathID ::= BIT STRING (SIZE(10)) + +BAPRoutingID ::= SEQUENCE { + bAPAddress BAPAddress, + bAPPathID BAPPathID, + iE-Extensions ProtocolExtensionContainer { { BAPRoutingIDExtIEs } } OPTIONAL +} + +BAPRoutingIDExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BitRate ::= INTEGER (0..4000000000000,...) + +BearerTypeChange ::= ENUMERATED {true, ...} + +BHRLCChannelID ::= BIT STRING (SIZE(16)) + +BHChannels-FailedToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Modified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Modified-ItemExtIEs } } OPTIONAL +} + +BHChannels-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Required-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Setup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Setup-ItemExtIEs } } OPTIONAL +} + +BHChannels-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-SetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-SetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode OPTIONAL, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHInfo ::= SEQUENCE { + bAProutingID BAPRoutingID OPTIONAL, + egressBHRLCCHList EgressBHRLCCHList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHInfo-ExtIEs} } OPTIONAL +} + +BHInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHQoSInformation ::= CHOICE { + bHRLCCHQoS QoSFlowLevelQoSParameters, + eUTRANBHRLCCHQoS EUTRANQoS, + cPTrafficType CPTrafficType, + choice-extension ProtocolIE-SingleContainer { { BHQoSInformation-ExtIEs} } +} + +BHQoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +BH-Routing-Information-Added-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + nextHopBAPAddress BAPAddress, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Added-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Added-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BH-Routing-Information-Removed-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Removed-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Removed-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BPLMN-ID-Info-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNsNR)) OF BPLMN-ID-Info-Item + +BPLMN-ID-Info-Item ::= SEQUENCE { + pLMN-Identity-List AvailablePLMNList, + extended-PLMN-Identity-List ExtendedAvailablePLMN-List OPTIONAL, + fiveGS-TAC FiveGS-TAC OPTIONAL, + nr-cell-ID NRCellIdentity, + ranac RANAC OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BPLMN-ID-Info-ItemExtIEs} } OPTIONAL, + ... +} + +BPLMN-ID-Info-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-NPNBroadcastInformation CRITICALITY reject EXTENSION NPNBroadcastInformation PRESENCE optional}, + ... +} + +ServedPLMNs-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF ServedPLMNs-Item + +ServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-TAISliceSupportList CRITICALITY ignore EXTENSION SliceSupportList PRESENCE optional }| +{ ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +BroadcastCAGList ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF CAGID + +BroadcastNIDList ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF NID + +BroadcastSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF BroadcastSNPN-ID-List-Item + +BroadcastSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { BroadcastSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BroadcastPNI-NPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF BroadcastPNI-NPN-ID-List-Item + +BroadcastPNI-NPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastCAGList BroadcastCAGList, + iE-Extensions ProtocolExtensionContainer { { BroadcastPNI-NPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastPNI-NPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +BurstArrivalTime ::= OCTET STRING + +-- C +CAGID ::= BIT STRING (SIZE(32)) + +Cancel-all-Warning-Messages-Indicator ::= ENUMERATED {true, ...} + +Candidate-SpCell-Item ::= SEQUENCE { + candidate-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Candidate-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Candidate-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CapacityValue::= SEQUENCE { + capacityValue INTEGER (0..100), + sSBAreaCapacityValueList SSBAreaCapacityValueList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CapacityValue-ExtIEs} } OPTIONAL +} + +CapacityValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + protocol CauseProtocol, + misc CauseMisc, + choice-extension ProtocolIE-SingleContainer { { Cause-ExtIEs} } +} + +Cause-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, + ... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + unspecified, + rl-failure-rlc, + unknown-or-already-allocated-gnb-cu-ue-f1ap-id, + unknown-or-already-allocated-gnb-du-ue-f1ap-id, + unknown-or-inconsistent-pair-of-ue-f1ap-id, + interaction-with-other-procedure, + not-supported-qci-Value, + action-desirable-for-radio-reasons, + no-radio-resources-available, + procedure-cancelled, + normal-release, + ..., + cell-not-available, + rl-failure-others, + ue-rejection, + resources-not-available-for-the-slice, + amf-initiated-abnormal-release, + release-due-to-pre-emption, + plmn-not-served-by-the-gNB-CU, + multiple-drb-id-instances, + unknown-drb-id, + multiple-bh-rlc-ch-id-instances, + unknown-bh-rlc-ch-id, + cho-cpc-resources-tobechanged, + nPN-not-supported, + nPN-access-denied, + gNB-CU-Cell-Capacity-Exceeded, + report-characteristics-empty, + existing-measurement-ID, + measurement-temporarily-not-available, + measurement-not-supported-for-the-object + +} + +CauseTransport ::= ENUMERATED { + unspecified, + transport-resource-unavailable, + ..., + unknown-TNL-address-for-IAB, + unknown-UP-TNL-information-for-IAB +} + +CellGroupConfig ::= OCTET STRING + +CellCapacityClassValue ::= INTEGER (1..100,...) + +Cell-Direction ::= ENUMERATED {dl-only, ul-only} + +CellMeasurementResultList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellMeasurementResultItem + +CellMeasurementResultItem ::= SEQUENCE { + cellID NRCGI, + radioResourceStatus RadioResourceStatus OPTIONAL, + compositeAvailableCapacityGroup CompositeAvailableCapacityGroup OPTIONAL, + sliceAvailableCapacity SliceAvailableCapacity OPTIONAL, + numberofActiveUEs NumberofActiveUEs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellMeasurementResultItem-ExtIEs} } OPTIONAL +} + +CellMeasurementResultItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cell-Portion-ID ::= INTEGER (0..4095,...) + +Cells-Failed-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { Cells-Failed-to-be-Activated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Failed-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Status-Item ::= SEQUENCE { + nRCGI NRCGI, + service-status Service-Status, + iE-Extensions ProtocolExtensionContainer { { Cells-Status-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Status-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-To-Be-Broadcast-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-To-Be-Broadcast-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-To-Be-Broadcast-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Broadcast-Completed-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Completed-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Completed-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Broadcast-To-Be-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Broadcast-To-Be-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Broadcast-To-Be-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Cells-Broadcast-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Activated-List-ItemExtIEs} } OPTIONAL, + ... +} + +Cells-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-gNB-CUSystemInformation CRITICALITY reject EXTENSION GNB-CUSystemInformation PRESENCE optional }| + { ID id-AvailablePLMNList CRITICALITY ignore EXTENSION AvailablePLMNList PRESENCE optional }| + { ID id-ExtendedAvailablePLMN-List CRITICALITY ignore EXTENSION ExtendedAvailablePLMN-List PRESENCE optional }| + { ID id-IAB-Info-IAB-donor-CU CRITICALITY ignore EXTENSION IAB-Info-IAB-donor-CU PRESENCE optional}| + { ID id-AvailableSNPN-ID-List CRITICALITY ignore EXTENSION AvailableSNPN-ID-List PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Deactivated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-to-be-Deactivated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Barred-Item::= SEQUENCE { + nRCGI NRCGI , + cellBarred CellBarred, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Barred-Item-ExtIEs } } OPTIONAL +} + +Cells-to-be-Barred-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-IAB-Barred CRITICALITY ignore EXTENSION IAB-Barred PRESENCE optional }, + + ... +} + + +CellBarred ::= ENUMERATED {barred, not-barred, ...} + +CellSize ::= ENUMERATED {verysmall, small, medium, large, ...} + +CellToReportList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellToReportItem + +CellToReportItem ::= SEQUENCE { + cellID NRCGI, + sSBToReportList SSBToReportList OPTIONAL, + sliceToReportList SliceToReportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellToReportItem-ExtIEs} } OPTIONAL +} + +CellToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellType ::= SEQUENCE { + cellSize CellSize, + iE-Extensions ProtocolExtensionContainer { {CellType-ExtIEs} } OPTIONAL, + ... +} + +CellType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellULConfigured ::= ENUMERATED {none, ul, sul, ul-and-sul, ...} + +Child-Node-Cells-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Node-Cells-List-Item + +Child-Node-Cells-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + rACH-Config-Common RACH-Config-Common OPTIONAL, + rACH-Config-Common-IAB RACH-Config-Common-IAB OPTIONAL, + cSI-RS-Configuration OCTET STRING OPTIONAL, + sR-Configuration OCTET STRING OPTIONAL, + pDCCH-ConfigSIB1 OCTET STRING OPTIONAL, + sCS-Common OCTET STRING OPTIONAL, + multiplexingInfo MultiplexingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Node-Cells-List-Item-ExtIEs}} OPTIONAL +} + +Child-Node-Cells-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Child-Nodes-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Nodes-List-Item + +Child-Nodes-List-Item ::= SEQUENCE{ + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID, + child-Node-Cells-List Child-Node-Cells-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Nodes-List-Item-ExtIEs}} OPTIONAL +} + +Child-Nodes-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CHOtrigger-InterDU ::= ENUMERATED { + cho-initiation, + cho-replace, + ... +} + +CHOtrigger-IntraDU ::= ENUMERATED { + cho-initiation, + cho-replace, + cho-cancel, + ... +} + +CNUEPagingIdentity ::= CHOICE { + fiveG-S-TMSI BIT STRING (SIZE(48)), + choice-extension ProtocolIE-SingleContainer { { CNUEPagingIdentity-ExtIEs } } +} + +CNUEPagingIdentity-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CompositeAvailableCapacityGroup ::= SEQUENCE { + compositeAvailableCapacityDownlink CompositeAvailableCapacity, + compositeAvailableCapacityUplink CompositeAvailableCapacity, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacityGroup-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacityGroup-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CompositeAvailableCapacity ::= SEQUENCE { + cellCapacityClassValue CellCapacityClassValue OPTIONAL, + capacityValue CapacityValue, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacity-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ConditionalInterDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-InterDU, + targetgNB-DUUEF1APID GNB-DU-UE-F1AP-ID OPTIONAL + -- This IE shall be present if the cho-trigger IE is present and set to "cho-replace" --, + iE-Extensions ProtocolExtensionContainer { { ConditionalInterDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalInterDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConditionalIntraDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-IntraDU, + targetCellsTocancel TargetCellList OPTIONAL, + -- This IE may be present if the cho-trigger IE is present and set to "cho-cancel" + iE-Extensions ProtocolExtensionContainer { { ConditionalIntraDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalIntraDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConfiguredTACIndication ::= ENUMERATED { + true, + ... +} + + +CoordinateID ::= INTEGER (0..511, ...) + +CP-TransportLayerAddress ::= CHOICE { + endpoint-IP-address TransportLayerAddress, + endpoint-IP-address-and-port Endpoint-IP-address-and-port, + choice-extension ProtocolIE-SingleContainer { { CP-TransportLayerAddress-ExtIEs } } +} + +CP-TransportLayerAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CPTrafficType ::= INTEGER (1..3,...) + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + transactionID TransactionID OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1.. maxnoofErrors)) OF CriticalityDiagnostics-IE-Item + +CriticalityDiagnostics-IE-Item ::= SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-IE-Item-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +C-RNTI ::= INTEGER (0..65535, ...) + +CUDURadioInformationType ::= CHOICE { + rIM CUDURIMInformation, + choice-extension ProtocolIE-SingleContainer { { CUDURadioInformationType-ExtIEs} } +} + +CUDURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CUDURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + iE-Extensions ProtocolExtensionContainer { { CUDURIMInformation-ExtIEs} } OPTIONAL +} + +CUDURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CUtoDURRCInformation ::= SEQUENCE { + cG-ConfigInfo CG-ConfigInfo OPTIONAL, + uE-CapabilityRAT-ContainerList UE-CapabilityRAT-ContainerList OPTIONAL, + measConfig MeasConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CUtoDURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +CUtoDURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-HandoverPreparationInformation CRITICALITY ignore EXTENSION HandoverPreparationInformation PRESENCE optional }| + { ID id-CellGroupConfig CRITICALITY ignore EXTENSION CellGroupConfig PRESENCE optional }| + { ID id-MeasurementTimingConfiguration CRITICALITY ignore EXTENSION MeasurementTimingConfiguration PRESENCE optional }| + { ID id-UEAssistanceInformation CRITICALITY ignore EXTENSION UEAssistanceInformation PRESENCE optional }| + { ID id-CG-Config CRITICALITY ignore EXTENSION CG-Config PRESENCE optional }| + { ID id-UEAssistanceInformationEUTRA CRITICALITY ignore EXTENSION UEAssistanceInformationEUTRA PRESENCE optional }, + ... +} + +-- D + +DCBasedDuplicationConfigured::= ENUMERATED{true,..., false} + +Dedicated-SIDelivery-NeededUE-Item ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { DedicatedSIDeliveryNeededUE-Item-ExtIEs} } OPTIONAL, + ... +} + +DedicatedSIDeliveryNeededUE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION::={ + ... +} + + +DL-PRS ::= SEQUENCE { + prsid INTEGER (0..255), + dl-PRSResourceSetID PRS-Resource-Set-ID, + dl-PRSResourceID PRS-Resource-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {DL-PRS-ExtIEs} } OPTIONAL +} + +DL-PRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSMutingPattern ::= CHOICE { + two BIT STRING (SIZE(2)), + four BIT STRING (SIZE(4)), + six BIT STRING (SIZE(6)), + eight BIT STRING (SIZE(8)), + sixteen BIT STRING (SIZE(16)), + thirty-two BIT STRING (SIZE(32)), + choice-extension ProtocolIE-SingleContainer { { DL-PRSMutingPattern-ExtIEs } } +} + +DL-PRSMutingPattern-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DLPRSResourceCoordinates ::= SEQUENCE { + listofDL-PRSResourceSetARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF DLPRSResourceSetARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceCoordinates-ExtIEs } } OPTIONAL +} + +DLPRSResourceCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLPRSResourceSetARP ::= SEQUENCE { + dl-PRSResourceSetID INTEGER (0..7), + dL-PRSResourceSetARPLocation DL-PRSResourceSetARPLocation, + listofDL-PRSResourceARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF DLPRSResourceARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceSetARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceSetARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DL-PRSResourceSetARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceSetARPLocation-ExtIEs } } +} + +DL-PRSResourceSetARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +DLPRSResourceARP ::= SEQUENCE { + dl-PRSResourceID INTEGER (0..63), + dL-PRSResourceARPLocation DL-PRSResourceARPLocation, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSResourceARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceARPLocation-ExtIEs } } +} + +DL-PRSResourceARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { DL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +DL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDLUPTNLInformation)) OF DLUPTNLInformation-ToBeSetup-Item + +DLUPTNLInformation-ToBeSetup-Item ::= SEQUENCE { + dLUPTNLInformation UPTransportLayerInformation , + iE-Extensions ProtocolExtensionContainer { { DLUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DLUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity-Item ::= SEQUENCE { + dRBID DRBID, + dRB-Activity DRB-Activity OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRB-Activity-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Activity-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity ::= ENUMERATED {active, not-active} + +DRBID ::= INTEGER (1..32, ...) + +DRBs-FailedToBeModified-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-FailedToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Information ::= SEQUENCE { + dRB-QoS QoSFlowLevelQoSParameters, + sNSSAI SNSSAI, + notificationControl NotificationControl OPTIONAL, + flows-Mapped-To-DRB-List Flows-Mapped-To-DRB-List, + iE-Extensions ProtocolExtensionContainer { { DRB-Information-ItemExtIEs } } OPTIONAL +} + +DRB-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Modified-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List, + iE-Extensions ProtocolExtensionContainer { { DRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-ModifiedConf-Item ::= SEQUENCE { + dRBID DRBID, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-ModifiedConf-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRB-Notify-Item ::= SEQUENCE { + dRBID DRBID, + notification-Cause Notification-Cause, + iE-Extensions ProtocolExtensionContainer { { DRB-Notify-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Notify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CurrentQoSParaSetIndex CRITICALITY ignore EXTENSION QoSParaSetNotifyIndex PRESENCE optional }, + ... +} + +DRBs-Required-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-Required-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Setup-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, ... +} + +DRBs-SetupMod-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation OPTIONAL, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + uLConfiguration ULConfiguration OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + {ID id-BearerTypeChange CRITICALITY ignore EXTENSION BearerTypeChange PRESENCE optional}| + { ID id-RLCMode CRITICALITY ignore EXTENSION RLCMode PRESENCE optional }| + { ID id-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRBs-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE mandatory }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List, + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRXCycle ::= SEQUENCE { + longDRXCycleLength LongDRXCycleLength, + shortDRXCycleLength ShortDRXCycleLength OPTIONAL, + shortDRXCycleTimer ShortDRXCycleTimer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRXCycle-ExtIEs} } OPTIONAL, + ... +} + +DRXCycle-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRX-Config ::= OCTET STRING + +DRXConfigurationIndicator ::= ENUMERATED{ release, ...} + +DRX-LongCycleStartOffset ::= INTEGER (0..10239) + +DSInformationList ::= SEQUENCE (SIZE(0..maxnoofDSInfo)) OF DSCP + +DSCP ::= BIT STRING (SIZE (6)) + +DUtoCURRCContainer ::= OCTET STRING + +DUCURadioInformationType ::= CHOICE { + rIM DUCURIMInformation, + choice-extension ProtocolIE-SingleContainer { { DUCURadioInformationType-ExtIEs} } +} + +DUCURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DUCURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + aggressorCellList AggressorCellList, + iE-Extensions ProtocolExtensionContainer { { DUCURIMInformation-ExtIEs} } OPTIONAL +} + +DUCURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DUF-Slot-Config-Item ::= CHOICE { + explicitFormat ExplicitFormat, + implicitFormat ImplicitFormat, + choice-extension ProtocolIE-SingleContainer { { DUF-Slot-Config-Item-ExtIEs} } +} + +DUF-Slot-Config-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} +DUF-Slot-Config-List ::= SEQUENCE (SIZE(1..maxnoofDUFSlots)) OF DUF-Slot-Config-Item + +DUFSlotformatIndex ::= INTEGER(0..254) + +DUFTransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ...} + +DU-RX-MT-RX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-RX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-RX ::= ENUMERATED {supported, not-supported} + +DUtoCURRCInformation ::= SEQUENCE { + cellGroupConfig CellGroupConfig, + measGapConfig MeasGapConfig OPTIONAL, + requestedP-MaxFR1 OCTET STRING OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DUtoCURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +DUtoCURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DRX-LongCycleStartOffset CRITICALITY ignore EXTENSION DRX-LongCycleStartOffset PRESENCE optional }| + { ID id-SelectedBandCombinationIndex CRITICALITY ignore EXTENSION SelectedBandCombinationIndex PRESENCE optional }| + { ID id-SelectedFeatureSetEntryIndex CRITICALITY ignore EXTENSION SelectedFeatureSetEntryIndex PRESENCE optional }| + { ID id-Ph-InfoSCG CRITICALITY ignore EXTENSION Ph-InfoSCG PRESENCE optional }| + { ID id-RequestedBandCombinationIndex CRITICALITY ignore EXTENSION RequestedBandCombinationIndex PRESENCE optional }| + { ID id-RequestedFeatureSetEntryIndex CRITICALITY ignore EXTENSION RequestedFeatureSetEntryIndex PRESENCE optional }| + { ID id-DRX-Config CRITICALITY ignore EXTENSION DRX-Config PRESENCE optional }| + { ID id-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Requested-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION Requested-PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Ph-InfoMCG CRITICALITY ignore EXTENSION Ph-InfoMCG PRESENCE optional }| + { ID id-MeasGapSharingConfig CRITICALITY ignore EXTENSION MeasGapSharingConfig PRESENCE optional }| + { ID id-SL-PHY-MAC-RLC-Config CRITICALITY ignore EXTENSION SL-PHY-MAC-RLC-Config PRESENCE optional }| + { ID id-SL-ConfigDedicatedEUTRA CRITICALITY ignore EXTENSION SL-ConfigDedicatedEUTRA PRESENCE optional }| + { ID id-RequestedP-MaxFR2 CRITICALITY ignore EXTENSION RequestedP-MaxFR2 PRESENCE optional }, + ... +} + +DuplicationActivation ::= ENUMERATED{active,inactive,... } + +DuplicationIndication ::= ENUMERATED {true, ... , false } + +DuplicationState ::= ENUMERATED { + active, + inactive, + ... +} + +Dynamic5QIDescriptor ::= SEQUENCE { + qoSPriorityLevel INTEGER (1..127), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + fiveQI INTEGER (0..255, ...) OPTIONAL, + delayCritical ENUMERATED {delay-critical, non-delay-critical} OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Dynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +Dynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ExtendedPacketDelayBudget CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +DynamicPQIDescriptor ::= SEQUENCE { + resourceType ENUMERATED {gbr, non-gbr, delay-critical-grb, ...} OPTIONAL, + qoSPriorityLevel INTEGER (1..8, ...), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +DynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- E + +E-CID-MeasurementPeriodicity ::= ENUMERATED { + ms120, + ms240, + ms480, + ms640, + ms1024, + ms2048, + ms5120, + ms10240, + min1, + min6, + min12, + min30, + min60, + ... +} + +E-CID-MeasurementQuantities ::= SEQUENCE (SIZE (1.. maxnoofMeasE-CID)) OF ProtocolIE-SingleContainer { {E-CID-MeasurementQuantities-ItemIEs} } + +E-CID-MeasurementQuantities-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-E-CID-MeasurementQuantities-Item CRITICALITY reject TYPE E-CID-MeasurementQuantities-Item PRESENCE mandatory} +} + +E-CID-MeasurementQuantities-Item ::= SEQUENCE { + e-CIDmeasurementQuantitiesValue E-CID-MeasurementQuantitiesValue, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementQuantitiesValue-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementQuantitiesValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasurementQuantitiesValue ::= ENUMERATED { + cell-Portion, + angleOfArrivalNR, + ... +} + +E-CID-MeasurementResult ::= SEQUENCE { + geographicalCoordinates GeographicalCoordinates OPTIONAL, + measuredResults-List E-CID-MeasuredResults-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementResult-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementResult-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-List ::= SEQUENCE (SIZE(1..maxnoofMeasE-CID)) OF E-CID-MeasuredResults-Item + +E-CID-MeasuredResults-Item ::= SEQUENCE { + e-CID-MeasuredResults-Value E-CID-MeasuredResults-Value, + iE-Extensions ProtocolExtensionContainer {{ E-CID-MeasuredResults-Item-ExtIEs }} OPTIONAL +} + +E-CID-MeasuredResults-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-Value ::= CHOICE { + valueAngleofArrivalNR UL-AoA, + choice-extension ProtocolIE-SingleContainer { { E-CID-MeasuredResults-Value-ExtIEs} } +} + +E-CID-MeasuredResults-Value-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +E-CID-ReportCharacteristics ::= ENUMERATED { + onDemand, + periodic, + ... +} + +EgressBHRLCCHList ::= SEQUENCE (SIZE(1..maxnoofEgressLinks)) OF EgressBHRLCCHItem + +EgressBHRLCCHItem ::= SEQUENCE { + nextHopBAPAddress BAPAddress, + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer {{EgressBHRLCCHItemExtIEs }} OPTIONAL +} + +EgressBHRLCCHItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Endpoint-IP-address-and-port ::=SEQUENCE { + endpointIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { Endpoint-IP-address-and-port-ExtIEs} } OPTIONAL +} + +Endpoint-IP-address-and-port-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-portNumber CRITICALITY reject EXTENSION PortNumber PRESENCE optional}, + ... +} + +ExtendedAvailablePLMN-List ::= SEQUENCE (SIZE(1..maxnoofExtendedBPLMNs)) OF ExtendedAvailablePLMN-Item + +ExtendedAvailablePLMN-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ExtendedAvailablePLMN-Item-ExtIEs} } OPTIONAL +} + +ExplicitFormat ::= SEQUENCE { + permutation Permutation, + noofDownlinkSymbols NoofDownlinkSymbols OPTIONAL, + noofUplinkSymbols NoofUplinkSymbols OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExplicitFormat-ExtIEs} } OPTIONAL +} + +ExplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedAvailablePLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedServedPLMNs-List ::= SEQUENCE (SIZE(1.. maxnoofExtendedBPLMNs)) OF ExtendedServedPLMNs-Item + +ExtendedServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + tAISliceSupportList SliceSupportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExtendedServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ExtendedServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +ExtendedSliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofExtSliceItems)) OF SliceSupportItem + +EUTRACells-List ::= SEQUENCE (SIZE (1.. maxCellineNB)) OF EUTRACells-List-item + +EUTRACells-List-item ::= SEQUENCE { + eUTRA-Cell-ID EUTRA-Cell-ID, + served-EUTRA-Cells-Information Served-EUTRA-Cells-Information, + iE-Extensions ProtocolExtensionContainer { { EUTRACells-List-itemExtIEs } } OPTIONAL +} + +EUTRACells-List-itemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-Cell-ID ::= BIT STRING (SIZE(28)) + +EUTRA-Coex-FDD-Info ::= SEQUENCE { + uL-EARFCN ExtendedEARFCN OPTIONAL, + dL-EARFCN ExtendedEARFCN, + uL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth OPTIONAL, + dL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-Coex-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ULCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-DLCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +EUTRA-Coex-Mode-Info ::= CHOICE { + fDD EUTRA-Coex-FDD-Info, + tDD EUTRA-Coex-TDD-Info, + ... +} + +EUTRA-Coex-TDD-Info ::= SEQUENCE { + eARFCN ExtendedEARFCN, + transmission-Bandwidth EUTRA-Transmission-Bandwidth, + subframeAssignment EUTRA-SubframeAssignment, + specialSubframe-Info EUTRA-SpecialSubframe-Info, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-TDD-Info-ExtIEs} } OPTIONAL, + ... +} +EUTRA-Coex-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +EUTRA-CyclicPrefixDL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-CyclicPrefixUL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-PRACH-Configuration ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + zeroCorrelationIndex INTEGER (0..15), + highSpeedFlag BOOLEAN, + prach-FreqOffset INTEGER (0..94), + prach-ConfigIndex INTEGER (0..63) OPTIONAL, + -- C-ifTDD: This IE shall be present if the EUTRA-Mode-Info IE in the Resource Coordination E-UTRA Cell Information IE is set to the value "TDD" + iE-Extensions ProtocolExtensionContainer { {EUTRA-PRACH-Configuration-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-PRACH-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-SpecialSubframe-Info ::= SEQUENCE { + specialSubframePatterns EUTRA-SpecialSubframePatterns, + cyclicPrefixDL EUTRA-CyclicPrefixDL, + cyclicPrefixUL EUTRA-CyclicPrefixUL, + iE-Extensions ProtocolExtensionContainer { { EUTRA-SpecialSubframe-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-SpecialSubframe-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-SpecialSubframePatterns ::= ENUMERATED { + ssp0, + ssp1, + ssp2, + ssp3, + ssp4, + ssp5, + ssp6, + ssp7, + ssp8, + ssp9, + ssp10, + ... +} + +EUTRA-SubframeAssignment ::= ENUMERATED { + sa0, + sa1, + sa2, + sa3, + sa4, + sa5, + sa6, + ... +} + +EUTRA-Transmission-Bandwidth ::= ENUMERATED { + bw6, + bw15, + bw25, + bw50, + bw75, + bw100, + ... +} + +EUTRANQoS ::= SEQUENCE { + qCI QCI, + allocationAndRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { EUTRANQoS-ExtIEs} } OPTIONAL, + ... +} + +EUTRANQoS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExecuteDuplication ::= ENUMERATED{true,...} + +ExtendedEARFCN ::= INTEGER (0..262143) + +EUTRA-Mode-Info ::= CHOICE { + eUTRAFDD EUTRA-FDD-Info, + eUTRATDD EUTRA-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { EUTRA-Mode-Info-ExtIEs} } +} + +EUTRA-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +EUTRA-NR-CellResourceCoordinationReq-Container ::= OCTET STRING + +EUTRA-NR-CellResourceCoordinationReqAck-Container ::= OCTET STRING + +EUTRA-FDD-Info ::= SEQUENCE { + uL-offsetToPointA OffsetToPointA, + dL-offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-TDD-Info ::= SEQUENCE { + offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EventType ::= ENUMERATED { + on-demand, + periodic, + stop, + ... +} + +ExtendedPacketDelayBudget ::= INTEGER (1..65535, ...) + +-- F + +FDD-Info ::= SEQUENCE { + uL-NRFreqInfo NRFreqInfo, + dL-NRFreqInfo NRFreqInfo, + uL-Transmission-Bandwidth Transmission-Bandwidth, + dL-Transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Flows-Mapped-To-DRB-List ::= SEQUENCE (SIZE(1.. maxnoofQoSFlows)) OF Flows-Mapped-To-DRB-Item + +Flows-Mapped-To-DRB-Item ::= SEQUENCE { + qoSFlowIdentifier QoSFlowIdentifier, + qoSFlowLevelQoSParameters QoSFlowLevelQoSParameters, + iE-Extensions ProtocolExtensionContainer { { Flows-Mapped-To-DRB-ItemExtIEs} } OPTIONAL +} + +Flows-Mapped-To-DRB-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-QoSFlowMappingIndication CRITICALITY ignore EXTENSION QoSFlowMappingIndication PRESENCE optional}| + {ID id-TSCTrafficCharacteristics CRITICALITY ignore EXTENSION TSCTrafficCharacteristics PRESENCE optional}, + ... +} + +FR1-Bandwidth ::= ENUMERATED {bw5, bw10, bw20, bw40, bw50, bw80, bw100, ...} + +FR2-Bandwidth ::= ENUMERATED {bw50, bw100, bw200, bw400, ...} + +FreqBandNrItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + supportedSULBandList SEQUENCE (SIZE(0..maxnoofNrCellBands)) OF SupportedSULFreqBandItem, + iE-Extensions ProtocolExtensionContainer { {FreqBandNrItem-ExtIEs} } OPTIONAL, + ... +} + +FreqBandNrItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +FreqDomainLength ::= CHOICE { + l839 L839Info, + l139 L139Info, + choice-extension ProtocolIE-SingleContainer { {FreqDomainLength-ExtIEs} } +} + +FreqDomainLength-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +FrequencyShift7p5khz ::= ENUMERATED {false, true, ...} + +FullConfiguration ::= ENUMERATED {full, ...} + +FlowsMappedToSLDRB-List ::= SEQUENCE (SIZE(1.. maxnoofPC5QoSFlows)) OF FlowsMappedToSLDRB-Item + +FlowsMappedToSLDRB-Item ::= SEQUENCE { + pc5QoSFlowIdentifier PC5QoSFlowIdentifier, + iE-Extensions ProtocolExtensionContainer { {FlowsMappedToSLDRB-Item-ExtIEs} } OPTIONAL, + ... +} + +FlowsMappedToSLDRB-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- G + + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GBR-QoSFlowInformation::= SEQUENCE { + maxFlowBitRateDownlink BitRate, + maxFlowBitRateUplink BitRate, + guaranteedFlowBitRateDownlink BitRate, + guaranteedFlowBitRateUplink BitRate, + maxPacketLossRateDownlink MaxPacketLossRate OPTIONAL, + maxPacketLossRateUplink MaxPacketLossRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GBR-QosFlowInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosFlowInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AlternativeQoSParaSetList CRITICALITY ignore EXTENSION AlternativeQoSParaSetList PRESENCE optional }, + ... +} + +CG-Config ::= OCTET STRING + +GeographicalCoordinates ::= SEQUENCE { + tRPPositionDefinitionType TRPPositionDefinitionType, + dLPRSResourceCoordinates DLPRSResourceCoordinates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GeographicalCoordinates-ExtIEs } } OPTIONAL +} + +GeographicalCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNBCUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNBDUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNB-CUSystemInformation::= SEQUENCE { + sibtypetobeupdatedlist SEQUENCE (SIZE(1.. maxnoofSIBTypes)) OF SibtypetobeupdatedListItem, + iE-Extensions ProtocolExtensionContainer { { GNB-CUSystemInformation-ExtIEs} } OPTIONAL, + ... +} + +GNB-CUSystemInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-systemInformationAreaID CRITICALITY ignore EXTENSION SystemInformationAreaID PRESENCE optional}, + ... +} + +GNB-CU-TNL-Association-Setup-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + cause Cause, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GNB-CU-TNL-Association-To-Add-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Add-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Add-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-TNLAssociationTransportLayerAddressgNBDU CRITICALITY reject EXTENSION CP-TransportLayerAddress PRESENCE optional}, + ... +} + + +GNB-CU-TNL-Association-To-Update-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Update-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Update-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-Cell-Resource-Configuration ::= SEQUENCE { + subcarrierSpacing SubcarrierSpacing, + dUFTransmissionPeriodicity DUFTransmissionPeriodicity OPTIONAL, + dUF-Slot-Config-List DUF-Slot-Config-List OPTIONAL, + hSNATransmissionPeriodicity HSNATransmissionPeriodicity, + hNSASlotConfigList HSNASlotConfigList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Cell-Resource-Configuration-ExtIEs } } OPTIONAL +} + +GNB-DU-Cell-Resource-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-ID ::= INTEGER (0..68719476735) + +GNB-CU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Name ::= PrintableString(SIZE(1..150,...)) + +Extended-GNB-CU-Name ::= SEQUENCE { + gNB-CU-NameVisibleString GNB-CU-NameVisibleString OPTIONAL, + gNB-CU-NameUTF8String GNB-CU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-CU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-CU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-CU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + +Extended-GNB-DU-Name ::= SEQUENCE { + gNB-DU-NameVisibleString GNB-DU-NameVisibleString OPTIONAL, + gNB-DU-NameUTF8String GNB-DU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-DU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-DU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-DU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + + +GNB-DU-Served-Cells-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Served-Cells-ItemExtIEs} } OPTIONAL, + ... +} + +GNB-DU-Served-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-System-Information ::= SEQUENCE { + mIB-message MIB-message, + sIB1-message SIB1-message, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-System-Information-ExtIEs } } OPTIONAL, + ... +} + +GNB-DU-System-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-SIB12-message CRITICALITY ignore EXTENSION SIB12-message PRESENCE optional}| + { ID id-SIB13-message CRITICALITY ignore EXTENSION SIB13-message PRESENCE optional}| + { ID id-SIB14-message CRITICALITY ignore EXTENSION SIB14-message PRESENCE optional}| + { ID id-SIB10-message CRITICALITY ignore EXTENSION SIB10-message PRESENCE optional}, + ... +} + +GNB-DUConfigurationQuery ::= ENUMERATED {true, ...} + +GNBDUOverloadInformation ::= ENUMERATED {overloaded, not-overloaded} + +GNB-DU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationTransportLayerAddressgNBCU CP-TransportLayerAddress OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-DU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-RxTxTimeDiff ::= SEQUENCE { + rxTxTimeDiff GNBRxTxTimeDiffMeas, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-RxTxTimeDiff-ExtIEs} } OPTIONAL +} + +GNB-RxTxTimeDiff-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + + ... +} + +GNBRxTxTimeDiffMeas ::= CHOICE { + k0 INTEGER (0.. 1970049), + k1 INTEGER (0.. 985025), + k2 INTEGER (0.. 492513), + k3 INTEGER (0.. 246257), + k4 INTEGER (0.. 123129), + k5 INTEGER (0.. 61565), + choice-extension ProtocolIE-SingleContainer { { GNBRxTxTimeDiffMeas-ExtIEs } } +} + +GNBRxTxTimeDiffMeas-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +GNBSetID ::= BIT STRING (SIZE(22)) + +GTP-TEID ::= OCTET STRING (SIZE (4)) + +GTPTLAs ::= SEQUENCE (SIZE(1.. maxnoofGTPTLAs)) OF GTPTLA-Item + + +GTPTLA-Item ::= SEQUENCE { + gTPTransportLayerAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { GTPTLA-Item-ExtIEs } } OPTIONAL +} + +GTPTLA-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTPTunnel ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { GTPTunnel-ExtIEs } } OPTIONAL, + ... +} + +GTPTunnel-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- H + +HandoverPreparationInformation ::= OCTET STRING + +HardwareLoadIndicator ::= SEQUENCE { + dLHardwareLoadIndicator INTEGER (0..100, ...), + uLHardwareLoadIndicator INTEGER (0..100, ...), + iE-Extensions ProtocolExtensionContainer { { HardwareLoadIndicator-ExtIEs } } OPTIONAL, + ... +} + +HardwareLoadIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +HSNASlotConfigList ::= SEQUENCE (SIZE(1..maxnoofHSNASlots)) OF HSNASlotConfigItem + +HSNASlotConfigItem ::= SEQUENCE { + hSNADownlink HSNADownlink OPTIONAL, + hSNAUplink HSNAUplink OPTIONAL, + hSNAFlexible HSNAFlexible OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { HSNASlotConfigItem-ExtIEs } } OPTIONAL +} + +HSNASlotConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +HSNADownlink ::= ENUMERATED { hard, soft, notavailable } + +HSNAFlexible ::= ENUMERATED { hard, soft, notavailable } + +HSNAUplink ::= ENUMERATED { hard, soft, notavailable } + +HSNATransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ms20, ms40, ms80, ms160, ...} + +-- I + +IAB-Barred ::= ENUMERATED {barred, not-barred, ...} + +IAB-Info-IAB-donor-CU ::= SEQUENCE{ + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-donor-CU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-donor-CU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Info-IAB-DU ::= SEQUENCE{ + multiplexingInfo MultiplexingInfo OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-DU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-DU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-MT-Cell-List ::= SEQUENCE (SIZE(1..maxnoofServingCells)) OF IAB-MT-Cell-List-Item + +IAB-MT-Cell-List-Item ::= SEQUENCE { + nRCellIdentity NRCellIdentity, + dU-RX-MT-RX DU-RX-MT-RX, + dU-TX-MT-TX DU-TX-MT-TX, + dU-RX-MT-TX DU-RX-MT-TX, + dU-TX-MT-RX DU-TX-MT-RX, + iE-Extensions ProtocolExtensionContainer { { IAB-MT-Cell-List-Item-ExtIEs } } OPTIONAL +} + +IAB-MT-Cell-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info ::= SEQUENCE{ + iAB-STC-Info-List IAB-STC-Info-List, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info-List ::= SEQUENCE (SIZE(1..maxnoofIABSTCInfo)) OF IAB-STC-Info-Item + +IAB-STC-Info-Item::= SEQUENCE { + sSB-freqInfo SSB-freqInfo, + sSB-subcarrierSpacing SSB-subcarrierSpacing, + sSB-transmissionPeriodicity SSB-transmissionPeriodicity, + sSB-transmissionTimingOffset SSB-transmissionTimingOffset, + sSB-transmissionBitmap SSB-transmissionBitmap, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-Item-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Allocated-TNL-Address-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iABTNLAddressUsage IABTNLAddressUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Allocated-TNL-Address-Item-ExtIEs } } OPTIONAL +} + +IAB-Allocated-TNL-Address-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info ::= CHOICE { + fDD IAB-DU-Cell-Resource-Configuration-FDD-Info, + tDD IAB-DU-Cell-Resource-Configuration-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs} } +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resource-Configuration-FDD-UL GNB-DU-Cell-Resource-Configuration, + gNB-DU-Cell-Resource-Configuration-FDD-DL GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resourc-Configuration-TDD GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABIPv6RequestType ::= CHOICE { + iPv6Address IABTNLAddressesRequested, + iPv6Prefix IABTNLAddressesRequested, + choice-extension ProtocolIE-SingleContainer { { IABIPv6RequestType-ExtIEs} } +} + +IABIPv6RequestType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddress ::= CHOICE { + iPv4Address BIT STRING (SIZE(32)), + iPv6Address BIT STRING (SIZE(128)), + iPv6Prefix BIT STRING (SIZE(64)), + choice-extension ProtocolIE-SingleContainer { { IABTNLAddress-ExtIEs} } +} + +IABTNLAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddressesRequested ::= SEQUENCE { + tNLAddressesOrPrefixesRequestedAllTraffic INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-C INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-U INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedNoNF1 INTEGER (1..256) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IABTNLAddressesRequested-ExtIEs } } OPTIONAL +} + +IABTNLAddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-TNL-Addresses-To-Remove-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iE-Extensions ProtocolExtensionContainer { { IAB-TNL-Addresses-To-Remove-Item-ExtIEs} } OPTIONAL +} + +IAB-TNL-Addresses-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABTNLAddressUsage ::= ENUMERATED { + f1-c, + f1-u, + non-f1, + ... +} + + +IABv4AddressesRequested ::= SEQUENCE { + iABv4AddressesRequested IABTNLAddressesRequested, + iE-Extensions ProtocolExtensionContainer { { IABv4AddressesRequested-ExtIEs} } OPTIONAL +} + +IABv4AddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ImplicitFormat ::= SEQUENCE { + dUFSlotformatIndex DUFSlotformatIndex, + iE-Extensions ProtocolExtensionContainer { { ImplicitFormat-ExtIEs } } OPTIONAL +} + +ImplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IgnorePRACHConfiguration::= ENUMERATED { true,...} + +IgnoreResourceCoordinationContainer ::= ENUMERATED { yes,...} +InactivityMonitoringRequest ::= ENUMERATED { true,...} +InactivityMonitoringResponse ::= ENUMERATED { not-supported,...} +InterfacesToTrace ::= BIT STRING (SIZE(8)) + +IntendedTDD-DL-ULConfig ::= SEQUENCE { + nRSCS ENUMERATED { scs15, scs30, scs60, scs120,...}, + nRCP ENUMERATED { normal, extended,...}, + nRDLULTxPeriodicity ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms3, ms4, ms5, ms10, ms20, ms40, ms60, ms80, ms100, ms120, ms140, ms160, ...}, + slot-Configuration-List Slot-Configuration-List, + iE-Extensions ProtocolExtensionContainer { {IntendedTDD-DL-ULConfig-ExtIEs} } OPTIONAL +} + +IntendedTDD-DL-ULConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPHeaderInformation ::= SEQUENCE { + destinationIABTNLAddress IABTNLAddress, + dsInformationList DSInformationList OPTIONAL, + iPv6FlowLabel BIT STRING (SIZE (20)) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPHeaderInformation-ItemExtIEs} } OPTIONAL, + ... +} + +IPHeaderInformation-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPtolayer2TrafficMappingInfo ::= SEQUENCE { + iPtolayer2TrafficMappingInfoToAdd IPtolayer2TrafficMappingInfoList OPTIONAL, + iPtolayer2TrafficMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF IPtolayer2TrafficMappingInfo-Item + +IPtolayer2TrafficMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + iPHeaderInformation IPHeaderInformation, + bHInfo BHInfo, iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- J + +-- K + +-- L + +L139Info ::= SEQUENCE { + msg1SCS ENUMERATED {scs15, scs30, scs60, scs120, ...}, + rootSequenceIndex INTEGER (0..137) OPTIONAL, + iE-Extension ProtocolExtensionContainer { {L139Info-ExtIEs} } OPTIONAL, + ... +} + +L139Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +L839Info ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + restrictedSetConfig ENUMERATED {unrestrictedSet, restrictedSetTypeA, + restrictedSetTypeB, ...}, + iE-Extension ProtocolExtensionContainer { {L839Info-ExtIEs} } OPTIONAL, + ... +} + +L839Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LCID ::= INTEGER (1..32, ...) + + +LCStoGCSTranslationList ::= SEQUENCE (SIZE (1.. maxnooflcs-gcs-translation)) OF LCStoGCSTranslation + +LCStoGCSTranslation ::= SEQUENCE { + alpha INTEGER (0..359), + alpha-fine INTEGER (0..9), + beta INTEGER (0..359), + beta-fine INTEGER (0..9), + gamma INTEGER (0..359), + gamma-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { {LCStoGCSTranslation-ExtIEs} } OPTIONAL +} + +LCStoGCSTranslation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LMF-MeasurementID ::= INTEGER (1.. 65536, ...) + +LMF-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +LocationUncertainty ::= SEQUENCE { + horizontalUncertainty INTEGER (0..255), + horizontalConfidence INTEGER (0..100), + verticalUncertainty INTEGER (0..255), + verticalConfidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { LocationUncertainty-ExtIEs} } OPTIONAL +} + +LocationUncertainty-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LongDRXCycleLength ::= ENUMERATED +{ms10, ms20, ms32, ms40, ms60, ms64, ms70, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ms1024, ms1280, ms2048, ms2560, ms5120, ms10240, ...} + +LowerLayerPresenceStatusChange ::= ENUMERATED { + suspend-lower-layers, + resume-lower-layers, + ... + +} + +LTEUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uELTESidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {LTEUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +LTEUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LTEV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {LTEV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +LTEV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- M + +MappingInformationIndex ::= BIT STRING (SIZE (26)) + +MappingInformationtoRemove ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF MappingInformationIndex + +MaskedIMEISV ::= BIT STRING (SIZE (64)) + +MaxDataBurstVolume ::= INTEGER (0..4095, ..., 4096.. 2000000) +MaxPacketLossRate ::= INTEGER (0..1000) + +MIB-message ::= OCTET STRING + +MeasConfig ::= OCTET STRING + +MeasGapConfig ::= OCTET STRING + +MeasGapSharingConfig ::= OCTET STRING + +MeasurementBeamInfoRequest ::= ENUMERATED {true, ...} + +MeasurementBeamInfo ::= SEQUENCE { + pRS-Resource-ID PRS-Resource-ID OPTIONAL, + pRS-Resource-Set-ID PRS-Resource-Set-ID OPTIONAL, + sSB-Index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { MeasurementBeamInfo-ExtIEs} } OPTIONAL +} + +MeasurementBeamInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MeasurementTimingConfiguration ::= OCTET STRING + +MessageIdentifier ::= BIT STRING (SIZE (16)) + +MultiplexingInfo ::= SEQUENCE{ + iAB-MT-Cell-List IAB-MT-Cell-List, + iE-Extensions ProtocolExtensionContainer { {MultiplexingInfo-ExtIEs} } OPTIONAL +} + +MultiplexingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M2Configuration ::= ENUMERATED {true, ...} + + +M5Configuration ::= SEQUENCE { + m5period M5period, + m5-links-to-log M5-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M5Configuration-ExtIEs} } OPTIONAL, + ... +} + +M5Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M5period ::= ENUMERATED { ms1024, ms2048, ms5120, ms10240, min1, ... } + +M5-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M6Configuration ::= SEQUENCE { + m6report-Interval M6report-Interval, + m6-links-to-log M6-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M6Configuration-ExtIEs} } OPTIONAL, + ... +} + +M6Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M6report-Interval ::= ENUMERATED { ms120, ms240, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1, min6, min12, min30, ... } + + + +M6-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M7Configuration ::= SEQUENCE { + m7period M7period, + m7-links-to-log M7-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M7Configuration-ExtIEs} } OPTIONAL, + ... +} + +M7Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M7period ::= INTEGER(1..60, ...) + +M7-Links-to-log ::= ENUMERATED {downlink, ...} + +MDT-Activation ::= ENUMERATED { + immediate-MDT-only, + immediate-MDT-and-Trace, + ... +} + +MDTConfiguration ::= SEQUENCE { + mdt-Activation MDT-Activation, + measurementsToActivate MeasurementsToActivate, + m2Configuration M2Configuration OPTIONAL, + -- C-ifM2: This IE shall be present if the Measurements to Activate IE has the second bit set to "1". + m5Configuration M5Configuration OPTIONAL, + -- C-ifM5: This IE shall be present if the Measurements to Activate IE has the fifth bit set to "1". + m6Configuration M6Configuration OPTIONAL, + -- C-ifM6: This IE shall be present if the Measurements to Activate IE has the seventh bit set to "1". + m7Configuration M7Configuration OPTIONAL, + -- C-ifM7: This IE shall be present if the Measurements to Activate IE has the eighth bit set to "1". + iE-Extensions ProtocolExtensionContainer { { MDTConfiguration-ExtIEs} } OPTIONAL, + ... +} +MDTConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MDTPLMNList ::= SEQUENCE (SIZE(1..maxnoofMDTPLMNs)) OF PLMN-Identity + + +MeasuredResultsValue ::= CHOICE { + uL-AngleOfArrival UL-AoA, + uL-SRS-RSRP UL-SRS-RSRP, + uL-RTOA UL-RTOA-Measurement, + gNB-RxTxTimeDiff GNB-RxTxTimeDiff, + choice-extension ProtocolIE-SingleContainer { { MeasuredResultsValue-ExtIEs } } +} + +MeasuredResultsValue-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +MeasurementsToActivate ::= BIT STRING (SIZE (8)) + +-- N + +NeedforGap::= ENUMERATED {true, ...} + +Neighbour-Cell-Information-Item ::= SEQUENCE { + nRCGI NRCGI, + intendedTDD-DL-ULConfig IntendedTDD-DL-ULConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Neighbour-Cell-Information-ItemExtIEs } } OPTIONAL +} + +Neighbour-Cell-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NGRANAllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {NGRANAllocationAndRetentionPriority-ExtIEs} } OPTIONAL +} + +NGRANAllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NGRANHighAccuracyAccessPointPosition ::= SEQUENCE { + latitude INTEGER (-2147483648.. 2147483647), + longitude INTEGER (-2147483648.. 2147483647), + altitude INTEGER (-64000..1280000), + uncertaintySemi-major INTEGER (0..255), + uncertaintySemi-minor INTEGER (0..255), + orientationOfMajorAxis INTEGER (0..179), + horizontalConfidence INTEGER (0..100), + uncertaintyAltitude INTEGER (0..255), + verticalConfidence INTEGER (0..100), + + iE-Extensions ProtocolExtensionContainer { { NGRANHighAccuracyAccessPointPosition-ExtIEs} } OPTIONAL +} + +NGRANHighAccuracyAccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NID ::= BIT STRING (SIZE(44)) + +NR-CGI-List-For-Restart-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { NR-CGI-List-For-Restart-ItemExtIEs } } OPTIONAL, + ... +} + +NR-CGI-List-For-Restart-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformation ::= SEQUENCE { + nR-PRSBeamInformationList NR-PRSBeamInformationList, + lCStoGCSTranslationList LCStoGCSTranslationList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformation-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformationList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF NR-PRSBeamInformationItem + +NR-PRSBeamInformationItem ::= SEQUENCE { + pRSResourceSetID INTEGER (0..7), + pRSAngleList PRSAngleList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformationItem-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonDynamic5QIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..127) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +NonDynamicPQIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..8, ...) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonUPTrafficType ::= ENUMERATED {ue-associated, non-ue-associated, non-f1, bap-control-pdu,...} + +NoofDownlinkSymbols ::= INTEGER (0..14) + +NoofUplinkSymbols ::= INTEGER (0..14) + +Notification-Cause ::= ENUMERATED {fulfilled, not-fulfilled, ...} + +NotificationControl ::= ENUMERATED {active, not-active, ...} + +NotificationInformation ::= SEQUENCE { + message-Identifier MessageIdentifier, + serialNumber SerialNumber, + iE-Extensions ProtocolExtensionContainer { { NotificationInformationExtIEs} } OPTIONAL, + ... +} + +NotificationInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NPNBroadcastInformation ::= CHOICE { + sNPN-Broadcast-Information NPN-Broadcast-Information-SNPN, + pNI-NPN-Broadcast-Information NPN-Broadcast-Information-PNI-NPN, + choice-extension ProtocolIE-SingleContainer { {NPNBroadcastInformation-ExtIEs} } +} + +NPNBroadcastInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NPN-Broadcast-Information-SNPN ::= SEQUENCE { + broadcastSNPNID-List BroadcastSNPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-SNPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-SNPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +NPN-Broadcast-Information-PNI-NPN ::= SEQUENCE { + broadcastPNI-NPN-ID-Information BroadcastPNI-NPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-PNI-NPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-PNI-NPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NPNSupportInfo ::= CHOICE { + sNPN-Information NID, + choice-extension ProtocolIE-SingleContainer { { NPNSupportInfo-ExtIEs } } +} + +NPNSupportInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NRCarrierList ::= SEQUENCE (SIZE(1..maxnoofNRSCSs)) OF NRCarrierItem + +NRCarrierItem ::= SEQUENCE { + carrierSCS NRSCS, + offsetToCarrier INTEGER (0..2199, ...), + carrierBandwidth INTEGER (0..maxnoofPhysicalResourceBlocks, ...), + iE-Extension ProtocolExtensionContainer { {NRCarrierItem-ExtIEs} } OPTIONAL, + ... +} + +NRCarrierItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRFreqInfo ::= SEQUENCE { + nRARFCN INTEGER (0..maxNRARFCN), + sul-Information SUL-Information OPTIONAL, + freqBandListNr SEQUENCE (SIZE(1..maxnoofNrCellBands)) OF FreqBandNrItem, + iE-Extensions ProtocolExtensionContainer { { NRFreqInfoExtIEs} } OPTIONAL, + ... +} + +NRFreqInfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +NRCGI ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + nRCellIdentity NRCellIdentity, + iE-Extensions ProtocolExtensionContainer { {NRCGI-ExtIEs} } OPTIONAL, + ... +} + +NRCGI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-Mode-Info ::= CHOICE { + fDD FDD-Info, + tDD TDD-Info, + choice-extension ProtocolIE-SingleContainer { { NR-Mode-Info-ExtIEs} } +} + +NR-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + + +NRPRACHConfig ::= SEQUENCE { + ulPRACHConfigList NRPRACHConfigList OPTIONAL, + sulPRACHConfigList NRPRACHConfigList OPTIONAL, + iE-Extension ProtocolExtensionContainer { {NRPRACHConfig-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRCellIdentity ::= BIT STRING (SIZE(36)) + +NRNRB ::= ENUMERATED { nrb11, nrb18, nrb24, nrb25, nrb31, nrb32, nrb38, nrb51, nrb52, nrb65, nrb66, nrb78, nrb79, nrb93, nrb106, nrb107, nrb121, nrb132, nrb133, nrb135, nrb160, nrb162, nrb189, nrb216, nrb217, nrb245, nrb264, nrb270, nrb273, ...} + +NRPCI ::= INTEGER(0..1007) + + +NRPRACHConfigList ::= SEQUENCE (SIZE(0..maxnoofPRACHconfigs)) OF NRPRACHConfigItem + +NRPRACHConfigItem ::= SEQUENCE { + nRSCS NRSCS, + prachFreqStartfromCarrier INTEGER (0..maxnoofPhysicalResourceBlocks-1, ...), + msg1FDM ENUMERATED {one, two, four, eight, ...}, + parchConfigIndex INTEGER (0..255, ...), + ssb-perRACH-Occasion ENUMERATED {oneEighth, oneFourth, oneHalf, one, + two, four, eight, sixteen, ...}, + freqDomainLength FreqDomainLength, + zeroCorrelZoneConfig INTEGER (0..15), + iE-Extension ProtocolExtensionContainer { { NRPRACHConfigItem-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRSCS ::= ENUMERATED { scs15, scs30, scs60, scs120, ...} + +NRUERLFReportContainer ::= OCTET STRING + +NumberofActiveUEs ::= INTEGER(0..16777215, ...) + +NumberOfBroadcasts ::= INTEGER (0..65535) + +NumberofBroadcastRequest ::= INTEGER (0..65535) + +NumDLULSymbols ::= SEQUENCE { + numDLSymbols INTEGER (0..13, ...), + numULSymbols INTEGER (0..13, ...), + iE-Extensions ProtocolExtensionContainer { { NumDLULSymbols-ExtIEs} } OPTIONAL +} + +NumDLULSymbols-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {NRV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +NRV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uENRSidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {NRUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +NRUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NZP-CSI-RS-ResourceID::= INTEGER (0..191, ...) + + +-- O + +OffsetToPointA ::= INTEGER (0..2199,...) + + +-- P + +PacketDelayBudget ::= INTEGER (0..1023, ...) + +PacketErrorRate ::= SEQUENCE { + pER-Scalar PER-Scalar, + pER-Exponent PER-Exponent, + iE-Extensions ProtocolExtensionContainer { {PacketErrorRate-ExtIEs} } OPTIONAL, + ... +} + +PacketErrorRate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PER-Scalar ::= INTEGER (0..9, ...) +PER-Exponent ::= INTEGER (0..9, ...) + +PagingCell-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { PagingCell-ItemExtIEs } } OPTIONAL +} + +PagingCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PagingDRX ::= ENUMERATED { + v32, + v64, + v128, + v256, + ... +} + +PagingIdentity ::= CHOICE { + rANUEPagingIdentity RANUEPagingIdentity, + cNUEPagingIdentity CNUEPagingIdentity, + choice-extension ProtocolIE-SingleContainer { { PagingIdentity-ExtIEs } } +} + +PagingIdentity-ExtIEs F1AP-PROTOCOL-IES::= { + ... +} + +PagingOrigin ::= ENUMERATED { non-3gpp, ...} + +PagingPriority ::= ENUMERATED { priolevel1, priolevel2, priolevel3, priolevel4, priolevel5, priolevel6, priolevel7, priolevel8,...} + + +RelativePathDelay ::= CHOICE { + k0 INTEGER (0..16351,...), + k1 INTEGER (0..8176,...), + k2 INTEGER (0..4088,...), + k3 INTEGER (0..2044,...), + k4 INTEGER (0..1022,...), + k5 INTEGER (0..511,...), + choice-extension ProtocolIE-SingleContainer { { RelativePathDelay-ExtIEs } } +} + +RelativePathDelay-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PathlossReferenceInfo ::= SEQUENCE { + pathlossReferenceSignal PathlossReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {PathlossReferenceInfo-ExtIEs} } OPTIONAL +} + +PathlossReferenceInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PathlossReferenceSignal ::= CHOICE { + sSB SSB, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{PathlossReferenceSignal-ExtIEs }} +} + +PathlossReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PC5QoSFlowIdentifier ::= INTEGER (1..2048) + +PC5-QoS-Characteristics ::= CHOICE { + non-Dynamic-PQI NonDynamicPQIDescriptor, + dynamic-PQI DynamicPQIDescriptor, + choice-extension ProtocolIE-SingleContainer { { PC5-QoS-Characteristics-ExtIEs } } +} + +PC5-QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +PC5QoSParameters ::= SEQUENCE { + pC5-QoS-Characteristics PC5-QoS-Characteristics, + pC5-QoS-Flow-Bit-Rates PC5FlowBitRates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PC5QoSParameters-ExtIEs } } OPTIONAL, + ... +} + +PC5QoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PC5FlowBitRates ::= SEQUENCE { + guaranteedFlowBitRate BitRate, + maximumFlowBitRate BitRate, + iE-Extensions ProtocolExtensionContainer { { PC5FlowBitRates-ExtIEs } } OPTIONAL, + ... +} + +PC5FlowBitRates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PDCCH-BlindDetectionSCG ::= OCTET STRING + +PDCP-SN ::= INTEGER (0..4095) + +PDCPSNLength ::= ENUMERATED { twelve-bits,eighteen-bits,...} + +PDUSessionID ::= INTEGER (0..255) + +ReportingPeriodicityValue ::= INTEGER (0..512, ...) + +Periodicity ::= INTEGER (0..640000, ...) + +PeriodicitySRS ::= ENUMERATED { ms0p125, ms0p25, ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms4, ms5, ms8, ms10, ms16, ms20, ms32, ms40, ms64, ms80, ms160, ms320, ms640, ms1280, ms2560, ms5120, ms10240, ...} + +PeriodicityList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourcePerSet)) OF PeriodicityList-Item + +PeriodicityList-Item ::= SEQUENCE { + periodicitySRS PeriodicitySRS, + iE-Extensions ProtocolExtensionContainer { { PeriodicityList-ItemExtIEs} } OPTIONAL +} + +PeriodicityList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Permutation ::= ENUMERATED {dfu, ufd, ...} + +Ph-InfoMCG ::= OCTET STRING + +Ph-InfoSCG ::= OCTET STRING + +PLMN-Identity ::= OCTET STRING (SIZE(3)) + +PortNumber ::= BIT STRING (SIZE (16)) + + +PosAssistance-Information ::= OCTET STRING + +PosAssistanceInformationFailureList ::= OCTET STRING + +PosBroadcast ::= ENUMERATED { + start, + stop, + ... +} + +PositioningBroadcastCells ::= SEQUENCE (SIZE (1..maxnoBcastCell)) OF NRCGI + +PosMeasurementPeriodicity ::= ENUMERATED +{ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, min1, min6, min12, min30, min60, ...} + + +PosMeasurementQuantities ::= SEQUENCE (SIZE(1.. maxnoofPosMeas)) OF PosMeasurementQuantities-Item + +PosMeasurementQuantities-Item ::= SEQUENCE { + posMeasurementType PosMeasurementType, + timingReportingGranularityFactor INTEGER (0..5) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementQuantities-ItemExtIEs} } OPTIONAL +} + +PosMeasurementQuantities-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResult ::= SEQUENCE (SIZE (1.. maxnoofPosMeas)) OF PosMeasurementResultItem + +PosMeasurementResultItem ::= SEQUENCE { + measuredResultsValue MeasuredResultsValue, + timeStamp TimeStamp, + measurementQuality TRPMeasurementQuality OPTIONAL, + measurementBeamInfo MeasurementBeamInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultItemExtIEs } } OPTIONAL +} + +PosMeasurementResultItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResultList ::= SEQUENCE (SIZE(1.. maxNoOfMeasTRPs)) OF PosMeasurementResultList-Item + +PosMeasurementResultList-Item ::= SEQUENCE { + posMeasurementResult PosMeasurementResult, + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultList-ItemExtIEs} } OPTIONAL +} + +PosMeasurementResultList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementType ::= ENUMERATED { + gnb-rx-tx, + ul-srs-rsrp, + ul-aoa, + ul-rtoa, + ... +} + +PosReportCharacteristics ::= ENUMERATED { + ondemand, + periodic, + ... +} + +PosResourceSetType ::= CHOICE { + periodic PosResourceSetTypePR, + semi-persistent PosResourceSetTypeSP, + aperiodic PosResourceSetTypeAP, + choice-extension ProtocolIE-SingleContainer {{ PosResourceSetType-ExtIEs }} +} + +PosResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PosResourceSetTypePR ::= SEQUENCE { + posperiodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypePR-ExtIEs} } OPTIONAL +} + +PosResourceSetTypePR-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeSP ::= SEQUENCE { + possemi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeSP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeSP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeAP ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeAP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeAP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceID-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourcePerSet)) OF SRSPosResourceID + +PosSRSResource-Item ::= SEQUENCE { + srs-PosResourceId SRSPosResourceID, + transmissionCombPos TransmissionCombPos, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4, n8, n12}, + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceTypePos ResourceTypePos, + sequenceId INTEGER (0.. 65535), + spatialRelationPos SpatialRelationPos OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosSRSResource-Item-ExtIEs} } OPTIONAL +} + +PosSRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResources)) OF PosSRSResource-Item + +PosSRSResourceSet-Item ::= SEQUENCE { + possrsResourceSetID INTEGER(0..15), + possRSResourceID-List PosSRSResourceID-List, + posresourceSetType PosResourceSetType, + iE-Extensions ProtocolExtensionContainer { { PosSRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PosSRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourceSets)) OF PosSRSResourceSet-Item + +PrimaryPathIndication ::= ENUMERATED { + true, + false, + ... +} + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +ProtectedEUTRAResourceIndication ::= OCTET STRING + +Protected-EUTRA-Resources-Item ::= SEQUENCE { + spectrumSharingGroupID SpectrumSharingGroupID, + eUTRACells-List EUTRACells-List, + iE-Extensions ProtocolExtensionContainer { { Protected-EUTRA-Resources-ItemExtIEs } } OPTIONAL +} + +Protected-EUTRA-Resources-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSConfiguration ::= SEQUENCE { + pRSResourceSet-List PRSResourceSet-List, + iE-Extensions ProtocolExtensionContainer { { PRSConfiguration-ExtIEs } } OPTIONAL +} + +PRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSInformationPos ::= SEQUENCE { + pRS-IDPos INTEGER(0..255) OPTIONAL, + pRS-Resource-Set-IDPos INTEGER(0..7), + pRS-Resource-IDPos INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { PRSInformationPos-ExtIEs} } OPTIONAL +} + +PRSInformationPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Potential-SpCell-Item ::= SEQUENCE { + potential-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Potential-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Potential-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +PRSAngleList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF PRSAngleItem + +PRSAngleItem ::= SEQUENCE { + nR-PRS-Azimuth INTEGER (0..359), + nR-PRS-Azimuth-fine INTEGER (0..9), + nR-PRS-Elevation INTEGER (0..180), + nR-PRS-Elevation-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { { PRSAngleItem-ItemExtIEs } } OPTIONAL +} + +PRSAngleItem-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMuting::= SEQUENCE { + pRSMutingOption1 PRSMutingOption1, + pRSMutingOption2 PRSMutingOption2, + iE-Extensions ProtocolExtensionContainer { { PRSMuting-ExtIEs} } OPTIONAL +} + +PRSMuting-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption1 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + mutingBitRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf8,...}, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption1-ExtIEs} } OPTIONAL +} + +PRSMutingOption1-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption2 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption2-ExtIEs} } OPTIONAL +} + +PRSMutingOption2-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-ID ::= INTEGER (0..63) + +PRSResource-List::= SEQUENCE (SIZE (1..maxnoofPRSresources)) OF PRSResource-Item + +PRSResource-Item ::= SEQUENCE { + pRSResourceID INTEGER(0..63), + sequenceID INTEGER(0..4095,...), + rEOffset INTEGER(0..11), + resourceSlotOffset INTEGER(0..511,...), + resourceSymbolOffset INTEGER(0..12,...), + qCLInfo PRSResource-QCLInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-Item-ExtIEs} } OPTIONAL +} + +PRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLInfo ::= SEQUENCE { + qCLSourceSSBIndex INTEGER(0..63) OPTIONAL, + qCLSourcePRSInfo PRSResource-QCLSourcePRSInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLInfo-ExtIEs} } OPTIONAL, + ... +} +PRSResource-QCLInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLSourcePRSInfo ::= SEQUENCE { + qCLSourcePRSResourceSetID INTEGER(0..7), + qCLSourcePRSResourceID INTEGER(0..63) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLSourcePRSInfo-ExtIEs} } OPTIONAL +} + +PRSResource-QCLSourcePRSInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-Set-ID ::= INTEGER(0..7) + +PRSResourceSet-List ::= SEQUENCE (SIZE (1.. maxnoofPRSresourceSets)) OF PRSResourceSet-Item +PRSResourceSet-Item ::= SEQUENCE { + pRSResourceSetID PRS-Resource-Set-ID, + subcarrierSpacing ENUMERATED{kHz15, kHz30, kHz60, kHz120, ...}, + pRSbandwidth INTEGER(1..63), + startPRB INTEGER(0..2176), + pointA INTEGER (0..3279165), + combSize ENUMERATED{n2, n4, n6, n12, ...}, + cPType ENUMERATED{normal, extended, ...}, + resourceSetPeriodicity ENUMERATED{n4,n5,n8,n10,n16,n20,n32,n40,n64,n80,n160,n320,n640,n1280,n2560,n5120,n10240,n20480,n40960, n81920,...}, + resourceSetSlotOffset INTEGER(0..81919,...), + resourceRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf6,rf8,rf16,rf32,...}, + resourceTimeGap ENUMERATED{tg1,tg2,tg4,tg8,tg16,tg32,...}, + resourceNumberofSymbols ENUMERATED{n2,n4,n6,n12,...}, + pRSMuting PRSMuting OPTIONAL, + pRSResourceTransmitPower INTEGER(-60..50), + pRSResource-List PRSResource-List, + iE-Extensions ProtocolExtensionContainer { { PRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWS-Failed-NR-CGI-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { PWS-Failed-NR-CGI-ItemExtIEs } } OPTIONAL, + ... +} + +PWS-Failed-NR-CGI-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWSSystemInformation ::= SEQUENCE { + sIBtype SIBType-PWS, + sIBmessage OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { PWSSystemInformationExtIEs } } OPTIONAL, + ... +} + +PWSSystemInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-NotificationInformation CRITICALITY ignore EXTENSION NotificationInformation PRESENCE optional}| + { ID id-AdditionalSIBMessageList CRITICALITY reject EXTENSION AdditionalSIBMessageList PRESENCE optional}, + ... +} + +PrivacyIndicator ::= ENUMERATED {immediate-MDT, logged-MDT, ...} + +-- Q + +QCI ::= INTEGER (0..255) + +QoS-Characteristics ::= CHOICE { + non-Dynamic-5QI NonDynamic5QIDescriptor, + dynamic-5QI Dynamic5QIDescriptor, + choice-extension ProtocolIE-SingleContainer { { QoS-Characteristics-ExtIEs } } +} + +QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +QoSFlowIdentifier ::= INTEGER (0..63) + +QoSFlowLevelQoSParameters ::= SEQUENCE { + qoS-Characteristics QoS-Characteristics, + nGRANallocationRetentionPriority NGRANAllocationAndRetentionPriority, + gBR-QoS-Flow-Information GBR-QoSFlowInformation OPTIONAL, + reflective-QoS-Attribute ENUMERATED {subject-to, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { QoSFlowLevelQoSParameters-ExtIEs } } OPTIONAL +} + +QoSFlowLevelQoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-PDUSessionID CRITICALITY ignore EXTENSION PDUSessionID PRESENCE optional}| + { ID id-ULPDUSessionAggregateMaximumBitRate CRITICALITY ignore EXTENSION BitRate PRESENCE optional}| + { ID id-QosMonitoringRequest CRITICALITY ignore EXTENSION QosMonitoringRequest PRESENCE optional}, + ... +} + +QoSFlowMappingIndication ::= ENUMERATED {ul,dl,...} + +QoSInformation ::= CHOICE { + eUTRANQoS EUTRANQoS, + choice-extension ProtocolIE-SingleContainer { { QoSInformation-ExtIEs} } +} + +QoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Information CRITICALITY ignore TYPE DRB-Information PRESENCE mandatory}, + ... +} + +QosMonitoringRequest ::= ENUMERATED {ul, dl, both, ...} + +QoSParaSetIndex ::= INTEGER (1..8, ...) + +QoSParaSetNotifyIndex ::= INTEGER (0..8, ...) + +-- R + +RACH-Config-Common ::= OCTET STRING + +RACH-Config-Common-IAB ::= OCTET STRING + +RACHReportContainer::= OCTET STRING + +RACHReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRACHReports)) OF RACHReportInformationItem + +RACHReportInformationItem ::= SEQUENCE { + rACHReportContainer RACHReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RACHReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RACHReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +RadioResourceStatus ::= SEQUENCE { + sSBAreaRadioResourceStatusList SSBAreaRadioResourceStatusList, + iE-Extensions ProtocolExtensionContainer { { RadioResourceStatus-ExtIEs} } OPTIONAL +} + +RadioResourceStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RANAC ::= INTEGER (0..255) + +RAN-MeasurementID ::= INTEGER (1.. 65536, ...) + +RAN-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +RANUEID ::= OCTET STRING (SIZE (8)) + +RANUEPagingIdentity ::= SEQUENCE { + iRNTI BIT STRING (SIZE(40)), + iE-Extensions ProtocolExtensionContainer { { RANUEPagingIdentity-ExtIEs } } OPTIONAL} + +RANUEPagingIdentity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RAT-FrequencyPriorityInformation::= CHOICE { + eNDC SubscriberProfileIDforRFP, + nGRAN RAT-FrequencySelectionPriority, + choice-extension ProtocolIE-SingleContainer { { RAT-FrequencyPriorityInformation-ExtIEs} } +} + +RAT-FrequencyPriorityInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RAT-FrequencySelectionPriority::= INTEGER (1.. 256, ...) + +Reestablishment-Indication ::= ENUMERATED { + reestablished, + ... +} + +ReferencePoint ::= CHOICE { + coordinateID CoordinateID, + referencePointCoordinate AccessPointPosition, + referencePointCoordinateHA NGRANHighAccuracyAccessPointPosition, + choice-Extension ProtocolIE-SingleContainer { { ReferencePoint-ExtIEs} } +} + +ReferencePoint-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ReferenceSFN ::= INTEGER (0..1023) + +ReferenceSignal ::= CHOICE { + nZP-CSI-RS NZP-CSI-RS-ResourceID, + sSB SSB, + sRS SRSResourceID, + positioningSRS SRSPosResourceID, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{ReferenceSignal-ExtIEs }} +} + +ReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RelativeCartesianLocation ::= SEQUENCE { + xYZunit ENUMERATED {mm, cm, dm, ...}, + xvalue INTEGER (-65536..65535), + yvalue INTEGER (-65536..65535), + zvalue INTEGER (-32768..32767), + locationUncertainty LocationUncertainty, + iE-Extensions ProtocolExtensionContainer { { RelativeCartesianLocation-ExtIEs} } OPTIONAL +} + +RelativeCartesianLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RelativeGeodeticLocation ::= SEQUENCE { + milli-Arc-SecondUnits ENUMERATED {zerodot03, zerodot3, three, ...}, + heightUnits ENUMERATED {mm, cm, m, ...}, + deltaLatitude INTEGER (-1024.. 1023), + deltaLongitude INTEGER (-1024.. 1023), + deltaHeight INTEGER (-1024.. 1023), + locationUncertainty LocationUncertainty, + iE-extensions ProtocolExtensionContainer {{RelativeGeodeticLocation-ExtIEs }} OPTIONAL +} + +RelativeGeodeticLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ReferenceTime ::= OCTET STRING + +RegistrationRequest ::= ENUMERATED{start, stop, add, ...} + +ReportCharacteristics ::= BIT STRING (SIZE(32)) + +ReportingPeriodicity ::= ENUMERATED{ms500, ms1000, ms2000, ms5000, ms10000, ...} + +RequestedBandCombinationIndex ::= OCTET STRING + +RequestedFeatureSetEntryIndex ::= OCTET STRING + +RequestedP-MaxFR2 ::= OCTET STRING + +Requested-PDCCH-BlindDetectionSCG ::= OCTET STRING + + +RequestedSRSTransmissionCharacteristics ::= SEQUENCE { + numberOfTransmissions INTEGER (0..500, ...) OPTIONAL, + resourceType ENUMERATED {periodic, semi-persistent, aperiodic,...}, + bandwidthSRS BandwidthSRS, + sRSResourceSetList SRSResourceSetList OPTIONAL, + sSBInformation SSBInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RequestedSRSTransmissionCharacteristics-ExtIEs} } OPTIONAL +} + +RequestedSRSTransmissionCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RequestType ::= ENUMERATED {offer, execution, ...} + +ResourceCoordinationEUTRACellInfo ::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Coex-Mode-Info, + eUTRA-PRACH-Configuration EUTRA-PRACH-Configuration, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationEUTRACellInfo-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationEUTRACellInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IgnorePRACHConfiguration CRITICALITY reject EXTENSION IgnorePRACHConfiguration PRESENCE optional }, + ... +} + +ResourceCoordinationTransferInformation ::= SEQUENCE { + meNB-Cell-ID EUTRA-Cell-ID, + resourceCoordinationEUTRACellInfo ResourceCoordinationEUTRACellInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationTransferInformation-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationTransferInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceCoordinationTransferContainer ::= OCTET STRING + +ResourceSetType ::= CHOICE { + periodic ResourceSetTypePeriodic, + semi-persistent ResourceSetTypeSemi-persistent, + aperiodic ResourceSetTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceSetType-ExtIEs }} +} + +ResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceSetTypePeriodic ::= SEQUENCE { + periodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeSemi-persistent ::= SEQUENCE { + semi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceSetTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeAperiodic ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + slotoffset INTEGER(1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RepetitionPeriod ::= INTEGER (0..131071, ...) + +ReportingRequestType ::= SEQUENCE { + eventType EventType, + reportingPeriodicityValue ReportingPeriodicityValue OPTIONAL, + -- C-ifEventTypeisPeriodic: This IE shall be present if the Event Type IE is set to "periodic" in the Event Type IE. + iE-Extensions ProtocolExtensionContainer { {ReportingRequestType-ExtIEs} } OPTIONAL +} + +ReportingRequestType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceType ::= CHOICE { + periodic ResourceTypePeriodic, + semi-persistent ResourceTypeSemi-persistent, + aperiodic ResourceTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceType-ExtIEs }} +} + +ResourceType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodic ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistent ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodic ::= SEQUENCE { + aperiodicResourceType ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypePos ::= CHOICE { + periodic ResourceTypePeriodicPos, + semi-persistent ResourceTypeSemi-persistentPos, + aperiodic ResourceTypeAperiodicPos, + choice-extension ProtocolIE-SingleContainer {{ ResourceTypePos-ExtIEs }} +} + +ResourceTypePos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodicPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistentPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistentPos-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistentPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodicPos ::= SEQUENCE { + slotOffset INTEGER (1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationInformation ::= SEQUENCE { + rLCDuplicationStateList RLCDuplicationStateList, + primaryPathIndication PrimaryPathIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationInformation-ExtIEs} } OPTIONAL +} + +RLCDuplicationInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationStateList ::= SEQUENCE (SIZE(1..maxnoofRLCDuplicationState)) OF RLCDuplicationState-Item + +RLCDuplicationState-Item ::=SEQUENCE { + duplicationState DuplicationState, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationState-Item-ExtIEs } } OPTIONAL, + ... +} + + +RLCDuplicationState-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCFailureIndication ::= SEQUENCE { + assocatedLCID LCID, + iE-Extensions ProtocolExtensionContainer { {RLCFailureIndication-ExtIEs} } OPTIONAL +} + +RLCFailureIndication-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCMode ::= ENUMERATED { + rlc-am, + rlc-um-bidirectional, + rlc-um-unidirectional-ul, + rlc-um-unidirectional-dl, + ... +} + +RLC-Status ::= SEQUENCE { + reestablishment-Indication Reestablishment-Indication, + iE-Extensions ProtocolExtensionContainer { { RLC-Status-ExtIEs } } OPTIONAL, + ... +} + +RLC-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLFReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRLFReports)) OF RLFReportInformationItem + +RLFReportInformationItem ::= SEQUENCE { + nRUERLFReportContainer NRUERLFReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RLFReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RLFReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RIMRSDetectionStatus ::= ENUMERATED {rs-detected, rs-disappeared, ...} + +RRCContainer ::= OCTET STRING + +RRCContainer-RRCSetupComplete ::= OCTET STRING + +RRCDeliveryStatus ::= SEQUENCE { + delivery-status PDCP-SN, + triggering-message PDCP-SN, + iE-Extensions ProtocolExtensionContainer { { RRCDeliveryStatus-ExtIEs } } OPTIONAL} + +RRCDeliveryStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +RRCDeliveryStatusRequest ::= ENUMERATED {true, ...} + +RRCReconfigurationCompleteIndicator ::= ENUMERATED { + true, + ..., + failure +} + +RRC-Version ::= SEQUENCE { + latest-RRC-Version BIT STRING (SIZE(3)), + iE-Extensions ProtocolExtensionContainer { { RRC-Version-ExtIEs } } OPTIONAL} + +RRC-Version-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-latest-RRC-Version-Enhanced CRITICALITY ignore EXTENSION OCTET STRING (SIZE(3)) PRESENCE optional }, + ... +} + +RoutingID ::= OCTET STRING + +-- S + +SCell-FailedtoSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-FailedtoSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeRemoved-Item ::= SEQUENCE { + sCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeRemoved-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeRemoved-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCell-ToBeSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCellIndex ::=INTEGER (1..31, ...) + +SCS-SpecificCarrier ::= SEQUENCE { + offsetToCarrier INTEGER (0..2199,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + carrierBandwidth INTEGER (0..275,...), + iE-Extensions ProtocolExtensionContainer { { SCS-SpecificCarrier-ExtIEs } } OPTIONAL +} + +SCS-SpecificCarrier-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Search-window-information ::= SEQUENCE { + expectedPropagationDelay INTEGER (-3841..3841,...), + delayUncertainty INTEGER (1..246,...), + iE-Extensions ProtocolExtensionContainer { { Search-window-information-ExtIEs } } OPTIONAL +} + +Search-window-information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SerialNumber ::= BIT STRING (SIZE (16)) + +SIBType-PWS ::=INTEGER (6..8, ...) + +SelectedBandCombinationIndex ::= OCTET STRING + +SelectedFeatureSetEntryIndex ::= OCTET STRING + +CG-ConfigInfo ::= OCTET STRING + +ServCellIndex ::= INTEGER (0..31, ...) + +ServingCellMO ::= INTEGER (1..64, ...) + +Served-Cell-Information ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI, + fiveGS-TAC FiveGS-TAC OPTIONAL, + configured-EPS-TAC Configured-EPS-TAC OPTIONAL, + servedPLMNs ServedPLMNs-List, + nR-Mode-Info NR-Mode-Info, + measurementTimingConfiguration OCTET STRING, + iE-Extensions ProtocolExtensionContainer { {Served-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RANAC CRITICALITY ignore EXTENSION RANAC PRESENCE optional }| + { ID id-ExtendedServedPLMNs-List CRITICALITY ignore EXTENSION ExtendedServedPLMNs-List PRESENCE optional }| + { ID id-Cell-Direction CRITICALITY ignore EXTENSION Cell-Direction PRESENCE optional }| + { ID id-BPLMN-ID-Info-List CRITICALITY ignore EXTENSION BPLMN-ID-Info-List PRESENCE optional }| + { ID id-Cell-Type CRITICALITY ignore EXTENSION CellType PRESENCE optional}| + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-AggressorgNBSetID CRITICALITY ignore EXTENSION AggressorgNBSetID PRESENCE optional}| + { ID id-VictimgNBSetID CRITICALITY ignore EXTENSION VictimgNBSetID PRESENCE optional}| + { ID id-IAB-Info-IAB-DU CRITICALITY ignore EXTENSION IAB-Info-IAB-DU PRESENCE optional}| + { ID id-SSB-PositionsInBurst CRITICALITY ignore EXTENSION SSB-PositionsInBurst PRESENCE optional }| + { ID id-NRPRACHConfig CRITICALITY ignore EXTENSION NRPRACHConfig PRESENCE optional }, + ... +} + +Served-Cells-To-Add-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Add-ItemExtIEs} } OPTIONAL, + ... +} + +Served-Cells-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Delete-Item ::= SEQUENCE { + oldNRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Delete-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Delete-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Modify-Item ::= SEQUENCE { + oldNRCGI NRCGI , + served-Cell-Information Served-Cell-Information , + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Modify-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Modify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-EUTRA-Cells-Information::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Mode-Info, + protectedEUTRAResourceIndication ProtectedEUTRAResourceIndication, + iE-Extensions ProtocolExtensionContainer { {Served-EUTRA-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-EUTRA-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Service-State ::= ENUMERATED { + in-service, + out-of-service, + ... +} + +Service-Status ::= SEQUENCE { + service-state Service-State, + switchingOffOngoing ENUMERATED {true, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Service-Status-ExtIEs } } OPTIONAL, + ... +} + +Service-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SFNInitialisationTime ::= BIT STRING (SIZE (64)) + +ShortDRXCycleLength ::= ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ...} + +ShortDRXCycleTimer ::= INTEGER (1..16) + +SIB1-message ::= OCTET STRING + +SIB10-message ::= OCTET STRING + +SIB12-message ::= OCTET STRING + +SIB13-message ::= OCTET STRING + +SIB14-message ::= OCTET STRING + +SItype ::= INTEGER (1..32, ...) + +SItype-List ::= SEQUENCE (SIZE(1.. maxnoofSITypes)) OF SItype-Item + +SItype-Item ::= SEQUENCE { + sItype SItype , + iE-Extensions ProtocolExtensionContainer { { SItype-ItemExtIEs } } OPTIONAL +} + +SItype-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SibtypetobeupdatedListItem ::= SEQUENCE { + sIBtype INTEGER (2..32,...), + sIBmessage OCTET STRING, + valueTag INTEGER (0..31,...), + iE-Extensions ProtocolExtensionContainer { { SibtypetobeupdatedListItem-ExtIEs } } OPTIONAL, + ... +} + +SibtypetobeupdatedListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-areaScope CRITICALITY ignore EXTENSION AreaScope PRESENCE optional}, + ... +} + +SLDRBID ::= INTEGER (1..512, ...) + +SLDRBInformation ::= SEQUENCE { + sLDRB-QoS PC5QoSParameters, + flowsMappedToSLDRB-List FlowsMappedToSLDRB-List, + ... +} + +SLDRBs-FailedToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Modified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Modified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ModifiedConf-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ModifiedConf-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Setup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Setup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-SetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-SetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation OPTIONAL, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode, + + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SL-PHY-MAC-RLC-Config ::= OCTET STRING + +SL-ConfigDedicatedEUTRA ::= OCTET STRING + +SliceAvailableCapacity ::= SEQUENCE { + sliceAvailableCapacityList SliceAvailableCapacityList, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacity-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceAvailableCapacityList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceAvailableCapacityItem + +SliceAvailableCapacityItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIAvailableCapacity-List SNSSAIAvailableCapacity-List, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacityItem-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacityItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SNSSAIAvailableCapacity-List ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAIAvailableCapacity-Item + +SNSSAIAvailableCapacity-Item ::= SEQUENCE { + sNSSAI SNSSAI, + sliceAvailableCapacityValueDownlink INTEGER (0..100) OPTIONAL, + sliceAvailableCapacityValueUplink INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SNSSAIAvailableCapacity-Item-ExtIEs } } OPTIONAL +} + +SNSSAIAvailableCapacity-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SliceSupportItem + +SliceSupportItem ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SliceSupportItem-ExtIEs } } OPTIONAL +} + +SliceSupportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceToReportList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceToReportItem + +SliceToReportItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIlist SNSSAI-list, + iE-Extensions ProtocolExtensionContainer { { SliceToReportItem-ExtIEs} } OPTIONAL +} + +SliceToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SlotNumber ::= INTEGER (0..79) + +SNSSAI-list ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAI-Item + +SNSSAI-Item ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SNSSAI-Item-ExtIEs } } OPTIONAL +} + +SNSSAI-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Slot-Configuration-List ::= SEQUENCE (SIZE(1.. maxnoofslots)) OF Slot-Configuration-Item + +Slot-Configuration-Item ::= SEQUENCE { + slotIndex INTEGER (0..5119, ...), + symbolAllocInSlot SymbolAllocInSlot, + iE-Extensions ProtocolExtensionContainer { { Slot-Configuration-ItemExtIEs } } OPTIONAL +} + +Slot-Configuration-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SNSSAI ::= SEQUENCE { + sST OCTET STRING (SIZE(1)), + sD OCTET STRING (SIZE(3)) OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SNSSAI-ExtIEs } } OPTIONAL +} + +SNSSAI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialDirectionInformation ::= SEQUENCE { + nR-PRSBeamInformation NR-PRSBeamInformation, + iE-Extensions ProtocolExtensionContainer { { SpatialDirectionInformation-ExtIEs } } OPTIONAL +} + +SpatialDirectionInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationInfo ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationInfo-ExtIEs} } OPTIONAL +} + +SpatialRelationInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationforResourceID ::= SEQUENCE (SIZE(1..maxnoofSpatialRelations)) OF SpatialRelationforResourceIDItem + +SpatialRelationforResourceIDItem ::= SEQUENCE { + referenceSignal ReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationforResourceIDItem-ExtIEs} } OPTIONAL +} + +SpatialRelationforResourceIDItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationPos ::= CHOICE { + sSBPos SSBPos, + pRSInformationPos PRSInformationPos, + choice-extension ProtocolIE-SingleContainer {{ SpatialInformationPos-ExtIEs }} +} + +SpatialInformationPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SpectrumSharingGroupID ::= INTEGER (1..maxCellineNB) + +SRBID ::= INTEGER (0..3, ...) + +SRBs-FailedToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Modified-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Setup-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-SetupMod-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRBs-ToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID, + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRSCarrier-List ::= SEQUENCE (SIZE(1.. maxnoSRS-Carriers)) OF SRSCarrier-List-Item + +SRSCarrier-List-Item ::= SEQUENCE { + pointA INTEGER (0..3279165,...), + uplinkChannelBW-PerSCS-List UplinkChannelBW-PerSCS-List, + activeULBWP ActiveULBWP, + pci NRPCI, + iE-Extensions ProtocolExtensionContainer { { SRSCarrier-List-Item-ExtIEs } } OPTIONAL +} + +SRSCarrier-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfig ::= SEQUENCE { + sRSResource-List SRSResource-List OPTIONAL, + posSRSResource-List PosSRSResource-List OPTIONAL, + sRSResourceSet-List SRSResourceSet-List OPTIONAL, + posSRSResourceSet-List PosSRSResourceSet-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSConfig-ExtIEs } } OPTIONAL +} + +SRSConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfiguration ::= SEQUENCE { + sRSCarrier-List SRSCarrier-List, + iE-Extensions ProtocolExtensionContainer { { SRSConfiguration-ExtIEs } } OPTIONAL +} + +SRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSPosResourceID ::= INTEGER (0..63, ...) + +SRSResource::= SEQUENCE { + sRSResourceID SRSResourceID, + nrofSRS-Ports ENUMERATED {port1, ports2, ports4}, + transmissionComb TransmissionComb, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4}, + repetitionFactor ENUMERATED {n1, n2, n4}, + freqDomainPosition INTEGER (0..67), + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + b-SRS INTEGER (0..3), + b-hop INTEGER (0..3), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceType ResourceType, + slotOffset INTEGER (0..2559), + sequenceId INTEGER (0..1023), + iE-Extensions ProtocolExtensionContainer { { SRSResource-ExtIEs } } OPTIONAL +} + +SRSResource-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceID ::= INTEGER (0..63, ...) + +SRSResourceID-List::= SEQUENCE (SIZE (1..maxnoSRS-ResourcePerSet)) OF SRSResourceID + +SRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-Resources)) OF SRSResource + +SRSResourceSet::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSResourceID-List SRSResourceID-List, + resourceSetType ResourceSetType, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSet-ExtIEs } } OPTIONAL +} + +SRSResourceSet-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSetID ::= INTEGER (0..15, ...) + +SRSResourceSetList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourceSets)) OF SRSResourceSetItem + +SRSResourceSetItem ::= SEQUENCE { + numSRSresourcesperset INTEGER (1..16, ...) OPTIONAL, + periodicityList PeriodicityList OPTIONAL, + spatialRelationInfo SpatialRelationInfo OPTIONAL, + pathlossReferenceInfo PathlossReferenceInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSetItemExtIEs } } OPTIONAL +} + +SRSResourceSetItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-ResourceSets)) OF SRSResourceSet + +SRSResourceTrigger ::= SEQUENCE { + aperiodicSRSResourceTriggerList AperiodicSRSResourceTriggerList, + iE-Extensions ProtocolExtensionContainer { {SRSResourceTrigger-ExtIEs} } OPTIONAL +} + +SRSResourceTrigger-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSSpatialRelation ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SRSSpatialRelation-ExtIEs} } OPTIONAL +} + +SRSSpatialRelation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB ::= SEQUENCE { + pCI-NR NRPCI, + ssb-index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SSB-ExtIEs} } OPTIONAL +} + +SSB-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-freqInfo ::= INTEGER (0..maxNRARFCN) + +SSB-Index ::= INTEGER(0..63) + +SSBPos ::= SEQUENCE { + pCI-NR NRPCI OPTIONAL, + ssb-index SSB-Index, + iE-Extensions ProtocolExtensionContainer { {SSBPos-ExtIEs} } OPTIONAL +} + +SSBPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-subcarrierSpacing ::= ENUMERATED {kHz15, kHz30, kHz120, kHz240, spare3, spare2, spare1, ...} + +SSB-transmissionPeriodicity ::= ENUMERATED {sf10, sf20, sf40, sf80, sf160, sf320, sf640, ...} + +SSB-transmissionTimingOffset ::= INTEGER (0..127, ...) + +SSB-transmissionBitmap ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { { SSB-transmisisonBitmap-ExtIEs} } +} + +SSB-transmisisonBitmap-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSBAreaCapacityValueList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaCapacityValueItem + +SSBAreaCapacityValueItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaCapacityValue INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { SSBAreaCapacityValueItem-ExtIEs} } OPTIONAL +} + +SSBAreaCapacityValueItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBAreaRadioResourceStatusList::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaRadioResourceStatusItem + +SSBAreaRadioResourceStatusItem::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaDLGBRPRBusage INTEGER (0..100), + sSBAreaULGBRPRBusage INTEGER (0..100), + sSBAreaDLnon-GBRPRBusage INTEGER (0..100), + sSBAreaULnon-GBRPRBusage INTEGER (0..100), + sSBAreaDLTotalPRBusage INTEGER (0..100), + sSBAreaULTotalPRBusage INTEGER (0..100), + dLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + uLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSBAreaRadioResourceStatusItem-ExtIEs} } OPTIONAL +} + +SSBAreaRadioResourceStatusItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformation ::= SEQUENCE { + sSBInformationList SSBInformationList, + iE-Extensions ProtocolExtensionContainer { { SSBInformation-ExtIEs } } OPTIONAL +} + +SSBInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformationList ::= SEQUENCE (SIZE(1.. maxnoofSSBs)) OF SSBInformationItem + +SSBInformationItem ::= SEQUENCE { + sSB-Configuration SSB-TF-Configuration, + pCI-NR NRPCI, + iE-Extensions ProtocolExtensionContainer { { SSBInformationItem-ExtIEs } } OPTIONAL +} + +SSBInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-PositionsInBurst ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { {SSB-PositionsInBurst-ExtIEs} } +} + +SSB-PositionsInBurst-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSB-TF-Configuration ::= SEQUENCE { + sSB-frequency INTEGER (0..3279165), + sSB-subcarrier-spacing ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, ...}, + sSB-Transmit-power INTEGER (-60..50), + sSB-periodicity ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, ...}, + sSB-half-frame-offset INTEGER(0..1), + sSB-SFN-offset INTEGER(0..15), + sSB-position-in-burst SSB-PositionsInBurst OPTIONAL, + sFNInitialisationTime SFNInitialisationTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSB-TF-Configuration-ExtIEs} } OPTIONAL +} + +SSB-TF-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SSBToReportList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBToReportItem + +SSBToReportItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { SSBToReportItem-ExtIEs} } OPTIONAL +} + +SSBToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SUL-Information ::= SEQUENCE { + sUL-NRARFCN INTEGER (0..maxNRARFCN), + sUL-transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { { SUL-InformationExtIEs} } OPTIONAL, + ... +} + +SUL-InformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +SubcarrierSpacing ::= ENUMERATED { kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1, ...} + +SubscriberProfileIDforRFP ::= INTEGER (1..256, ...) + +SULAccessIndication ::= ENUMERATED {true,...} + + +SupportedSULFreqBandItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + iE-Extensions ProtocolExtensionContainer { { SupportedSULFreqBandItem-ExtIEs} } OPTIONAL, + ... +} + +SupportedSULFreqBandItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SymbolAllocInSlot ::= CHOICE { + all-DL NULL, + all-UL NULL, + both-DL-and-UL NumDLULSymbols, + choice-extension ProtocolIE-SingleContainer { { SymbolAllocInSlot-ExtIEs } } +} + +SymbolAllocInSlot-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SystemFrameNumber ::= INTEGER (0..1023) + +SystemInformationAreaID ::=BIT STRING (SIZE (24)) + +-- T + +FiveGS-TAC ::= OCTET STRING (SIZE(3)) + +Configured-EPS-TAC ::= OCTET STRING (SIZE(2)) + +TargetCellList ::= SEQUENCE (SIZE(1..maxnoofCHOcells)) OF TargetCellList-Item + +TargetCellList-Item ::= SEQUENCE { + target-cell NRCGI, + iE-Extensions ProtocolExtensionContainer { { TargetCellList-Item-ExtIEs} } OPTIONAL +} + +TargetCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TDD-Info ::= SEQUENCE { + nRFreqInfo NRFreqInfo, + transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IntendedTDD-DL-ULConfig CRITICALITY ignore EXTENSION IntendedTDD-DL-ULConfig PRESENCE optional}| + {ID id-TDD-UL-DLConfigCommonNR CRITICALITY ignore EXTENSION TDD-UL-DLConfigCommonNR PRESENCE optional }| + {ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +TDD-UL-DLConfigCommonNR ::= OCTET STRING + +TimeReferenceInformation ::= SEQUENCE { + referenceTime ReferenceTime, + referenceSFN ReferenceSFN, + uncertainty Uncertainty, + timeInformationType TimeInformationType, + iE-Extensions ProtocolExtensionContainer { {TimeReferenceInformation-ExtIEs} } OPTIONAL +} + +TimeReferenceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeInformationType ::= ENUMERATED {localClock} + +TimeStamp ::= SEQUENCE { + systemFrameNumber SystemFrameNumber, + slotIndex TimeStampSlotIndex, + measurementTime SFNInitialisationTime OPTIONAL, + iE-Extension ProtocolExtensionContainer { { TimeStamp-ExtIEs} } OPTIONAL +} + +TimeStamp-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeStampSlotIndex ::= CHOICE { + sCS-15 INTEGER(0..9), + sCS-30 INTEGER(0..19), + sCS-60 INTEGER(0..39), + sCS-120 INTEGER(0..79), + choice-extension ProtocolIE-SingleContainer { { TimeStampSlotIndex-ExtIEs} } +} + +TimeStampSlotIndex-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TimeToWait ::= ENUMERATED {v1s, v2s, v5s, v10s, v20s, v60s, ...} + +TimingMeasurementQuality ::= SEQUENCE { + measurementQuality INTEGER(0..31), + resolution ENUMERATED{m0dot1, m1, m10, m30, ...}, + iE-Extensions ProtocolExtensionContainer { { TimingMeasurementQuality-ExtIEs} } OPTIONAL +} + +TimingMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TNLAssociationUsage ::= ENUMERATED { + ue, + non-ue, + both, + ... +} + +TNLCapacityIndicator::= SEQUENCE { + dLTNLOfferedCapacity INTEGER (1.. 16777216,...), + dLTNLAvailableCapacity INTEGER (0.. 100,...), + uLTNLOfferedCapacity INTEGER (1.. 16777216,...), + uLTNLAvailableCapacity INTEGER (0.. 100,...), + iE-Extensions ProtocolExtensionContainer { { TNLCapacityIndicator-ExtIEs} } OPTIONAL +} + +TNLCapacityIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TraceActivation ::= SEQUENCE { + traceID TraceID, + interfacesToTrace InterfacesToTrace, + traceDepth TraceDepth, + traceCollectionEntityIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { {TraceActivation-ExtIEs} } OPTIONAL +} + +TraceActivation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-mdtConfiguration CRITICALITY ignore EXTENSION MDTConfiguration PRESENCE optional}| + {ID id-TraceCollectionEntityURI CRITICALITY ignore EXTENSION URI-address PRESENCE optional }, + ... +} + +TraceDepth ::= ENUMERATED { + minimum, + medium, + maximum, + minimumWithoutVendorSpecificExtension, + mediumWithoutVendorSpecificExtension, + maximumWithoutVendorSpecificExtension, + ... +} + +TraceID ::= OCTET STRING (SIZE(8)) + +TrafficMappingInfo ::= CHOICE { + iPtolayer2TrafficMappingInfo IPtolayer2TrafficMappingInfo, + bAPlayerBHRLCchannelMappingInfo BAPlayerBHRLCchannelMappingInfo, + choice-extension ProtocolIE-SingleContainer { { TrafficMappingInfo-ExtIEs} } +} + +TrafficMappingInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TransactionID ::= INTEGER (0..255, ...) + +Transmission-Bandwidth ::= SEQUENCE { + nRSCS NRSCS, + nRNRB NRNRB, + iE-Extensions ProtocolExtensionContainer { { Transmission-Bandwidth-ExtIEs} } OPTIONAL, + ... +} + +Transmission-Bandwidth-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionComb ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + choice-extension ProtocolIE-SingleContainer { { TransmissionComb-ExtIEs} } +} +TransmissionComb-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransmissionCombPos ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + n8 SEQUENCE { + combOffset-n8 INTEGER (0..7), + cyclicShift-n8 INTEGER (0..5) + }, + + choice-extension ProtocolIE-SingleContainer { { TransmissionCombPos-ExtIEs} } +} +TransmissionCombPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Add-Item + +Transport-UP-Layer-Address-Info-To-Add-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToAdd GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Remove-Item + +Transport-UP-Layer-Address-Info-To-Remove-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToRemove GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionActionIndicator ::= ENUMERATED {stop, ..., restart } + +TRPID ::= INTEGER (0.. maxnoofTRPs, ...) + +TRPInformation ::= SEQUENCE { + tRPID TRPID, + tRPInformationTypeResponseList TRPInformationTypeResponseList, + iE-Extensions ProtocolExtensionContainer { { TRPInformation-ExtIEs } } OPTIONAL +} + +TRPInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationItem ::= SEQUENCE { + tRPInformation TRPInformation, + iE-Extensions ProtocolExtensionContainer { { TRPInformationItem-ExtIEs } } OPTIONAL +} + +TRPInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationTypeItem ::= ENUMERATED { + nrPCI, + nG-RAN-CGI, + arfcn, + pRSConfig, + sSBConfig, + sFNInitTime, + spatialDirectInfo, + geoCoord, +...} + + +TRPInformationTypeResponseList ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF TRPInformationTypeResponseItem + +TRPInformationTypeResponseItem ::= CHOICE { + pCI-NR NRPCI, + nG-RAN-CGI NRCGI, + nRARFCN INTEGER (0..maxNRARFCN), + pRSConfiguration PRSConfiguration, + sSBinformation SSBInformation, + sFNInitialisationTime SFNInitialisationTime, + spatialDirectionInformation SpatialDirectionInformation, + geographicalCoordinates GeographicalCoordinates, + choice-extension ProtocolIE-SingleContainer { { TRPInformationTypeResponseItem-ExtIEs} } +} + +TRPInformationTypeResponseItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +TRPList ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF TRPListItem + +TRPListItem ::= SEQUENCE { + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { TRPListItem-ExtIEs } } OPTIONAL +} + +TRPListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality ::= SEQUENCE { + tRPmeasurementQuality-Item TRPMeasurementQuality-Item, + iE-Extensions ProtocolExtensionContainer { {TRPMeasurementQuality-ExtIEs} } OPTIONAL +} + +TRPMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality-Item ::= CHOICE { + timingMeasurementQuality TimingMeasurementQuality, + angleMeasurementQuality AngleMeasurementQuality, + choice-extension ProtocolIE-SingleContainer { { TRPMeasurementQuality-Item-ExtIEs } } +} + +TRPMeasurementQuality-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRP-MeasurementRequestList ::= SEQUENCE (SIZE (1..maxNoOfMeasTRPs)) OF TRP-MeasurementRequestItem + +TRP-MeasurementRequestItem ::= SEQUENCE { + tRPID TRPID, + search-window-information Search-window-information OPTIONAL, + iE-extensions ProtocolExtensionContainer { { TRP-MeasurementRequestItem-ExtIEs } } OPTIONAL +} + +TRP-MeasurementRequestItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDefinitionType ::= CHOICE { + direct TRPPositionDirect, + referenced TRPPositionReferenced, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDefinitionType-ExtIEs } } +} + +TRPPositionDefinitionType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionDirect ::= SEQUENCE { + accuracy TRPPositionDirectAccuracy, + iE-extensions ProtocolExtensionContainer { { TRPPositionDirect-ExtIEs } } OPTIONAL +} + +TRPPositionDirect-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDirectAccuracy ::= CHOICE { + tRPPosition AccessPointPosition, + tRPHAposition NGRANHighAccuracyAccessPointPosition, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDirectAccuracy-ExtIEs } } +} + +TRPPositionDirectAccuracy-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionReferenced ::= SEQUENCE { + referencePoint ReferencePoint, + referencePointType TRPReferencePointType, + iE-extensions ProtocolExtensionContainer { { TRPPositionReferenced-ExtIEs } } OPTIONAL +} + +TRPPositionReferenced-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPReferencePointType ::= CHOICE { + tRPPositionRelativeGeodetic RelativeGeodeticLocation, + tRPPositionRelativeCartesian RelativeCartesianLocation, + choice-extension ProtocolIE-SingleContainer { { TRPReferencePointType-ExtIEs } } +} + +TRPReferencePointType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + +Transport-Layer-Address-Info ::= SEQUENCE { + transport-UP-Layer-Address-Info-To-Add-List Transport-UP-Layer-Address-Info-To-Add-List OPTIONAL, + transport-UP-Layer-Address-Info-To-Remove-List Transport-UP-Layer-Address-Info-To-Remove-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-Layer-Address-Info-ExtIEs } } OPTIONAL +} + +Transport-Layer-Address-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCAssistanceInformation ::= SEQUENCE { + periodicity Periodicity, + burstArrivalTime BurstArrivalTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCAssistanceInformation-ExtIEs} } OPTIONAL, + ... +} + +TSCAssistanceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCTrafficCharacteristics ::= SEQUENCE { + tSCAssistanceInformationDL TSCAssistanceInformation OPTIONAL, + tSCAssistanceInformationUL TSCAssistanceInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCTrafficCharacteristics-ExtIEs} } OPTIONAL, + ... +} + +TSCTrafficCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- U +UAC-Assistance-Info ::= SEQUENCE { + uACPLMN-List UACPLMN-List, + iE-Extensions ProtocolExtensionContainer { { UAC-Assistance-InfoExtIEs} } OPTIONAL +} + +UAC-Assistance-InfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACPLMN-List ::= SEQUENCE (SIZE(1..maxnoofUACPLMNs)) OF UACPLMN-Item + +UACPLMN-Item::= SEQUENCE { + pLMNIdentity PLMN-Identity, + uACType-List UACType-List, iE-Extensions ProtocolExtensionContainer { { UACPLMN-Item-ExtIEs} } OPTIONAL +} + +UACPLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NID CRITICALITY ignore EXTENSION NID PRESENCE optional }, + ... +} + +UACType-List ::= SEQUENCE (SIZE(1..maxnoofUACperPLMN)) OF UACType-Item + +UACType-Item::= SEQUENCE { + uACReductionIndication UACReductionIndication, + uACCategoryType UACCategoryType, + iE-Extensions ProtocolExtensionContainer { { UACType-Item-ExtIEs } } OPTIONAL +} + +UACType-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACCategoryType ::= CHOICE { + uACstandardized UACAction, + uACOperatorDefined UACOperatorDefined, + choice-extension ProtocolIE-SingleContainer { { UACCategoryType-ExtIEs } } +} + +UACCategoryType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UACOperatorDefined ::= SEQUENCE { + accessCategory INTEGER (32..63,...), + accessIdentity BIT STRING (SIZE(7)), + iE-Extensions ProtocolExtensionContainer { { UACOperatorDefined-ExtIEs} } OPTIONAL +} + +UACOperatorDefined-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +UACAction ::= ENUMERATED { + reject-non-emergency-mo-dt, + reject-rrc-cr-signalling, + permit-emergency-sessions-and-mobile-terminated-services-only, + permit-high-priority-sessions-and-mobile-terminated-services-only, + ... +} + +UACReductionIndication ::= INTEGER (0..100) + + +UE-associatedLogicalF1-ConnectionItem ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID OPTIONAL, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalF1-ConnectionItemExtIEs} } OPTIONAL, + ... +} + +UEAssistanceInformation ::= OCTET STRING + +UEAssistanceInformationEUTRA ::= OCTET STRING + +UE-associatedLogicalF1-ConnectionItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-CapabilityRAT-ContainerList::= OCTET STRING + +UEContextNotRetrievable ::= ENUMERATED {true, ...} + +UEIdentityIndexValue ::= CHOICE { + indexLength10 BIT STRING (SIZE (10)), + choice-extension ProtocolIE-SingleContainer { {UEIdentityIndexValueChoice-ExtIEs} } +} + +UEIdentityIndexValueChoice-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-AoA ::= SEQUENCE { + azimuthAoA INTEGER (0..3599), + zenithAoA INTEGER (0..1799) OPTIONAL, + angleCoordinateSystem ENUMERATED {lCS, gCS} OPTIONAL, + iE-extensions ProtocolExtensionContainer { { UL-AoA-ExtIEs } } +} + +UL-AoA-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping ::= SEQUENCE { + uL-BH-Non-UP-Traffic-Mapping-List UL-BH-Non-UP-Traffic-Mapping-List, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping-List ::= SEQUENCE (SIZE(1..maxnoofNonUPTrafficMappings)) OF UL-BH-Non-UP-Traffic-Mapping-Item + +UL-BH-Non-UP-Traffic-Mapping-Item ::= SEQUENCE { + nonUPTrafficType NonUPTrafficType, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULConfiguration ::= SEQUENCE { + uLUEConfiguration ULUEConfiguration, + iE-Extensions ProtocolExtensionContainer { { ULConfigurationExtIEs } } OPTIONAL, + ... +} +ULConfigurationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-Measurement ::= SEQUENCE { + uL-RTOA-MeasurementItem UL-RTOA-MeasurementItem, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UL-RTOA-Measurement-ExtIEs } } OPTIONAL +} + +UL-RTOA-Measurement-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-MeasurementItem ::= CHOICE { + k0 INTEGER (0..1970049), + k1 INTEGER (0..985025), + k2 INTEGER (0..492513), + k3 INTEGER (0..246257), + k4 INTEGER (0..123129), + k5 INTEGER (0..61565), + choice-extension ProtocolIE-SingleContainer { { UL-RTOA-MeasurementItem-ExtIEs } } +} + +UL-RTOA-MeasurementItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-SRS-RSRP ::= INTEGER (0..127) + +ULUEConfiguration ::= ENUMERATED {no-data, shared, only, ...} + +UL-UP-TNL-Information-to-Update-List-Item ::= SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + newULUPTNLInformation UPTransportLayerInformation OPTIONAL, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Information-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Information-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofULUPTNLInformation)) OF ULUPTNLInformation-ToBeSetup-Item + +ULUPTNLInformation-ToBeSetup-Item ::=SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { ULUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +ULUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-BHInfo CRITICALITY ignore EXTENSION BHInfo PRESENCE optional }, + ... +} + +Uncertainty ::= INTEGER (0..32767, ...) + +UplinkChannelBW-PerSCS-List ::= SEQUENCE (SIZE (1..maxnoSCSs)) OF SCS-SpecificCarrier + +UplinkTxDirectCurrentListInformation ::= OCTET STRING + +UPTransportLayerInformation ::= CHOICE { + gTPTunnel GTPTunnel, + choice-extension ProtocolIE-SingleContainer { { UPTransportLayerInformation-ExtIEs} } +} + +UPTransportLayerInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +URI-address ::= VisibleString + +-- V + +VictimgNBSetID ::= SEQUENCE { + victimgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { VictimgNBSetID-ExtIEs } } OPTIONAL +} + +VictimgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +VehicleUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +PedestrianUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +-- W + +-- X + +-- Y + +-- Z + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Contents.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Contents.asn new file mode 100644 index 0000000000000000000000000000000000000000..ba6351eddd286d9b17df7eb2b9a17819d40802f5 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Contents.asn @@ -0,0 +1,3633 @@ +-- ************************************************************** +-- +-- PDU definitions for F1AP. +-- +-- ************************************************************** + +F1AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Candidate-SpCell-Item, + Cause, + Cells-Failed-to-be-Activated-List-Item, + Cells-Status-Item, + Cells-to-be-Activated-List-Item, + Cells-to-be-Deactivated-List-Item, + CellULConfigured, + CriticalityDiagnostics, + C-RNTI, + CUtoDURRCInformation, + DRB-Activity-Item, + DRBID, + DRBs-FailedToBeModified-Item, + DRBs-FailedToBeSetup-Item, + DRBs-FailedToBeSetupMod-Item, + DRB-Notify-Item, + DRBs-ModifiedConf-Item, + DRBs-Modified-Item, + DRBs-Required-ToBeModified-Item, + DRBs-Required-ToBeReleased-Item, + DRBs-Setup-Item, + DRBs-SetupMod-Item, + DRBs-ToBeModified-Item, + DRBs-ToBeReleased-Item, + DRBs-ToBeSetup-Item, + DRBs-ToBeSetupMod-Item, + DRXCycle, + DRXConfigurationIndicator, + DUtoCURRCInformation, + EUTRANQoS, + ExecuteDuplication, + FullConfiguration, + GNB-CU-UE-F1AP-ID, + GNB-DU-UE-F1AP-ID, + GNB-DU-ID, + GNB-DU-Served-Cells-Item, + GNB-DU-System-Information, + GNB-CU-Name, + GNB-DU-Name, + InactivityMonitoringRequest, + InactivityMonitoringResponse, + LowerLayerPresenceStatusChange, + NotificationControl, + NRCGI, + NRPCI, + UEContextNotRetrievable, + Potential-SpCell-Item, + RAT-FrequencyPriorityInformation, + RequestedSRSTransmissionCharacteristics, + ResourceCoordinationTransferContainer, + RRCContainer, + RRCContainer-RRCSetupComplete, + RRCReconfigurationCompleteIndicator, + SCellIndex, + SCell-ToBeRemoved-Item, + SCell-ToBeSetup-Item, + SCell-ToBeSetupMod-Item, + SCell-FailedtoSetup-Item, + SCell-FailedtoSetupMod-Item, + ServCellIndex, + Served-Cell-Information, + Served-Cells-To-Add-Item, + Served-Cells-To-Delete-Item, + Served-Cells-To-Modify-Item, + ServingCellMO, + SRBID, + SRBs-FailedToBeSetup-Item, + SRBs-FailedToBeSetupMod-Item, + SRBs-Required-ToBeReleased-Item, + SRBs-ToBeReleased-Item, + SRBs-ToBeSetup-Item, + SRBs-ToBeSetupMod-Item, + SRBs-Modified-Item, + SRBs-Setup-Item, + SRBs-SetupMod-Item, + TimeToWait, + TransactionID, + TransmissionActionIndicator, + UE-associatedLogicalF1-ConnectionItem, + DUtoCURRCContainer, + PagingCell-Item, + SItype-List, + UEIdentityIndexValue, + GNB-CU-TNL-Association-Setup-Item, + GNB-CU-TNL-Association-Failed-To-Setup-Item, + GNB-CU-TNL-Association-To-Add-Item, + GNB-CU-TNL-Association-To-Remove-Item, + GNB-CU-TNL-Association-To-Update-Item, + MaskedIMEISV, + PagingDRX, + PagingPriority, + PagingIdentity, + Cells-to-be-Barred-Item, + PWSSystemInformation, + Broadcast-To-Be-Cancelled-Item, + Cells-Broadcast-Cancelled-Item, + NR-CGI-List-For-Restart-Item, + PWS-Failed-NR-CGI-Item, + RepetitionPeriod, + NumberofBroadcastRequest, + Cells-To-Be-Broadcast-Item, + Cells-Broadcast-Completed-Item, + Cancel-all-Warning-Messages-Indicator, + EUTRA-NR-CellResourceCoordinationReq-Container, + EUTRA-NR-CellResourceCoordinationReqAck-Container, + RequestType, + PLMN-Identity, + RLCFailureIndication, + UplinkTxDirectCurrentListInformation, + SULAccessIndication, + Protected-EUTRA-Resources-Item, + GNB-DUConfigurationQuery, + BitRate, + RRC-Version, + GNBDUOverloadInformation, + RRCDeliveryStatusRequest, + NeedforGap, + RRCDeliveryStatus, + ResourceCoordinationTransferInformation, + Dedicated-SIDelivery-NeededUE-Item, + Associated-SCell-Item, + IgnoreResourceCoordinationContainer, + PagingOrigin, + UAC-Assistance-Info, + RANUEID, + GNB-DU-TNL-Association-To-Remove-Item, + NotificationInformation, + TraceActivation, + TraceID, + Neighbour-Cell-Information-Item, + SymbolAllocInSlot, + NumDLULSymbols, + AdditionalRRMPriorityIndex, + DUCURadioInformationType, + CUDURadioInformationType, + Transport-Layer-Address-Info, + BHChannels-ToBeSetup-Item, + BHChannels-Setup-Item, + BHChannels-FailedToBeSetup-Item, + BHChannels-ToBeModified-Item, + BHChannels-ToBeReleased-Item, + BHChannels-ToBeSetupMod-Item, + BHChannels-FailedToBeModified-Item, + BHChannels-FailedToBeSetupMod-Item, + BHChannels-Modified-Item, + BHChannels-SetupMod-Item, + BHChannels-Required-ToBeReleased-Item, + BAPAddress, + BAPPathID, + BAPRoutingID, + BH-Routing-Information-Added-List-Item, + BH-Routing-Information-Removed-List-Item, + Child-Nodes-List, + Child-Nodes-List-Item, + Child-Node-Cells-List, + Child-Node-Cells-List-Item, + Activated-Cells-to-be-Updated-List, + Activated-Cells-to-be-Updated-List-Item, + UL-BH-Non-UP-Traffic-Mapping, + IABTNLAddressesRequested, + IABIPv6RequestType, + IAB-TNL-Addresses-To-Remove-Item, + IABTNLAddress, + IAB-Allocated-TNL-Address-Item, + IABv4AddressesRequested, + TrafficMappingInfo, + UL-UP-TNL-Information-to-Update-List-Item, + UL-UP-TNL-Address-to-Update-List-Item, + DL-UP-TNL-Address-to-Update-List-Item, + NRV2XServicesAuthorized, + LTEV2XServicesAuthorized, + NRUESidelinkAggregateMaximumBitrate, + LTEUESidelinkAggregateMaximumBitrate, + SLDRBs-SetupMod-Item, + SLDRBs-ModifiedConf-Item, + SLDRBID, + SLDRBs-FailedToBeModified-Item, + SLDRBs-FailedToBeSetup-Item, + SLDRBs-FailedToBeSetupMod-Item, + SLDRBs-Modified-Item, + SLDRBs-Required-ToBeModified-Item, + SLDRBs-Required-ToBeReleased-Item, + SLDRBs-Setup-Item, + SLDRBs-ToBeModified-Item, + SLDRBs-ToBeReleased-Item, + SLDRBs-ToBeSetup-Item, + SLDRBs-ToBeSetupMod-Item, + GNBCUMeasurementID, + GNBDUMeasurementID, + RegistrationRequest, + ReportCharacteristics, + CellToReportList, + HardwareLoadIndicator, + CellMeasurementResultList, + ReportingPeriodicity, + TNLCapacityIndicator, + RACHReportInformationList, + RLFReportInformationList, + ReportingRequestType, + TimeReferenceInformation, + ConditionalInterDUMobilityInformation, + ConditionalIntraDUMobilityInformation, + TargetCellList, + MDTPLMNList, + PrivacyIndicator, + TransportLayerAddress, + URI-address, + NID, + PosAssistance-Information, + PosBroadcast, + PositioningBroadcastCells, + RoutingID, + PosAssistanceInformationFailureList, + PosMeasurementQuantities, + PosMeasurementResultList, + PosMeasurementPeriodicity, + PosReportCharacteristics, + TRPInformationTypeItem, + TRPInformationItem, + LMF-MeasurementID, + RAN-MeasurementID, + SRSResourceSetID, + SRSSpatialRelation, + SRSResourceTrigger, + SRSConfiguration, + TRPList, + E-CID-MeasurementQuantities, + E-CID-MeasurementPeriodicity, + E-CID-MeasurementResult, + Cell-Portion-ID, + LMF-UE-MeasurementID, + RAN-UE-MeasurementID, + SFNInitialisationTime, + SystemFrameNumber, + SlotNumber, + AbortTransmission, + TRP-MeasurementRequestList, + MeasurementBeamInfoRequest, + E-CID-ReportCharacteristics, + Extended-GNB-CU-Name, + Extended-GNB-DU-Name + + + +FROM F1AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-SingleContainer{}, + F1AP-PRIVATE-IES, + F1AP-PROTOCOL-EXTENSION, + F1AP-PROTOCOL-IES, + F1AP-PROTOCOL-IES-PAIR + +FROM F1AP-Containers + + id-Candidate-SpCell-Item, + id-Candidate-SpCell-List, + id-Cause, + id-Cancel-all-Warning-Messages-Indicator, + id-Cells-Failed-to-be-Activated-List, + id-Cells-Failed-to-be-Activated-List-Item, + id-Cells-Status-Item, + id-Cells-Status-List, + id-Cells-to-be-Activated-List, + id-Cells-to-be-Activated-List-Item, + id-Cells-to-be-Deactivated-List, + id-Cells-to-be-Deactivated-List-Item, + id-ConfirmedUEID, + id-CriticalityDiagnostics, + id-C-RNTI, + id-CUtoDURRCInformation, + id-DRB-Activity-Item, + id-DRB-Activity-List, + id-DRBs-FailedToBeModified-Item, + id-DRBs-FailedToBeModified-List, + id-DRBs-FailedToBeSetup-Item, + id-DRBs-FailedToBeSetup-List, + id-DRBs-FailedToBeSetupMod-Item, + id-DRBs-FailedToBeSetupMod-List, + id-DRBs-ModifiedConf-Item, + id-DRBs-ModifiedConf-List, + id-DRBs-Modified-Item, + id-DRBs-Modified-List, + id-DRB-Notify-Item, + id-DRB-Notify-List, + id-DRBs-Required-ToBeModified-Item, + id-DRBs-Required-ToBeModified-List, + id-DRBs-Required-ToBeReleased-Item, + id-DRBs-Required-ToBeReleased-List, + id-DRBs-Setup-Item, + id-DRBs-Setup-List, + id-DRBs-SetupMod-Item, + id-DRBs-SetupMod-List, + id-DRBs-ToBeModified-Item, + id-DRBs-ToBeModified-List, + id-DRBs-ToBeReleased-Item, + id-DRBs-ToBeReleased-List, + id-DRBs-ToBeSetup-Item, + id-DRBs-ToBeSetup-List, + id-DRBs-ToBeSetupMod-Item, + id-DRBs-ToBeSetupMod-List, + id-DRXCycle, + id-DUtoCURRCInformation, + id-ExecuteDuplication, + id-FullConfiguration, + id-gNB-CU-UE-F1AP-ID, + id-gNB-DU-UE-F1AP-ID, + id-gNB-DU-ID, + id-GNB-DU-Served-Cells-Item, + id-gNB-DU-Served-Cells-List, + id-gNB-CU-Name, + id-gNB-DU-Name, + id-Extended-GNB-CU-Name, + id-Extended-GNB-DU-Name, + id-InactivityMonitoringRequest, + id-InactivityMonitoringResponse, + id-new-gNB-CU-UE-F1AP-ID, + id-new-gNB-DU-UE-F1AP-ID, + id-oldgNB-DU-UE-F1AP-ID, + id-PLMNAssistanceInfoForNetShar, + id-Potential-SpCell-Item, + id-Potential-SpCell-List, + id-RAT-FrequencyPriorityInformation, + id-RedirectedRRCmessage, + id-ResetType, + id-RequestedSRSTransmissionCharacteristics, + id-ResourceCoordinationTransferContainer, + id-RRCContainer, + id-RRCContainer-RRCSetupComplete, + id-RRCReconfigurationCompleteIndicator, + id-SCell-FailedtoSetup-List, + id-SCell-FailedtoSetup-Item, + id-SCell-FailedtoSetupMod-List, + id-SCell-FailedtoSetupMod-Item, + id-SCell-ToBeRemoved-Item, + id-SCell-ToBeRemoved-List, + id-SCell-ToBeSetup-Item, + id-SCell-ToBeSetup-List, + id-SCell-ToBeSetupMod-Item, + id-SCell-ToBeSetupMod-List, + id-SelectedPLMNID, + id-Served-Cells-To-Add-Item, + id-Served-Cells-To-Add-List, + id-Served-Cells-To-Delete-Item, + id-Served-Cells-To-Delete-List, + id-Served-Cells-To-Modify-Item, + id-Served-Cells-To-Modify-List, + id-ServCellIndex, + id-ServingCellMO, + id-SpCell-ID, + id-SpCellULConfigured, + id-SRBID, + id-SRBs-FailedToBeSetup-Item, + id-SRBs-FailedToBeSetup-List, + id-SRBs-FailedToBeSetupMod-Item, + id-SRBs-FailedToBeSetupMod-List, + id-SRBs-Required-ToBeReleased-Item, + id-SRBs-Required-ToBeReleased-List, + id-SRBs-ToBeReleased-Item, + id-SRBs-ToBeReleased-List, + id-SRBs-ToBeSetup-Item, + id-SRBs-ToBeSetup-List, + id-SRBs-ToBeSetupMod-Item, + id-SRBs-ToBeSetupMod-List, + id-SRBs-Modified-Item, + id-SRBs-Modified-List, + id-SRBs-Setup-Item, + id-SRBs-Setup-List, + id-SRBs-SetupMod-Item, + id-SRBs-SetupMod-List, + id-TimeToWait, + id-TransactionID, + id-TransmissionActionIndicator, + id-UEContextNotRetrievable, + id-UE-associatedLogicalF1-ConnectionItem, + id-UE-associatedLogicalF1-ConnectionListResAck, + id-DUtoCURRCContainer, + id-NRCGI, + id-PagingCell-Item, + id-PagingCell-List, + id-PagingDRX, + id-PagingPriority, + id-SItype-List, + id-UEIdentityIndexValue, + id-GNB-CU-TNL-Association-Setup-List, + id-GNB-CU-TNL-Association-Setup-Item, + id-GNB-CU-TNL-Association-Failed-To-Setup-List, + id-GNB-CU-TNL-Association-Failed-To-Setup-Item, + id-GNB-CU-TNL-Association-To-Add-Item, + id-GNB-CU-TNL-Association-To-Add-List, + id-GNB-CU-TNL-Association-To-Remove-Item, + id-GNB-CU-TNL-Association-To-Remove-List, + id-GNB-CU-TNL-Association-To-Update-Item, + id-GNB-CU-TNL-Association-To-Update-List, + id-MaskedIMEISV, + id-PagingIdentity, + id-Cells-to-be-Barred-List, + id-Cells-to-be-Barred-Item, + id-PWSSystemInformation, + id-RepetitionPeriod, + id-NumberofBroadcastRequest, + id-Cells-To-Be-Broadcast-List, + id-Cells-To-Be-Broadcast-Item, + id-Cells-Broadcast-Completed-List, + id-Cells-Broadcast-Completed-Item, + id-Broadcast-To-Be-Cancelled-List, + id-Broadcast-To-Be-Cancelled-Item, + id-Cells-Broadcast-Cancelled-List, + id-Cells-Broadcast-Cancelled-Item, + id-NR-CGI-List-For-Restart-List, + id-NR-CGI-List-For-Restart-Item, + id-PWS-Failed-NR-CGI-List, + id-PWS-Failed-NR-CGI-Item, + id-EUTRA-NR-CellResourceCoordinationReq-Container, + id-EUTRA-NR-CellResourceCoordinationReqAck-Container, + id-Protected-EUTRA-Resources-List, + id-RequestType, + id-ServingPLMN, + id-DRXConfigurationIndicator, + id-RLCFailureIndication, + id-UplinkTxDirectCurrentListInformation, + id-SULAccessIndication, + id-Protected-EUTRA-Resources-Item, + id-GNB-DUConfigurationQuery, + id-GNB-DU-UE-AMBR-UL, + id-GNB-CU-RRC-Version, + id-GNB-DU-RRC-Version, + id-GNBDUOverloadInformation, + id-NeedforGap, + id-RRCDeliveryStatusRequest, + id-RRCDeliveryStatus, + id-Dedicated-SIDelivery-NeededUE-List, + id-Dedicated-SIDelivery-NeededUE-Item, + id-ResourceCoordinationTransferInformation, + id-Associated-SCell-List, + id-Associated-SCell-Item, + id-IgnoreResourceCoordinationContainer, + id-UAC-Assistance-Info, + id-RANUEID, + id-PagingOrigin, + id-GNB-DU-TNL-Association-To-Remove-Item, + id-GNB-DU-TNL-Association-To-Remove-List, + id-NotificationInformation, + id-TraceActivation, + id-TraceID, + id-Neighbour-Cell-Information-List, + id-Neighbour-Cell-Information-Item, + id-SymbolAllocInSlot, + id-NumDLULSymbols, + id-AdditionalRRMPriorityIndex, + id-DUCURadioInformationType, + id-CUDURadioInformationType, + id-LowerLayerPresenceStatusChange, + id-Transport-Layer-Address-Info, + id-BHChannels-ToBeSetup-List, + id-BHChannels-ToBeSetup-Item, + id-BHChannels-Setup-List, + id-BHChannels-Setup-Item, + id-BHChannels-ToBeModified-Item, + id-BHChannels-ToBeModified-List, + id-BHChannels-ToBeReleased-Item, + id-BHChannels-ToBeReleased-List, + id-BHChannels-ToBeSetupMod-Item, + id-BHChannels-ToBeSetupMod-List, + id-BHChannels-FailedToBeSetup-Item, + id-BHChannels-FailedToBeSetup-List, + id-BHChannels-FailedToBeModified-Item, + id-BHChannels-FailedToBeModified-List, + id-BHChannels-FailedToBeSetupMod-Item, + id-BHChannels-FailedToBeSetupMod-List, + id-BHChannels-Modified-Item, + id-BHChannels-Modified-List, + id-BHChannels-SetupMod-Item, + id-BHChannels-SetupMod-List, + id-BHChannels-Required-ToBeReleased-Item, + id-BHChannels-Required-ToBeReleased-List, + id-BAPAddress, + id-ConfiguredBAPAddress, + id-BH-Routing-Information-Added-List, + id-BH-Routing-Information-Added-List-Item, + id-BH-Routing-Information-Removed-List, + id-BH-Routing-Information-Removed-List-Item, + id-UL-BH-Non-UP-Traffic-Mapping, + id-Child-Nodes-List, + id-Activated-Cells-to-be-Updated-List, + id-IABIPv6RequestType, + id-IAB-TNL-Addresses-To-Remove-List, + id-IAB-TNL-Addresses-To-Remove-Item, + id-IAB-Allocated-TNL-Address-List, + id-IAB-Allocated-TNL-Address-Item, + id-IABv4AddressesRequested, + id-TrafficMappingInformation, + id-UL-UP-TNL-Information-to-Update-List, + id-UL-UP-TNL-Information-to-Update-List-Item, + id-UL-UP-TNL-Address-to-Update-List, + id-UL-UP-TNL-Address-to-Update-List-Item, + id-DL-UP-TNL-Address-to-Update-List, + id-DL-UP-TNL-Address-to-Update-List-Item, + id-NRV2XServicesAuthorized, + id-LTEV2XServicesAuthorized, + id-NRUESidelinkAggregateMaximumBitrate, + id-LTEUESidelinkAggregateMaximumBitrate, + id-PC5LinkAMBR, + id-SLDRBs-FailedToBeModified-Item, + id-SLDRBs-FailedToBeModified-List, + id-SLDRBs-FailedToBeSetup-Item, + id-SLDRBs-FailedToBeSetup-List, + id-SLDRBs-Modified-Item, + id-SLDRBs-Modified-List, + id-SLDRBs-Required-ToBeModified-Item, + id-SLDRBs-Required-ToBeModified-List, + id-SLDRBs-Required-ToBeReleased-Item, + id-SLDRBs-Required-ToBeReleased-List, + id-SLDRBs-Setup-Item, + id-SLDRBs-Setup-List, + id-SLDRBs-ToBeModified-Item, + id-SLDRBs-ToBeModified-List, + id-SLDRBs-ToBeReleased-Item, + id-SLDRBs-ToBeReleased-List, + id-SLDRBs-ToBeSetup-Item, + id-SLDRBs-ToBeSetup-List, + id-SLDRBs-ToBeSetupMod-Item, + id-SLDRBs-ToBeSetupMod-List, + id-SLDRBs-SetupMod-List, + id-SLDRBs-FailedToBeSetupMod-List, + id-SLDRBs-SetupMod-Item, + id-SLDRBs-FailedToBeSetupMod-Item, + id-SLDRBs-ModifiedConf-List, + id-SLDRBs-ModifiedConf-Item, + id-gNBCUMeasurementID, + id-gNBDUMeasurementID, + id-RegistrationRequest, + id-ReportCharacteristics, + id-CellToReportList, + id-CellMeasurementResultList, + id-HardwareLoadIndicator, + id-ReportingPeriodicity, + id-TNLCapacityIndicator, + id-RACHReportInformationList, + id-RLFReportInformationList, + id-ReportingRequestType, + id-TimeReferenceInformation, + id-ConditionalInterDUMobilityInformation, + id-ConditionalIntraDUMobilityInformation, + id-targetCellsToCancel, + id-requestedTargetCellGlobalID, + id-TraceCollectionEntityIPAddress, + id-ManagementBasedMDTPLMNList, + id-PrivacyIndicator, + id-TraceCollectionEntityURI, + id-ServingNID, + id-PosAssistance-Information, + id-PosBroadcast, + id-PositioningBroadcastCells, + id-RoutingID, + id-PosAssistanceInformationFailureList, + id-PosMeasurementQuantities, + id-PosMeasurementResultList, + id-PosMeasurementPeriodicity, + id-PosReportCharacteristics, + id-TRPInformationTypeListTRPReq, + id-TRPInformationTypeItem, + id-TRPInformationListTRPResp, + id-TRPInformationItem, + id-LMF-MeasurementID, + id-RAN-MeasurementID, + id-SRSType, + id-ActivationTime, + id-AbortTransmission, + id-SRSConfiguration, + id-TRPList, + id-E-CID-MeasurementQuantities, + id-E-CID-MeasurementPeriodicity, + id-E-CID-MeasurementResult, + id-Cell-Portion-ID, + id-LMF-UE-MeasurementID, + id-RAN-UE-MeasurementID, + id-SFNInitialisationTime, + id-SystemFrameNumber, + id-SlotNumber, + id-TRP-MeasurementRequestList, + id-MeasurementBeamInfoRequest, + id-E-CID-ReportCharacteristics, + + maxCellingNBDU, + maxnoofCandidateSpCells, + maxnoofDRBs, + maxnoofErrors, + maxnoofIndividualF1ConnectionsToReset, + maxnoofPotentialSpCells, + maxnoofSCells, + maxnoofSRBs, + maxnoofPagingCells, + maxnoofTNLAssociations, + maxCellineNB, + maxnoofUEIDs, + maxnoofBHRLCChannels, + maxnoofRoutingEntries, + maxnoofChildIABNodes, + maxnoofServedCellsIAB, + maxnoofTLAsIAB, + maxnoofULUPTNLInformationforIAB, + maxnoofUPTNLAddresses, + maxnoofSLDRBs, + maxnoofTRPInfoTypes, + maxnoofTRPs + + + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- RESET ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Reset +-- +-- ************************************************************** + +Reset ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetIEs} }, + ... +} + +ResetIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, + ... +} + +ResetType ::= CHOICE { + f1-Interface ResetAll, + partOfF1-Interface UE-associatedLogicalF1-ConnectionListRes, + choice-extension ProtocolIE-SingleContainer { { ResetType-ExtIEs} } +} + +ResetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +ResetAll ::= ENUMERATED { + reset-all, + ... +} + +UE-associatedLogicalF1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemRes } } + +UE-associatedLogicalF1-ConnectionItemRes F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- Reset Acknowledge +-- +-- ************************************************************** + +ResetAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetAcknowledgeIEs} }, + ... +} + +ResetAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UE-associatedLogicalF1-ConnectionListResAck CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionListResAck PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +UE-associatedLogicalF1-ConnectionListResAck ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemResAck } } + +UE-associatedLogicalF1-ConnectionItemResAck F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Error Indication +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndicationIEs}}, + ... +} + +ErrorIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- F1 SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Setup Request +-- +-- ************************************************************** + +F1SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupRequestIEs} }, + ... +} + +F1SetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE mandatory }| + { ID id-gNB-DU-Name CRITICALITY ignore TYPE GNB-DU-Name PRESENCE optional }| + { ID id-gNB-DU-Served-Cells-List CRITICALITY reject TYPE GNB-DU-Served-Cells-List PRESENCE optional }| + { ID id-GNB-DU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-CU-Name CRITICALITY ignore TYPE Extended-GNB-CU-Name PRESENCE optional }, + ... +} + + +GNB-DU-Served-Cells-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { GNB-DU-Served-Cells-ItemIEs } } + +GNB-DU-Served-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-Served-Cells-Item CRITICALITY reject TYPE GNB-DU-Served-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- F1 Setup Response +-- +-- ************************************************************** + +F1SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupResponseIEs} }, + ... +} + + +F1SetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-CU-Name CRITICALITY ignore TYPE GNB-CU-Name PRESENCE optional }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-GNB-CU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-DU-Name CRITICALITY ignore TYPE Extended-GNB-DU-Name PRESENCE optional }, + ... +} + + +Cells-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Activated-List-ItemIEs } } + +Cells-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-Cells-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-to-be-Activated-List-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- F1 Setup Failure +-- +-- ************************************************************** + +F1SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupFailureIEs} }, + ... +} + +F1SetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBDUConfigurationUpdate::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateIEs} }, + ... +} + +GNBDUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Served-Cells-To-Add-List CRITICALITY reject TYPE Served-Cells-To-Add-List PRESENCE optional }| + { ID id-Served-Cells-To-Modify-List CRITICALITY reject TYPE Served-Cells-To-Modify-List PRESENCE optional }| + { ID id-Served-Cells-To-Delete-List CRITICALITY reject TYPE Served-Cells-To-Delete-List PRESENCE optional }| + { ID id-Cells-Status-List CRITICALITY reject TYPE Cells-Status-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE optional }| + { ID id-GNB-DU-TNL-Association-To-Remove-List CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Served-Cells-To-Add-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Add-ItemIEs } } +Served-Cells-To-Modify-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Modify-ItemIEs } } +Served-Cells-To-Delete-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Delete-ItemIEs } } +Cells-Status-List ::= SEQUENCE (SIZE(0.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Status-ItemIEs } } + +Dedicated-SIDelivery-NeededUE-List::= SEQUENCE (SIZE(1.. maxnoofUEIDs)) OF ProtocolIE-SingleContainer { { Dedicated-SIDelivery-NeededUE-ItemIEs } } + +GNB-DU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-DU-TNL-Association-To-Remove-ItemIEs } } + + +Served-Cells-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Add-Item CRITICALITY reject TYPE Served-Cells-To-Add-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Modify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Modify-Item CRITICALITY reject TYPE Served-Cells-To-Modify-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Delete-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Delete-Item CRITICALITY reject TYPE Served-Cells-To-Delete-Item PRESENCE mandatory }, + ... +} + +Cells-Status-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Status-Item CRITICALITY reject TYPE Cells-Status-Item PRESENCE mandatory }, + ... +} + +Dedicated-SIDelivery-NeededUE-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Dedicated-SIDelivery-NeededUE-Item CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-Item PRESENCE mandatory }, + ... +} + +GNB-DU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-TNL-Association-To-Remove-Item CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBDUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateFailureIEs} }, + ... +} + +GNBDUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBCUConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateIEs} }, + ... +} + +GNBCUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Add-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Remove-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Update-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-List PRESENCE optional }| + { ID id-Cells-to-be-Barred-List CRITICALITY ignore TYPE Cells-to-be-Barred-List PRESENCE optional }| + { ID id-Protected-EUTRA-Resources-List CRITICALITY reject TYPE Protected-EUTRA-Resources-List PRESENCE optional }| + { ID id-Neighbour-Cell-Information-List CRITICALITY ignore TYPE Neighbour-Cell-Information-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Deactivated-List-ItemIEs } } +GNB-CU-TNL-Association-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Add-ItemIEs } } +GNB-CU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Remove-ItemIEs } } +GNB-CU-TNL-Association-To-Update-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Update-ItemIEs } } +Cells-to-be-Barred-List ::= SEQUENCE(SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Barred-ItemIEs } } + + +Cells-to-be-Deactivated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Deactivated-List-Item CRITICALITY reject TYPE Cells-to-be-Deactivated-List-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Add-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Remove-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Update-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Update-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-Item PRESENCE mandatory }, + ... +} + +Cells-to-be-Barred-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Barred-Item CRITICALITY ignore TYPE Cells-to-be-Barred-Item PRESENCE mandatory }, + ... +} + +Protected-EUTRA-Resources-List ::= SEQUENCE (SIZE(1.. maxCellineNB)) OF ProtocolIE-SingleContainer { { Protected-EUTRA-Resources-ItemIEs } } +Protected-EUTRA-Resources-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Protected-EUTRA-Resources-Item CRITICALITY reject TYPE Protected-EUTRA-Resources-Item PRESENCE mandatory}, + ... +} + +Neighbour-Cell-Information-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Neighbour-Cell-Information-ItemIEs } } +Neighbour-Cell-Information-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Neighbour-Cell-Information-Item CRITICALITY ignore TYPE Neighbour-Cell-Information-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBCUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Failed-to-be-Activated-List CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Cells-Failed-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Failed-to-be-Activated-List-ItemIEs } } +GNB-CU-TNL-Association-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Setup-ItemIEs } } +GNB-CU-TNL-Association-Failed-To-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs } } + +Cells-Failed-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Failed-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateFailureIEs} }, + ... +} + +GNBCUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION REQUEST +-- +-- ************************************************************** + +GNBDUResourceCoordinationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationRequest-IEs}}, + ... +} + +GNBDUResourceCoordinationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RequestType CRITICALITY reject TYPE RequestType PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReq-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReq-Container PRESENCE mandatory}| + { ID id-IgnoreResourceCoordinationContainer CRITICALITY reject TYPE IgnoreResourceCoordinationContainer PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION RESPONSE +-- +-- ************************************************************** + +GNBDUResourceCoordinationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationResponse-IEs}}, + ... +} + +GNBDUResourceCoordinationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReqAck-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReqAck-Container PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE Context Setup ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT SETUP REQUEST +-- +-- ************************************************************** + +UEContextSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupRequestIEs} }, + ... +} + +UEContextSetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SpCell-ID CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE mandatory }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE mandatory}| + { ID id-Candidate-SpCell-List CRITICALITY ignore TYPE Candidate-SpCell-List PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-SCell-ToBeSetup-List CRITICALITY ignore TYPE SCell-ToBeSetup-List PRESENCE optional }| + { ID id-SRBs-ToBeSetup-List CRITICALITY reject TYPE SRBs-ToBeSetup-List PRESENCE optional }| + { ID id-DRBs-ToBeSetup-List CRITICALITY reject TYPE DRBs-ToBeSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-MaskedIMEISV CRITICALITY ignore TYPE MaskedIMEISV PRESENCE optional }| + { ID id-ServingPLMN CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE conditional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-BHChannels-ToBeSetup-List CRITICALITY reject TYPE BHChannels-ToBeSetup-List PRESENCE optional }| + { ID id-ConfiguredBAPAddress CRITICALITY reject TYPE BAPAddress PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetup-List CRITICALITY reject TYPE SLDRBs-ToBeSetup-List PRESENCE optional }| + { ID id-ConditionalInterDUMobilityInformation CRITICALITY reject TYPE ConditionalInterDUMobilityInformation PRESENCE optional}| + { ID id-ManagementBasedMDTPLMNList CRITICALITY ignore TYPE MDTPLMNList PRESENCE optional }| + { ID id-ServingNID CRITICALITY reject TYPE NID PRESENCE optional }, + ... +} + +Candidate-SpCell-List::= SEQUENCE (SIZE(1..maxnoofCandidateSpCells)) OF ProtocolIE-SingleContainer { { Candidate-SpCell-ItemIEs} } +SCell-ToBeSetup-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetup-ItemIEs} } +SRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetup-ItemIEs} } +DRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetup-ItemIEs} } +BHChannels-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetup-ItemIEs} } +SLDRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetup-ItemIEs} } + +Candidate-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Candidate-SpCell-Item CRITICALITY ignore TYPE Candidate-SpCell-Item PRESENCE mandatory }, + ... +} + + +SCell-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetup-Item CRITICALITY ignore TYPE SCell-ToBeSetup-Item PRESENCE mandatory }, + ... +} + +SRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetup-Item CRITICALITY reject TYPE SRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetup-Item CRITICALITY reject TYPE DRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetup-Item CRITICALITY reject TYPE BHChannels-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetup-Item CRITICALITY reject TYPE SLDRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP RESPONSE +-- +-- ************************************************************** + +UEContextSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupResponseIEs} }, + ... +} + + +UEContextSetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-DRBs-Setup-List CRITICALITY ignore TYPE DRBs-Setup-List PRESENCE optional }| + { ID id-SRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetup-List CRITICALITY ignore TYPE DRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-SCell-FailedtoSetup-List CRITICALITY ignore TYPE SCell-FailedtoSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-SRBs-Setup-List CRITICALITY ignore TYPE SRBs-Setup-List PRESENCE optional }| + { ID id-BHChannels-Setup-List CRITICALITY ignore TYPE BHChannels-Setup-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeSetup-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-List PRESENCE optional }| + { ID id-SLDRBs-Setup-List CRITICALITY ignore TYPE SLDRBs-Setup-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +DRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Setup-ItemIEs} } + + +SRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetup-ItemIEs} } +DRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetup-ItemIEs} } +SCell-FailedtoSetup-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetup-ItemIEs} } +SRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Setup-ItemIEs} } +BHChannels-Setup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Setup-ItemIEs} } +BHChannels-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetup-ItemIEs} } + +DRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Setup-Item CRITICALITY ignore TYPE DRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Setup-Item CRITICALITY ignore TYPE SRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetup-Item CRITICALITY ignore TYPE SCell-FailedtoSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Setup-Item CRITICALITY ignore TYPE BHChannels-Setup-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetup-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Setup-ItemIEs} } + +SLDRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetup-ItemIEs} } + +SLDRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Setup-Item CRITICALITY ignore TYPE SLDRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP FAILURE +-- +-- ************************************************************** + +UEContextSetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupFailureIEs} }, + ... +} + +UEContextSetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Potential-SpCell-List CRITICALITY ignore TYPE Potential-SpCell-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +Potential-SpCell-List::= SEQUENCE (SIZE(0..maxnoofPotentialSpCells)) OF ProtocolIE-SingleContainer { { Potential-SpCell-ItemIEs} } + +Potential-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Potential-SpCell-Item CRITICALITY ignore TYPE Potential-SpCell-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Request ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Release Request +-- +-- ************************************************************** + +UEContextReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEContextReleaseRequestIEs}}, + ... +} + +UEContextReleaseRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Release (gNB-CU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMMAND +-- +-- ************************************************************** + +UEContextReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCommandIEs} }, + ... +} + +UEContextReleaseCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE conditional }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMPLETE +-- +-- ************************************************************** + +UEContextReleaseComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCompleteIEs} }, + ... +} + + +UEContextReleaseCompleteIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE Context Modification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUEST +-- +-- ************************************************************** + +UEContextModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequestIEs} }, + ... +} + +UEContextModificationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SpCell-ID CRITICALITY ignore TYPE NRCGI PRESENCE optional }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE optional }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE optional }| + { ID id-TransmissionActionIndicator CRITICALITY ignore TYPE TransmissionActionIndicator PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-RRCReconfigurationCompleteIndicator CRITICALITY ignore TYPE RRCReconfigurationCompleteIndicator PRESENCE optional }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE optional }| + { ID id-SCell-ToBeSetupMod-List CRITICALITY ignore TYPE SCell-ToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-ToBeRemoved-List CRITICALITY ignore TYPE SCell-ToBeRemoved-List PRESENCE optional }| + { ID id-SRBs-ToBeSetupMod-List CRITICALITY reject TYPE SRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeSetupMod-List CRITICALITY reject TYPE DRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeModified-List CRITICALITY reject TYPE DRBs-ToBeModified-List PRESENCE optional }| + { ID id-SRBs-ToBeReleased-List CRITICALITY reject TYPE SRBs-ToBeReleased-List PRESENCE optional }| + { ID id-DRBs-ToBeReleased-List CRITICALITY reject TYPE DRBs-ToBeReleased-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-DRXConfigurationIndicator CRITICALITY ignore TYPE DRXConfigurationIndicator PRESENCE optional }| + { ID id-RLCFailureIndication CRITICALITY ignore TYPE RLCFailureIndication PRESENCE optional }| + { ID id-UplinkTxDirectCurrentListInformation CRITICALITY ignore TYPE UplinkTxDirectCurrentListInformation PRESENCE optional }| + { ID id-GNB-DUConfigurationQuery CRITICALITY reject TYPE GNB-DUConfigurationQuery PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-NeedforGap CRITICALITY ignore TYPE NeedforGap PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-LowerLayerPresenceStatusChange CRITICALITY ignore TYPE LowerLayerPresenceStatusChange PRESENCE optional }| + { ID id-BHChannels-ToBeSetupMod-List CRITICALITY reject TYPE BHChannels-ToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-ToBeModified-List CRITICALITY reject TYPE BHChannels-ToBeModified-List PRESENCE optional }| + { ID id-BHChannels-ToBeReleased-List CRITICALITY reject TYPE BHChannels-ToBeReleased-List PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetupMod-List CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-ToBeModified-List CRITICALITY reject TYPE SLDRBs-ToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-ToBeReleased-List PRESENCE optional }| + { ID id-ConditionalIntraDUMobilityInformation CRITICALITY reject TYPE ConditionalIntraDUMobilityInformation PRESENCE optional}, + ... +} + +SCell-ToBeSetupMod-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetupMod-ItemIEs} } +SCell-ToBeRemoved-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeRemoved-ItemIEs} } +SRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetupMod-ItemIEs} } +DRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetupMod-ItemIEs} } +BHChannels-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetupMod-ItemIEs} } + +DRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeModified-ItemIEs} } +BHChannels-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeModified-ItemIEs} } +SRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeReleased-ItemIEs} } +DRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeReleased-ItemIEs} } +BHChannels-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeReleased-ItemIEs} } + +SCell-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetupMod-Item CRITICALITY ignore TYPE SCell-ToBeSetupMod-Item PRESENCE mandatory }, + ... +} + +SCell-ToBeRemoved-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeRemoved-Item CRITICALITY ignore TYPE SCell-ToBeRemoved-Item PRESENCE mandatory }, + ... +} + + +SRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetupMod-Item CRITICALITY reject TYPE DRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeModified-Item CRITICALITY reject TYPE DRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + + +SRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeReleased-Item CRITICALITY reject TYPE SRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeReleased-Item CRITICALITY reject TYPE DRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetupMod-Item CRITICALITY reject TYPE BHChannels-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeModified-Item CRITICALITY reject TYPE BHChannels-ToBeModified-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetupMod-ItemIEs} } +SLDRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeModified-ItemIEs} } +SLDRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeReleased-ItemIEs} } + +SLDRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION RESPONSE +-- +-- ************************************************************** + +UEContextModificationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationResponseIEs} }, + ... +} + + +UEContextModificationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-SetupMod-List CRITICALITY ignore TYPE DRBs-SetupMod-List PRESENCE optional}| + { ID id-DRBs-Modified-List CRITICALITY ignore TYPE DRBs-Modified-List PRESENCE optional}| + { ID id-SRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-FailedtoSetupMod-List CRITICALITY ignore TYPE SCell-FailedtoSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeModified-List CRITICALITY ignore TYPE DRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-Associated-SCell-List CRITICALITY ignore TYPE Associated-SCell-List PRESENCE optional }| + { ID id-SRBs-SetupMod-List CRITICALITY ignore TYPE SRBs-SetupMod-List PRESENCE optional }| + { ID id-SRBs-Modified-List CRITICALITY ignore TYPE SRBs-Modified-List PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-BHChannels-SetupMod-List CRITICALITY ignore TYPE BHChannels-SetupMod-List PRESENCE optional}| + { ID id-BHChannels-Modified-List CRITICALITY ignore TYPE BHChannels-Modified-List PRESENCE optional}| + { ID id-BHChannels-FailedToBeSetupMod-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeModified-List CRITICALITY ignore TYPE BHChannels-FailedToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-SetupMod-List CRITICALITY ignore TYPE SLDRBs-SetupMod-List PRESENCE optional }| + { ID id-SLDRBs-Modified-List CRITICALITY ignore TYPE SLDRBs-Modified-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeModified-List CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +DRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-SetupMod-ItemIEs} } +DRBs-Modified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Modified-ItemIEs } } +SRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-SetupMod-ItemIEs} } +SRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Modified-ItemIEs } } +DRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeModified-ItemIEs} } +SRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetupMod-ItemIEs} } +DRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetupMod-ItemIEs} } +SCell-FailedtoSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetupMod-ItemIEs} } +BHChannels-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-SetupMod-ItemIEs} } +BHChannels-Modified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Modified-ItemIEs } } +BHChannels-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeModified-ItemIEs} } +BHChannels-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetupMod-ItemIEs} } + +Associated-SCell-List ::= SEQUENCE (SIZE(1.. maxnoofSCells)) OF ProtocolIE-SingleContainer { { Associated-SCell-ItemIEs} } + +DRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-SetupMod-Item CRITICALITY ignore TYPE DRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Modified-Item CRITICALITY ignore TYPE DRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-SetupMod-Item CRITICALITY ignore TYPE SRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +SRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Modified-Item CRITICALITY ignore TYPE SRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeModified-Item CRITICALITY ignore TYPE DRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetupMod-Item CRITICALITY ignore TYPE SCell-FailedtoSetupMod-Item PRESENCE mandatory}, + ... +} + +Associated-SCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Associated-SCell-Item CRITICALITY ignore TYPE Associated-SCell-Item PRESENCE mandatory}, + ... +} + +BHChannels-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-SetupMod-Item CRITICALITY ignore TYPE BHChannels-SetupMod-Item PRESENCE mandatory}, + ... +} + + +BHChannels-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Modified-Item CRITICALITY ignore TYPE BHChannels-Modified-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetupMod-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeModified-Item CRITICALITY ignore TYPE BHChannels-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-SetupMod-ItemIEs} } +SLDRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Modified-ItemIEs } } +SLDRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeModified-ItemIEs} } +SLDRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetupMod-ItemIEs} } + +SLDRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-SetupMod-Item CRITICALITY ignore TYPE SLDRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Modified-Item CRITICALITY ignore TYPE SLDRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeModified-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION FAILURE +-- +-- ************************************************************** + +UEContextModificationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationFailureIEs} }, + ... +} + +UEContextModificationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- UE Context Modification Required (gNB-DU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUIRED +-- +-- ************************************************************** + +UEContextModificationRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequiredIEs} }, + ... +} + +UEContextModificationRequiredIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-Required-ToBeModified-List CRITICALITY reject TYPE DRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-DRBs-Required-ToBeReleased-List CRITICALITY reject TYPE DRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-BHChannels-Required-ToBeReleased-List CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeModified-List CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +DRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeModified-ItemIEs } } +DRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeReleased-ItemIEs } } + +SRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Required-ToBeReleased-ItemIEs } } + +BHChannels-Required-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Required-ToBeReleased-ItemIEs } } + +DRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeModified-Item CRITICALITY reject TYPE DRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +DRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE DRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Required-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeModified-ItemIEs } } +SLDRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeReleased-ItemIEs } } + +SLDRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION CONFIRM +-- +-- ************************************************************** + +UEContextModificationConfirm::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationConfirmIEs} }, + ... +} + + +UEContextModificationConfirmIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DRBs-ModifiedConf-List CRITICALITY ignore TYPE DRBs-ModifiedConf-List PRESENCE optional}| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-SLDRBs-ModifiedConf-List CRITICALITY ignore TYPE SLDRBs-ModifiedConf-List PRESENCE optional}, + ... +} + +DRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ModifiedConf-ItemIEs } } + +DRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ModifiedConf-Item CRITICALITY ignore TYPE DRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ModifiedConf-ItemIEs } } + +SLDRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ModifiedConf-Item CRITICALITY ignore TYPE SLDRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REFUSE +-- +-- ************************************************************** + +UEContextModificationRefuse::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRefuseIEs} }, + ... +} + + +UEContextModificationRefuseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- WRITE-REPLACE WARNING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Write-Replace Warning Request +-- +-- ************************************************************** + +WriteReplaceWarningRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningRequestIEs} }, + ... +} + +WriteReplaceWarningRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWSSystemInformation CRITICALITY reject TYPE PWSSystemInformation PRESENCE mandatory }| + { ID id-RepetitionPeriod CRITICALITY reject TYPE RepetitionPeriod PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Cells-To-Be-Broadcast-List CRITICALITY reject TYPE Cells-To-Be-Broadcast-List PRESENCE optional }, + ... +} + +Cells-To-Be-Broadcast-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-To-Be-Broadcast-List-ItemIEs } } + +Cells-To-Be-Broadcast-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-To-Be-Broadcast-Item CRITICALITY reject TYPE Cells-To-Be-Broadcast-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Write-Replace Warning Response +-- +-- ************************************************************** + +WriteReplaceWarningResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningResponseIEs} }, + ... +} + +WriteReplaceWarningResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Completed-List CRITICALITY reject TYPE Cells-Broadcast-Completed-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }, + ... +} + +Cells-Broadcast-Completed-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Completed-List-ItemIEs } } + +Cells-Broadcast-Completed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Completed-Item CRITICALITY reject TYPE Cells-Broadcast-Completed-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- PWS CANCEL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Cancel Request +-- +-- ************************************************************** + +PWSCancelRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelRequestIEs} }, + ... +} + +PWSCancelRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Broadcast-To-Be-Cancelled-List CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-List PRESENCE optional }| + { ID id-Cancel-all-Warning-Messages-Indicator CRITICALITY reject TYPE Cancel-all-Warning-Messages-Indicator PRESENCE optional }| + { ID id-NotificationInformation CRITICALITY reject TYPE NotificationInformation PRESENCE optional}, + ... +} + +Broadcast-To-Be-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Broadcast-To-Be-Cancelled-List-ItemIEs } } + +Broadcast-To-Be-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Broadcast-To-Be-Cancelled-Item CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS Cancel Response +-- +-- ************************************************************** + +PWSCancelResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelResponseIEs} }, + ... +} + +PWSCancelResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Cancelled-List CRITICALITY reject TYPE Cells-Broadcast-Cancelled-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +Cells-Broadcast-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Cancelled-List-ItemIEs } } + +Cells-Broadcast-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Cancelled-Item CRITICALITY reject TYPE Cells-Broadcast-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Inactivity Notification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Inactivity Notification +-- +-- ************************************************************** + +UEInactivityNotification ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEInactivityNotificationIEs}}, + ... +} + +UEInactivityNotificationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Activity-List CRITICALITY reject TYPE DRB-Activity-List PRESENCE mandatory } , + ... +} + +DRB-Activity-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Activity-ItemIEs } } + +DRB-Activity-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Activity-Item CRITICALITY reject TYPE DRB-Activity-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- Initial UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- INITIAL UL RRC Message Transfer +-- +-- ************************************************************** + +InitialULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ InitialULRRCMessageTransferIEs}}, + ... +} + +InitialULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY reject TYPE C-RNTI PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-DUtoCURRCContainer CRITICALITY reject TYPE DUtoCURRCContainer PRESENCE optional }| + { ID id-SULAccessIndication CRITICALITY ignore TYPE SULAccessIndication PRESENCE optional }| + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-RRCContainer-RRCSetupComplete CRITICALITY ignore TYPE RRCContainer-RRCSetupComplete PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- DL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DL RRC Message Transfer +-- +-- ************************************************************** + +DLRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DLRRCMessageTransferIEs}}, + ... +} + +DLRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-UEContextNotRetrievable CRITICALITY reject TYPE UEContextNotRetrievable PRESENCE optional }| + { ID id-RedirectedRRCmessage CRITICALITY reject TYPE OCTET STRING PRESENCE optional }| + { ID id-PLMNAssistanceInfoForNetShar CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UL RRC Message Transfer +-- +-- ************************************************************** + +ULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ULRRCMessageTransferIEs}}, + ... +} + +ULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-SelectedPLMNID CRITICALITY reject TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- PRIVATE MESSAGE +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessage-IEs}}, + ... +} + +PrivateMessage-IEs F1AP-PRIVATE-IES ::= { + ... +} + + +-- ************************************************************** +-- +-- System Information ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- System information Delivery Command +-- +-- ************************************************************** + +SystemInformationDeliveryCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ SystemInformationDeliveryCommandIEs}}, + ... +} + +SystemInformationDeliveryCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-SItype-List CRITICALITY reject TYPE SItype-List PRESENCE mandatory }| + { ID id-ConfirmedUEID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Paging PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Paging +-- +-- ************************************************************** + +Paging ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PagingIEs}}, + ... +} + +PagingIEs F1AP-PROTOCOL-IES ::= { + { ID id-UEIdentityIndexValue CRITICALITY reject TYPE UEIdentityIndexValue PRESENCE mandatory }| + { ID id-PagingIdentity CRITICALITY reject TYPE PagingIdentity PRESENCE mandatory }| + { ID id-PagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE optional }| + { ID id-PagingPriority CRITICALITY ignore TYPE PagingPriority PRESENCE optional }| + { ID id-PagingCell-List CRITICALITY ignore TYPE PagingCell-list PRESENCE mandatory }| + { ID id-PagingOrigin CRITICALITY ignore TYPE PagingOrigin PRESENCE optional }, + ... +} + +PagingCell-list::= SEQUENCE (SIZE(1.. maxnoofPagingCells)) OF ProtocolIE-SingleContainer { { PagingCell-ItemIEs } } + +PagingCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PagingCell-Item CRITICALITY ignore TYPE PagingCell-Item PRESENCE mandatory} , + ... +} + + + +-- ************************************************************** +-- +-- Notify +-- +-- ************************************************************** + +Notify ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NotifyIEs}}, + ... +} + +NotifyIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Notify-List CRITICALITY reject TYPE DRB-Notify-List PRESENCE mandatory }, + ... +} + +DRB-Notify-List::= SEQUENCE (SIZE(1.. maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Notify-ItemIEs } } + +DRB-Notify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Notify-Item CRITICALITY reject TYPE DRB-Notify-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- NETWORK ACCESS RATE REDUCTION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Network Access Rate Reduction +-- +-- ************************************************************** + +NetworkAccessRateReduction ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NetworkAccessRateReductionIEs }}, + ... +} + +NetworkAccessRateReductionIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UAC-Assistance-Info CRITICALITY reject TYPE UAC-Assistance-Info PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS RESTART INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Restart Indication +-- +-- ************************************************************** + +PWSRestartIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSRestartIndicationIEs} }, + ... +} + +PWSRestartIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NR-CGI-List-For-Restart-List CRITICALITY reject TYPE NR-CGI-List-For-Restart-List PRESENCE mandatory }, + ... +} + +NR-CGI-List-For-Restart-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { NR-CGI-List-For-Restart-List-ItemIEs } } + +NR-CGI-List-For-Restart-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-NR-CGI-List-For-Restart-Item CRITICALITY reject TYPE NR-CGI-List-For-Restart-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Failure Indication +-- +-- ************************************************************** + +PWSFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSFailureIndicationIEs} }, + ... +} + +PWSFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWS-Failed-NR-CGI-List CRITICALITY reject TYPE PWS-Failed-NR-CGI-List PRESENCE optional }, + ... +} + +PWS-Failed-NR-CGI-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { PWS-Failed-NR-CGI-List-ItemIEs } } + +PWS-Failed-NR-CGI-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PWS-Failed-NR-CGI-Item CRITICALITY reject TYPE PWS-Failed-NR-CGI-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- gNB-DU STATUS INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- gNB-DU Status Indication +-- +-- ************************************************************** + +GNBDUStatusIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUStatusIndicationIEs} }, + ... +} + +GNBDUStatusIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-GNBDUOverloadInformation CRITICALITY reject TYPE GNBDUOverloadInformation PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- RRC Delivery Report ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- RRC Delivery Report +-- +-- ************************************************************** + +RRCDeliveryReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ RRCDeliveryReportIEs}}, + ... +} + +RRCDeliveryReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RRCDeliveryStatus CRITICALITY ignore TYPE RRCDeliveryStatus PRESENCE mandatory }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Removal Request +-- +-- ************************************************************** + +F1RemovalRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalRequestIEs }}, + ... +} + +F1RemovalRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal Response +-- +-- ************************************************************** + +F1RemovalResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalResponseIEs }}, + ... +} + +F1RemovalResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + +-- ************************************************************** +-- +-- F1 Removal Failure +-- +-- ************************************************************** + +F1RemovalFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalFailureIEs }}, + ... +} + +F1RemovalFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + + +-- ************************************************************** +-- +-- TRACE ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRACE START +-- +-- ************************************************************** + +TraceStart ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {TraceStartIEs} }, + ... +} + +TraceStartIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- DEACTIVATE TRACE +-- +-- ************************************************************** + +DeactivateTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {DeactivateTraceIEs} }, + ... +} + +DeactivateTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- CELL TRAFFIC TRACE +-- +-- ************************************************************** + +CellTrafficTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {CellTrafficTraceIEs} }, + ... +} + +CellTrafficTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + {ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }| + {ID id-TraceCollectionEntityIPAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE mandatory }| + {ID id-PrivacyIndicator CRITICALITY ignore TYPE PrivacyIndicator PRESENCE optional }| + + {ID id-TraceCollectionEntityURI CRITICALITY ignore TYPE URI-address PRESENCE optional }, + ... + +} + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer +-- +-- ************************************************************** + +DUCURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DUCURadioInformationTransferIEs}}, + ... +} + +DUCURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-DUCURadioInformationType CRITICALITY ignore TYPE DUCURadioInformationType PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer +-- +-- ************************************************************** + +CUDURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ CUDURadioInformationTransferIEs}}, + ... +} + +CUDURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CUDURadioInformationType CRITICALITY ignore TYPE CUDURadioInformationType PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- IAB PROCEDURES +-- +-- ************************************************************** +-- ************************************************************** +-- +-- BAP Mapping Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION +-- ************************************************************** + + +BAPMappingConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfiguration-IEs} }, + ... + } + +BAPMappingConfiguration-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-BH-Routing-Information-Added-List CRITICALITY ignore TYPE BH-Routing-Information-Added-List PRESENCE optional}| + { ID id-BH-Routing-Information-Removed-List CRITICALITY ignore TYPE BH-Routing-Information-Removed-List PRESENCE optional}| + { ID id-TrafficMappingInformation CRITICALITY ignore TYPE TrafficMappingInfo PRESENCE optional}, + ... +} + +BH-Routing-Information-Added-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Added-List-ItemIEs } } +BH-Routing-Information-Removed-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Removed-List-ItemIEs } } + +BH-Routing-Information-Added-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Added-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Added-List-Item PRESENCE optional}, + ... +} + +BH-Routing-Information-Removed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Removed-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Removed-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + +BAPMappingConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfigurationAcknowledge-IEs} }, + ... +} + +BAPMappingConfigurationAcknowledge-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- GNB-DU Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION +-- ************************************************************** + + +GNBDUResourceConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ GNBDUResourceConfigurationIEs}}, + ... +} + + +GNBDUResourceConfigurationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Activated-Cells-to-be-Updated-List CRITICALITY reject TYPE Activated-Cells-to-be-Updated-List PRESENCE optional}| + { ID id-Child-Nodes-List CRITICALITY reject TYPE Child-Nodes-List PRESENCE optional}, + ... +} + + + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + + +GNBDUResourceConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBDUResourceConfigurationAcknowledgeIEs} }, + ... +} + + +GNBDUResourceConfigurationAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- IAB TNL Address Allocation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB TNL ADDRESS REQUEST +-- ************************************************************** + + + +IABTNLAddressRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressRequestIEs} }, + ... +} + +IABTNLAddressRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IABv4AddressesRequested CRITICALITY reject TYPE IABv4AddressesRequested PRESENCE optional }| + { ID id-IABIPv6RequestType CRITICALITY reject TYPE IABIPv6RequestType PRESENCE optional }| + { ID id-IAB-TNL-Addresses-To-Remove-List CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-List PRESENCE optional }, + ... +} + + +IAB-TNL-Addresses-To-Remove-List ::= SEQUENCE (SIZE(1..maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-TNL-Addresses-To-Remove-ItemIEs } } + +IAB-TNL-Addresses-To-Remove-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-TNL-Addresses-To-Remove-Item CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- IAB TNL ADDRESS RESPONSE +-- ************************************************************** + + +IABTNLAddressResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressResponseIEs} }, + ... +} + + +IABTNLAddressResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IAB-Allocated-TNL-Address-List CRITICALITY reject TYPE IAB-Allocated-TNL-Address-List PRESENCE mandatory }, + ... +} + + +IAB-Allocated-TNL-Address-List ::= SEQUENCE (SIZE(1.. maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-Allocated-TNL-Address-List-ItemIEs } } + + +IAB-Allocated-TNL-Address-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-Allocated-TNL-Address-Item CRITICALITY reject TYPE IAB-Allocated-TNL-Address-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB UP Configuration Update Request +-- +-- ************************************************************** + +IABUPConfigurationUpdateRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateRequestIEs} }, + ... +} + +IABUPConfigurationUpdateRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UL-UP-TNL-Information-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List PRESENCE optional }| + { ID id-UL-UP-TNL-Address-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +UL-UP-TNL-Information-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofULUPTNLInformationforIAB)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Information-to-Update-List-ItemIEs } } + +UL-UP-TNL-Information-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Information-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List-Item PRESENCE optional}, + ... +} + +UL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Address-to-Update-List-ItemIEs } } + +UL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- IAB UP Configuration Update Response +-- +-- ************************************************************** + +IABUPConfigurationUpdateResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateResponseIEs} }, + ... +} + +IABUPConfigurationUpdateResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-DL-UP-TNL-Address-to-Update-List CRITICALITY reject TYPE DL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +DL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { DL-UP-TNL-Address-to-Update-List-ItemIEs } } + +DL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE DL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update Failure +-- +-- ************************************************************** + +IABUPConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateFailureIEs} }, + ... +} + +IABUPConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting Initiation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Request +-- +-- ************************************************************** + +ResourceStatusRequest::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResourceStatusRequestIEs} }, + ... +} + +ResourceStatusRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE conditional }| + { ID id-RegistrationRequest CRITICALITY ignore TYPE RegistrationRequest PRESENCE mandatory }| + { ID id-ReportCharacteristics CRITICALITY ignore TYPE ReportCharacteristics PRESENCE conditional }| + { ID id-CellToReportList CRITICALITY ignore TYPE CellToReportList PRESENCE optional }| + { ID id-ReportingPeriodicity CRITICALITY ignore TYPE ReportingPeriodicity PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Response +-- +-- ************************************************************** + +ResourceStatusResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusResponseIEs} }, + ... +} + + +ResourceStatusResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Failure +-- +-- ************************************************************** + +ResourceStatusFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusFailureIEs} }, + ... +} + +ResourceStatusFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Update +-- +-- ************************************************************** + +ResourceStatusUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ResourceStatusUpdateIEs}}, + ... +} + +ResourceStatusUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-HardwareLoadIndicator CRITICALITY ignore TYPE HardwareLoadIndicator PRESENCE optional }| + { ID id-TNLCapacityIndicator CRITICALITY ignore TYPE TNLCapacityIndicator PRESENCE optional }| + { ID id-CellMeasurementResultList CRITICALITY ignore TYPE CellMeasurementResultList PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Access And Mobility Indication ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Access And Mobility Indication +-- +-- ************************************************************** + +AccessAndMobilityIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { AccessAndMobilityIndicationIEs} }, + ... +} + +AccessAndMobilityIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RACHReportInformationList CRITICALITY ignore TYPE RACHReportInformationList PRESENCE optional }| + { ID id-RLFReportInformationList CRITICALITY ignore TYPE RLFReportInformationList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORTING CONTROL +-- +-- ************************************************************** + +ReferenceTimeInformationReportingControl::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportingControlIEs} }, + ... +} + +ReferenceTimeInformationReportingControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-ReportingRequestType CRITICALITY reject TYPE ReportingRequestType PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORT +-- +-- ************************************************************** + +ReferenceTimeInformationReport::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportIEs} }, + ... +} + +ReferenceTimeInformationReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-TimeReferenceInformation CRITICALITY ignore TYPE TimeReferenceInformation PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Access Success +-- +-- ************************************************************** + +AccessSuccess ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ AccessSuccessIEs}}, + ... +} + +AccessSuccessIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION CONTROL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Control +-- +-- ************************************************************** + +PositioningAssistanceInformationControl ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationControlIEs}}, + ... +} + +PositioningAssistanceInformationControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistance-Information CRITICALITY reject TYPE PosAssistance-Information PRESENCE optional}| + { ID id-PosBroadcast CRITICALITY reject TYPE PosBroadcast PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION FEEDBACK ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Feedback +-- +-- ************************************************************** + +PositioningAssistanceInformationFeedback ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationFeedbackIEs}}, + ... +} + +PositioningAssistanceInformationFeedbackIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistanceInformationFailureList CRITICALITY reject TYPE PosAssistanceInformationFailureList PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITONING MEASUREMENT EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Request +-- +-- ************************************************************** + +PositioningMeasurementRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementRequestIEs} }, + ... +} + +PositioningMeasurementRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-TRP-MeasurementRequestList CRITICALITY reject TYPE TRP-MeasurementRequestList PRESENCE mandatory}| + { ID id-PosReportCharacteristics CRITICALITY reject TYPE PosReportCharacteristics PRESENCE mandatory}| + { ID id-PosMeasurementPeriodicity CRITICALITY reject TYPE PosMeasurementPeriodicity PRESENCE conditional }| + -- The above IE shall be present if the PosReportCharacteristics IE is set to “periodic” -- + { ID id-PosMeasurementQuantities CRITICALITY reject TYPE PosMeasurementQuantities PRESENCE mandatory}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-MeasurementBeamInfoRequest CRITICALITY ignore TYPE MeasurementBeamInfoRequest PRESENCE optional }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional}| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Response +-- +-- ************************************************************** + +PositioningMeasurementResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementResponseIEs} }, + ... +} + + +PositioningMeasurementResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Failure +-- +-- ************************************************************** + +PositioningMeasurementFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIEs} }, + ... +} + +PositioningMeasurementFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT REPORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Report +-- +-- ************************************************************** + +PositioningMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementReportIEs} }, + ... +} + +PositioningMeasurementReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT ABORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Abort +-- +-- ************************************************************** + +PositioningMeasurementAbort ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementAbortIEs} }, + ... +} + +PositioningMeasurementAbortIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Failure Indication +-- +-- ************************************************************** + +PositioningMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIndicationIEs} }, + ... +} + +PositioningMeasurementFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Update +-- +-- ************************************************************** + +PositioningMeasurementUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementUpdateIEs} }, + ... +} + +PositioningMeasurementUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- TRP INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRP Information Request +-- +-- ************************************************************** + +TRPInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationRequestIEs} }, + ... +} + +TRPInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPList CRITICALITY ignore TYPE TRPList PRESENCE optional }| + { ID id-TRPInformationTypeListTRPReq CRITICALITY reject TYPE TRPInformationTypeListTRPReq PRESENCE mandatory }, + ... +} + +TRPInformationTypeListTRPReq ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF ProtocolIE-SingleContainer { { TRPInformationTypeItemTRPReq } } + +TRPInformationTypeItemTRPReq F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationTypeItem CRITICALITY reject TYPE TRPInformationTypeItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Response +-- +-- ************************************************************** + +TRPInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationResponseIEs} }, + ... +} + +TRPInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPInformationListTRPResp CRITICALITY ignore TYPE TRPInformationListTRPResp PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +TRPInformationListTRPResp ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF ProtocolIE-SingleContainer { { TRPInformationItemTRPResp } } + +TRPInformationItemTRPResp F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationItem CRITICALITY ignore TYPE TRPInformationItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Failure +-- +-- ************************************************************** + +TRPInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationFailureIEs} }, + ... +} + +TRPInformationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Request +-- +-- ************************************************************** + +PositioningInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationRequestIEs} }, + ... +} + +PositioningInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RequestedSRSTransmissionCharacteristics CRITICALITY ignore TYPE RequestedSRSTransmissionCharacteristics PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Response +-- +-- ************************************************************** + +PositioningInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationResponseIEs} }, + ... +} + + +PositioningInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Failure +-- +-- ************************************************************** + +PositioningInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationFailureIEs} }, + ... +} + +PositioningInformationFailureIEs F1AP-PROTOCOL-IES ::= { + + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Activation Request +-- +-- ************************************************************** + +PositioningActivationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationRequestIEs} }, + ... +} + +PositioningActivationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSType CRITICALITY reject TYPE SRSType PRESENCE mandatory }| + { ID id-ActivationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }, + ... +} + +SRSType ::= CHOICE { + semipersistentSRS SemipersistentSRS, + aperiodicSRS AperiodicSRS, + choice-extension ProtocolIE-SingleContainer { { SRSType-ExtIEs} } +} + +SRSType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SemipersistentSRS ::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSSpatialRelation SRSSpatialRelation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SemipersistentSRS-ExtIEs} } OPTIONAL, + ... +} + +SemipersistentSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AperiodicSRS ::= SEQUENCE { + aperiodic ENUMERATED {true, ...}, + sRSResourceTrigger SRSResourceTrigger OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AperiodicSRS-ExtIEs} } OPTIONAL, + ... +} + +AperiodicSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- Positioning Activation Response +-- +-- ************************************************************** + +PositioningActivationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationResponseIEs} }, + ... +} + + +PositioningActivationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional }| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + + + +-- ************************************************************** +-- +-- Positioning Activation Failure +-- +-- ************************************************************** + +PositioningActivationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationFailureIEs} }, + ... +} + +PositioningActivationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING DEACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Deactivation +-- +-- ************************************************************** + +PositioningDeactivation ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningDeactivationIEs} }, + ... +} + +PositioningDeactivationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-AbortTransmission CRITICALITY ignore TYPE AbortTransmission PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING INFORMATION UPDATE PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Update +-- +-- ************************************************************** + +PositioningInformationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationUpdateIEs} }, + ... +} + + +PositioningInformationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Request +-- +-- ************************************************************** + +E-CIDMeasurementInitiationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationRequest-IEs}}, + ... +} + +E-CIDMeasurementInitiationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-ReportCharacteristics CRITICALITY reject TYPE E-CID-ReportCharacteristics PRESENCE mandatory }| + { ID id-E-CID-MeasurementPeriodicity CRITICALITY reject TYPE E-CID-MeasurementPeriodicity PRESENCE conditional }| +-- The above IE shall be present if the E-CID-ReportCharacteristics IE is set to “periodic” –- + { ID id-E-CID-MeasurementQuantities CRITICALITY reject TYPE E-CID-MeasurementQuantities PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Response +-- +-- ************************************************************** + +E-CIDMeasurementInitiationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationResponse-IEs}}, + ... +} + +E-CIDMeasurementInitiationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE optional}| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Failure +-- +-- ************************************************************** + +E-CIDMeasurementInitiationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationFailure-IEs}}, + ... +} + + +E-CIDMeasurementInitiationFailure-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT FAILURE INDICATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Failure Indication +-- +-- ************************************************************** + +E-CIDMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementFailureIndication-IEs}}, + ... +} + + +E-CIDMeasurementFailureIndication-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT REPORT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Report +-- +-- ************************************************************** + +E-CIDMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementReport-IEs}}, + ... +} + + +E-CIDMeasurementReport-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE mandatory }| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}, + + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT TERMINATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Termination Command +-- +-- ************************************************************** + + +E-CIDMeasurementTerminationCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementTerminationCommand-IEs}}, + ... +} + + +E-CIDMeasurementTerminationCommand-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }, + ... +} + + + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Descriptions.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Descriptions.asn new file mode 100644 index 0000000000000000000000000000000000000000..6ec795ab10078f7c86a976e35a6b93f62af01fe6 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Descriptions.asn @@ -0,0 +1,723 @@ +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +F1AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Descriptions (0)} + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode + +FROM F1AP-CommonDataTypes + Reset, + ResetAcknowledge, + F1SetupRequest, + F1SetupResponse, + F1SetupFailure, + GNBDUConfigurationUpdate, + GNBDUConfigurationUpdateAcknowledge, + GNBDUConfigurationUpdateFailure, + GNBCUConfigurationUpdate, + GNBCUConfigurationUpdateAcknowledge, + GNBCUConfigurationUpdateFailure, + UEContextSetupRequest, + UEContextSetupResponse, + UEContextSetupFailure, + UEContextReleaseCommand, + UEContextReleaseComplete, + UEContextModificationRequest, + UEContextModificationResponse, + UEContextModificationFailure, + UEContextModificationRequired, + UEContextModificationConfirm, + ErrorIndication, + UEContextReleaseRequest, + DLRRCMessageTransfer, + ULRRCMessageTransfer, + GNBDUResourceCoordinationRequest, + GNBDUResourceCoordinationResponse, + PrivateMessage, + UEInactivityNotification, + InitialULRRCMessageTransfer, + SystemInformationDeliveryCommand, + Paging, + Notify, + WriteReplaceWarningRequest, + WriteReplaceWarningResponse, + PWSCancelRequest, + PWSCancelResponse, + PWSRestartIndication, + PWSFailureIndication, + GNBDUStatusIndication, + RRCDeliveryReport, + UEContextModificationRefuse, + F1RemovalRequest, + F1RemovalResponse, + F1RemovalFailure, + NetworkAccessRateReduction, + TraceStart, + DeactivateTrace, + DUCURadioInformationTransfer, + CUDURadioInformationTransfer, + BAPMappingConfiguration, + BAPMappingConfigurationAcknowledge, + GNBDUResourceConfiguration, + GNBDUResourceConfigurationAcknowledge, + IABTNLAddressRequest, + IABTNLAddressResponse, + IABUPConfigurationUpdateRequest, + IABUPConfigurationUpdateResponse, + IABUPConfigurationUpdateFailure, + ResourceStatusRequest, + ResourceStatusResponse, + ResourceStatusFailure, + ResourceStatusUpdate, + AccessAndMobilityIndication, + ReferenceTimeInformationReportingControl, + ReferenceTimeInformationReport, + AccessSuccess, + CellTrafficTrace, + PositioningMeasurementRequest, + PositioningMeasurementResponse, + PositioningMeasurementFailure, + PositioningAssistanceInformationControl, + PositioningAssistanceInformationFeedback, + PositioningMeasurementReport, + PositioningMeasurementAbort, + PositioningMeasurementFailureIndication, + PositioningMeasurementUpdate, + TRPInformationRequest, + TRPInformationResponse, + TRPInformationFailure, + PositioningInformationRequest, + PositioningInformationResponse, + PositioningInformationFailure, + PositioningActivationRequest, + PositioningActivationResponse, + PositioningActivationFailure, + PositioningDeactivation, + PositioningInformationUpdate, + E-CIDMeasurementInitiationRequest, + E-CIDMeasurementInitiationResponse, + E-CIDMeasurementInitiationFailure, + E-CIDMeasurementFailureIndication, + E-CIDMeasurementReport, + E-CIDMeasurementTerminationCommand + + + +FROM F1AP-PDU-Contents + id-Reset, + id-F1Setup, + id-gNBDUConfigurationUpdate, + id-gNBCUConfigurationUpdate, + id-UEContextSetup, + id-UEContextRelease, + id-UEContextModification, + id-UEContextModificationRequired, + id-ErrorIndication, + id-UEContextReleaseRequest, + id-DLRRCMessageTransfer, + id-ULRRCMessageTransfer, + id-GNBDUResourceCoordination, + id-privateMessage, + id-UEInactivityNotification, + id-InitialULRRCMessageTransfer, + id-SystemInformationDeliveryCommand, + id-Paging, + id-Notify, + id-WriteReplaceWarning, + id-PWSCancel, + id-PWSRestartIndication, + id-PWSFailureIndication, + id-GNBDUStatusIndication, + id-RRCDeliveryReport, + id-F1Removal, + id-NetworkAccessRateReduction, + id-TraceStart, + id-DeactivateTrace, + id-DUCURadioInformationTransfer, + id-CUDURadioInformationTransfer, + id-BAPMappingConfiguration, + id-GNBDUResourceConfiguration, + id-IABTNLAddressAllocation, + id-IABUPConfigurationUpdate, + id-resourceStatusReportingInitiation, + id-resourceStatusReporting, + id-accessAndMobilityIndication, + id-ReferenceTimeInformationReportingControl, + id-ReferenceTimeInformationReport, + id-accessSuccess, + id-cellTrafficTrace, + id-PositioningMeasurementExchange, + id-PositioningAssistanceInformationControl, + id-PositioningAssistanceInformationFeedback, + id-PositioningMeasurementReport, + id-PositioningMeasurementAbort, + id-PositioningMeasurementFailureIndication, + id-PositioningMeasurementUpdate, + id-TRPInformationExchange, + id-PositioningInformationExchange, + id-PositioningActivation, + id-PositioningDeactivation, + id-PositioningInformationUpdate, + id-E-CIDMeasurementInitiation, + id-E-CIDMeasurementFailureIndication, + id-E-CIDMeasurementReport, + id-E-CIDMeasurementTermination + + +FROM F1AP-Constants + + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +F1AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + choice-extension ProtocolIE-SingleContainer { { F1AP-PDU-ExtIEs} } +} + +F1AP-PDU-ExtIEs F1AP-PROTOCOL-IES ::= { -- this extension is not used + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURES F1AP-ELEMENTARY-PROCEDURE ::= { + F1AP-ELEMENTARY-PROCEDURES-CLASS-1 | + F1AP-ELEMENTARY-PROCEDURES-CLASS-2, + ... +} + + +F1AP-ELEMENTARY-PROCEDURES-CLASS-1 F1AP-ELEMENTARY-PROCEDURE ::= { + reset | + f1Setup | + gNBDUConfigurationUpdate | + gNBCUConfigurationUpdate | + uEContextSetup | + uEContextRelease | + uEContextModification | + uEContextModificationRequired | + writeReplaceWarning | + pWSCancel | + gNBDUResourceCoordination | + f1Removal | + bAPMappingConfiguration | + gNBDUResourceConfiguration | + iABTNLAddressAllocation | + iABUPConfigurationUpdate | + resourceStatusReportingInitiation | + positioningMeasurementExchange | + tRPInformationExchange | + positioningInformationExchange | + positioningActivation | + e-CIDMeasurementInitiation, + ... +} + +F1AP-ELEMENTARY-PROCEDURES-CLASS-2 F1AP-ELEMENTARY-PROCEDURE ::= { + errorIndication | + uEContextReleaseRequest | + dLRRCMessageTransfer | + uLRRCMessageTransfer | + uEInactivityNotification | + privateMessage | + initialULRRCMessageTransfer | + systemInformationDelivery | + paging | + notify | + pWSRestartIndication | + pWSFailureIndication | + gNBDUStatusIndication | + rRCDeliveryReport | + networkAccessRateReduction | + traceStart | + deactivateTrace | + dUCURadioInformationTransfer | + cUDURadioInformationTransfer | + resourceStatusReporting | + accessAndMobilityIndication | + referenceTimeInformationReportingControl| + referenceTimeInformationReport | + accessSuccess | + cellTrafficTrace | + positioningAssistanceInformationControl | + positioningAssistanceInformationFeedback | + positioningMeasurementReport | + positioningMeasurementAbort | + positioningMeasurementFailureIndication | + positioningMeasurementUpdate | + positioningDeactivation | + e-CIDMeasurementFailureIndication | + e-CIDMeasurementReport | + e-CIDMeasurementTermination | + positioningInformationUpdate, + ... +} +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +reset F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Reset + SUCCESSFUL OUTCOME ResetAcknowledge + PROCEDURE CODE id-Reset + CRITICALITY reject +} + +f1Setup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1SetupRequest + SUCCESSFUL OUTCOME F1SetupResponse + UNSUCCESSFUL OUTCOME F1SetupFailure + PROCEDURE CODE id-F1Setup + CRITICALITY reject +} + +gNBDUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUConfigurationUpdate + SUCCESSFUL OUTCOME GNBDUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBDUConfigurationUpdateFailure + PROCEDURE CODE id-gNBDUConfigurationUpdate + CRITICALITY reject +} + +gNBCUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBCUConfigurationUpdate + SUCCESSFUL OUTCOME GNBCUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBCUConfigurationUpdateFailure + PROCEDURE CODE id-gNBCUConfigurationUpdate + CRITICALITY reject +} + +uEContextSetup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextSetupRequest + SUCCESSFUL OUTCOME UEContextSetupResponse + UNSUCCESSFUL OUTCOME UEContextSetupFailure + PROCEDURE CODE id-UEContextSetup + CRITICALITY reject +} + +uEContextRelease F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseCommand + SUCCESSFUL OUTCOME UEContextReleaseComplete + PROCEDURE CODE id-UEContextRelease + CRITICALITY reject +} + +uEContextModification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequest + SUCCESSFUL OUTCOME UEContextModificationResponse + UNSUCCESSFUL OUTCOME UEContextModificationFailure + PROCEDURE CODE id-UEContextModification + CRITICALITY reject +} + +uEContextModificationRequired F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequired + SUCCESSFUL OUTCOME UEContextModificationConfirm + UNSUCCESSFUL OUTCOME UEContextModificationRefuse + PROCEDURE CODE id-UEContextModificationRequired + CRITICALITY reject +} + +writeReplaceWarning F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE WriteReplaceWarningRequest + SUCCESSFUL OUTCOME WriteReplaceWarningResponse + PROCEDURE CODE id-WriteReplaceWarning + CRITICALITY reject +} + +pWSCancel F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSCancelRequest + SUCCESSFUL OUTCOME PWSCancelResponse + PROCEDURE CODE id-PWSCancel + CRITICALITY reject +} + +errorIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-ErrorIndication + CRITICALITY ignore +} + +uEContextReleaseRequest F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseRequest + PROCEDURE CODE id-UEContextReleaseRequest + CRITICALITY ignore +} + + +initialULRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InitialULRRCMessageTransfer + PROCEDURE CODE id-InitialULRRCMessageTransfer + CRITICALITY ignore +} + +dLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DLRRCMessageTransfer + PROCEDURE CODE id-DLRRCMessageTransfer + CRITICALITY ignore +} + +uLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ULRRCMessageTransfer + PROCEDURE CODE id-ULRRCMessageTransfer + CRITICALITY ignore +} + + +uEInactivityNotification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEInactivityNotification + PROCEDURE CODE id-UEInactivityNotification + CRITICALITY ignore +} + +gNBDUResourceCoordination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceCoordinationRequest + SUCCESSFUL OUTCOME GNBDUResourceCoordinationResponse + PROCEDURE CODE id-GNBDUResourceCoordination + CRITICALITY reject +} + +privateMessage F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-privateMessage + CRITICALITY ignore +} + +systemInformationDelivery F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SystemInformationDeliveryCommand + PROCEDURE CODE id-SystemInformationDeliveryCommand + CRITICALITY ignore +} + + +paging F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Paging + PROCEDURE CODE id-Paging + CRITICALITY ignore +} + +notify F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Notify + PROCEDURE CODE id-Notify + CRITICALITY ignore +} + +networkAccessRateReduction F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE NetworkAccessRateReduction + PROCEDURE CODE id-NetworkAccessRateReduction + CRITICALITY ignore +} + + +pWSRestartIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSRestartIndication + PROCEDURE CODE id-PWSRestartIndication + CRITICALITY ignore +} + +pWSFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSFailureIndication + PROCEDURE CODE id-PWSFailureIndication + CRITICALITY ignore +} + +gNBDUStatusIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUStatusIndication + PROCEDURE CODE id-GNBDUStatusIndication + CRITICALITY ignore +} + + +rRCDeliveryReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RRCDeliveryReport + PROCEDURE CODE id-RRCDeliveryReport + CRITICALITY ignore +} + +f1Removal F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1RemovalRequest + SUCCESSFUL OUTCOME F1RemovalResponse + UNSUCCESSFUL OUTCOME F1RemovalFailure + PROCEDURE CODE id-F1Removal + CRITICALITY reject +} + +traceStart F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TraceStart + PROCEDURE CODE id-TraceStart + CRITICALITY ignore +} + +deactivateTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DeactivateTrace + PROCEDURE CODE id-DeactivateTrace + CRITICALITY ignore +} + +dUCURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DUCURadioInformationTransfer + PROCEDURE CODE id-DUCURadioInformationTransfer + CRITICALITY ignore +} + +cUDURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CUDURadioInformationTransfer + PROCEDURE CODE id-CUDURadioInformationTransfer + CRITICALITY ignore +} + +bAPMappingConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE BAPMappingConfiguration + SUCCESSFUL OUTCOME BAPMappingConfigurationAcknowledge + PROCEDURE CODE id-BAPMappingConfiguration + CRITICALITY reject +} + +gNBDUResourceConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceConfiguration + SUCCESSFUL OUTCOME GNBDUResourceConfigurationAcknowledge + PROCEDURE CODE id-GNBDUResourceConfiguration + CRITICALITY reject +} + +iABTNLAddressAllocation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABTNLAddressRequest + SUCCESSFUL OUTCOME IABTNLAddressResponse + PROCEDURE CODE id-IABTNLAddressAllocation + CRITICALITY reject +} + +iABUPConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABUPConfigurationUpdateRequest + SUCCESSFUL OUTCOME IABUPConfigurationUpdateResponse + UNSUCCESSFUL OUTCOME IABUPConfigurationUpdateFailure + PROCEDURE CODE id-IABUPConfigurationUpdate + CRITICALITY reject +} + +resourceStatusReportingInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusRequest + SUCCESSFUL OUTCOME ResourceStatusResponse + UNSUCCESSFUL OUTCOME ResourceStatusFailure + PROCEDURE CODE id-resourceStatusReportingInitiation + CRITICALITY reject +} + +resourceStatusReporting F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusUpdate + PROCEDURE CODE id-resourceStatusReporting + CRITICALITY ignore +} + +accessAndMobilityIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessAndMobilityIndication + PROCEDURE CODE id-accessAndMobilityIndication + CRITICALITY ignore +} + +referenceTimeInformationReportingControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReportingControl + PROCEDURE CODE id-ReferenceTimeInformationReportingControl + CRITICALITY ignore +} + +referenceTimeInformationReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReport + PROCEDURE CODE id-ReferenceTimeInformationReport + CRITICALITY ignore +} + +accessSuccess F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessSuccess + PROCEDURE CODE id-accessSuccess + CRITICALITY ignore +} + +cellTrafficTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellTrafficTrace + PROCEDURE CODE id-cellTrafficTrace + CRITICALITY ignore +} + +positioningAssistanceInformationControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationControl + PROCEDURE CODE id-PositioningAssistanceInformationControl + CRITICALITY ignore +} + +positioningAssistanceInformationFeedback F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationFeedback + PROCEDURE CODE id-PositioningAssistanceInformationFeedback + CRITICALITY ignore +} + +positioningMeasurementExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementRequest + SUCCESSFUL OUTCOME PositioningMeasurementResponse + UNSUCCESSFUL OUTCOME PositioningMeasurementFailure + PROCEDURE CODE id-PositioningMeasurementExchange + CRITICALITY reject +} + +positioningMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementReport + PROCEDURE CODE id-PositioningMeasurementReport + CRITICALITY ignore +} + +positioningMeasurementAbort F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementAbort + PROCEDURE CODE id-PositioningMeasurementAbort + CRITICALITY ignore +} + +positioningMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementFailureIndication + PROCEDURE CODE id-PositioningMeasurementFailureIndication + CRITICALITY ignore +} + +positioningMeasurementUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementUpdate + PROCEDURE CODE id-PositioningMeasurementUpdate + CRITICALITY ignore +} + + +tRPInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TRPInformationRequest + SUCCESSFUL OUTCOME TRPInformationResponse + UNSUCCESSFUL OUTCOME TRPInformationFailure + PROCEDURE CODE id-TRPInformationExchange + CRITICALITY reject +} + +positioningInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationRequest + SUCCESSFUL OUTCOME PositioningInformationResponse + UNSUCCESSFUL OUTCOME PositioningInformationFailure + PROCEDURE CODE id-PositioningInformationExchange + CRITICALITY reject +} + +positioningActivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningActivationRequest + SUCCESSFUL OUTCOME PositioningActivationResponse + UNSUCCESSFUL OUTCOME PositioningActivationFailure + PROCEDURE CODE id-PositioningActivation + CRITICALITY reject +} + +positioningDeactivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningDeactivation + PROCEDURE CODE id-PositioningDeactivation + CRITICALITY ignore +} + +e-CIDMeasurementInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementInitiationRequest + SUCCESSFUL OUTCOME E-CIDMeasurementInitiationResponse + UNSUCCESSFUL OUTCOME E-CIDMeasurementInitiationFailure + PROCEDURE CODE id-E-CIDMeasurementInitiation + CRITICALITY reject +} + +e-CIDMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementFailureIndication + PROCEDURE CODE id-E-CIDMeasurementFailureIndication + CRITICALITY ignore +} + +e-CIDMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementReport + PROCEDURE CODE id-E-CIDMeasurementReport + CRITICALITY ignore +} + +e-CIDMeasurementTermination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementTerminationCommand + PROCEDURE CODE id-E-CIDMeasurementTermination + CRITICALITY ignore +} + +positioningInformationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationUpdate + PROCEDURE CODE id-PositioningInformationUpdate + CRITICALITY ignore +} + + +END diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index ee57a7ec838e41ca4374e03a1fc1e762b1a3f345..7781a78412ecb4e1c9caf08d805c62995a9c79ed 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -46,7 +46,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #endif -#include "F1AP_Active-Cells-List.h" #include "F1AP_RAT-FrequencyPriorityInformation.h" #include "F1AP_DLUPTNLInformation-ToBeSetup-Item.h" #include "F1AP_PrivateMessage.h" @@ -55,6 +54,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_NRPCI.h" #include "F1AP_Transmission-Bandwidth.h" #include "F1AP_SIB1-message.h" +#include "F1AP_SibtypetobeupdatedListItem.h" #include "F1AP_GNBCUConfigurationUpdateAcknowledge.h" #include "F1AP_DRBs-Setup-Item.h" #include "F1AP_EUTRA-NR-CellResourceCoordinationReqAck-Container.h" @@ -75,7 +75,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_DRBs-Required-ToBeModified-Item.h" #include "F1AP_BitRate.h" #include "F1AP_SRBs-ToBeSetup-List.h" -#include "F1AP_ConcurrentWarningMessageIndicator.h" #include "F1AP_CriticalityDiagnostics-IE-Item.h" #include "F1AP_GNB-CU-TNL-Association-To-Update-List.h" #include "F1AP_DRB-Notify-List.h" @@ -85,6 +84,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_PWS-Failed-NR-CGI-List.h" #include "F1AP_InitialULRRCMessageTransfer.h" #include "F1AP_Served-Cell-Information.h" +#include "F1AP_ServedPLMNs-Item.h" #include "F1AP_Served-EUTRA-Cells-Information.h" #include "F1AP_Cells-Broadcast-Cancelled-Item.h" #include "F1AP_F1SetupRequest.h" @@ -128,13 +128,11 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_TransactionID.h" #include "F1AP_AllocationAndRetentionPriority.h" #include "F1AP_ShortDRXCycleLength.h" -#include "F1AP_BroadcastPLMNs-Item.h" #include "F1AP_DRB-Information.h" #include "F1AP_TimeToWait.h" #include "F1AP_NonDynamic5QIDescriptor.h" #include "F1AP_C-RNTI.h" #include "F1AP_MIB-message.h" -#include "F1AP_SIBtype-Item.h" #include "F1AP_Served-Cells-To-Modify-List.h" #include "F1AP_NRCGI.h" #include "F1AP_DuplicationActivation.h" @@ -187,6 +185,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_CellULConfigured.h" #include "F1AP_DRB-Activity.h" #include "F1AP_GNB-CU-TNL-Association-Failed-To-Setup-Item.h" +#include "F1AP_ProtocolIE-ID.h" #include "F1AP_PrivateIE-ID.h" #include "F1AP_WriteReplaceWarningResponse.h" #include "F1AP_CauseMisc.h" @@ -231,9 +230,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_SUL-Information.h" #include "F1AP_CriticalityDiagnostics-IE-List.h" #include "F1AP_EUTRA-FDD-Info.h" -#include "F1AP_BroadcastPLMNs-List.h" #include "F1AP_Served-Cells-To-Delete-Item.h" -#include "F1AP_ListofEUTRACellsinGNBDUCoordination.h" #include "F1AP_Candidate-SpCell-Item.h" #include "F1AP_Cells-To-Be-Broadcast-List.h" #include "F1AP_ULRRCMessageTransfer.h" @@ -255,7 +252,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_SRBs-ToBeReleased-List.h" #include "F1AP_MeasGapConfig.h" #include "F1AP_NR-Mode-Info.h" -#include "F1AP_Active-Cells-Item.h" #include "F1AP_Protected-EUTRA-Resources-List.h" #include "F1AP_SRBs-FailedToBeSetup-Item.h" #include "F1AP_ResetAll.h" @@ -287,7 +283,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_UEContextReleaseRequest.h" #include "F1AP_GNB-DU-Name.h" #include "F1AP_DRBs-ToBeModified-Item.h" -#include "F1AP_SIBtype-List.h" #include "F1AP_EUTRA-NR-CellResourceCoordinationReq-Container.h" #include "F1AP_DRBs-SetupMod-List.h" #include "F1AP_DRBs-Required-ToBeModified-List.h" @@ -296,7 +291,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_PacketDelayBudget.h" #include "F1AP_GNBCUConfigurationUpdate.h" #include "F1AP_Cells-Broadcast-Completed-Item.h" -#include "F1AP_RRCRconfigurationCompleteIndicator.h" #include "F1AP_PagingPriority.h" #include "F1AP_Cells-Failed-to-be-Activated-List.h" #include "F1AP_Endpoint-IP-address-and-port.h" @@ -306,7 +300,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_ResetType.h" #include "F1AP_FDD-Info.h" #include "F1AP_DLUPTNLInformation-ToBeSetup-List.h" -#include "F1AP_QoSFlowIndicator.h" #include "F1AP_NR-CGI-List-For-Restart-List.h" #include "F1AP_F1SetupResponse.h" #include "F1AP_UEContextSetupResponse.h" @@ -325,7 +318,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_Cells-to-be-Barred-List.h" #include "F1AP_Presence.h" #include "F1AP_CellBarred.h" -#include "F1AP_SIBtype.h" #include "F1AP_RequestType.h" #include "F1AP_NRFreqInfo.h" #include "F1AP_Potential-SpCell-Item.h" @@ -348,7 +340,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_GBR-QoSFlowInformation.h" #include "F1AP_SCellIndex.h" #include "F1AP_DRBs-SetupMod-Item.h" -#include "F1AP_TransmissionStopIndicator.h" #include "F1AP_UEContextSetupFailure.h" #include "F1AP_DRBs-FailedToBeModified-List.h" #include "F1AP_DRBs-FailedToBeSetupMod-Item.h" diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 01cd4aa9e029793870aac5b071d99ce1954e67b6..88d0a8ec594b93fa9349d01557d7106bd70902d5 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -37,6 +37,7 @@ #include "f1ap_cu_interface_management.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; +extern RAN_CONTEXT_t RC; int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); @@ -102,8 +103,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_SETUP_REQ); - + message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); + /* assoc_id */ F1AP_SETUP_REQ(message_p).assoc_id = assoc_id; @@ -134,57 +135,58 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; for (i=0; i<num_cells_available; i++) { - F1AP_GNB_DU_Served_Cells_Item_t *served_celles_item_p; + F1AP_GNB_DU_Served_Cells_Item_t *served_cells_item_p; - served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); + served_cells_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); /* tac */ - OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", - i, F1AP_SETUP_REQ(message_p).tac[i]); - + if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) { + OCTET_STRING_TO_INT16(served_cells_item_p->served_Cell_Information.fiveGS_TAC, F1AP_SETUP_REQ(message_p).tac[i]); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", + i, F1AP_SETUP_REQ(message_p).tac[i]); + } /* - nRCGI */ - TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], + TBCD_TO_MCC_MNC(&(served_cells_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], F1AP_SETUP_REQ(message_p).mnc_digit_length[i]); // NR cellID - BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity, + BIT_STRING_TO_NR_CELL_IDENTITY(&served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity, F1AP_SETUP_REQ(message_p).nr_cellid[i]); LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], (long long unsigned int)F1AP_SETUP_REQ(message_p).nr_cellid[i]); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); + served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], + served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], + served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], + served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3], + served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); /* - nRPCI */ - F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; + F1AP_SETUP_REQ(message_p).nr_pci[i] = served_cells_item_p->served_Cell_Information.nRPCI; LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); // System Information /* mib */ - F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_celles_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_celles_item_p->gNB_DU_System_Information->mIB_message.buf, - served_celles_item_p->gNB_DU_System_Information->mIB_message.size); + F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_cells_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_cells_item_p->gNB_DU_System_Information->mIB_message.buf, + served_cells_item_p->gNB_DU_System_Information->mIB_message.size); /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; - F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size; + F1AP_SETUP_REQ(message_p).mib[i][served_cells_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; + F1AP_SETUP_REQ(message_p).mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size; LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); /* sib1 */ - F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_celles_item_p->gNB_DU_System_Information->sIB1_message.buf, - served_celles_item_p->gNB_DU_System_Information->sIB1_message.size); + F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf, + served_cells_item_p->gNB_DU_System_Information->sIB1_message.size); /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; - F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size; + F1AP_SETUP_REQ(message_p).sib1[i][served_cells_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; + F1AP_SETUP_REQ(message_p).sib1_length[i] = served_cells_item_p->gNB_DU_System_Information->sIB1_message.size; LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); } @@ -245,10 +247,18 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ); if (num_cells_available > 0) { - itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); + if (RC.nrrrc[0]->node_type == ngran_gNB_CU) { + itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); + } else { + itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); + } } else { CU_send_F1_SETUP_FAILURE(instance); - itti_free(TASK_RRC_ENB,message_p); + if (RC.nrrrc[0]->node_type == ngran_gNB_CU) { + itti_free(TASK_RRC_GNB,message_p); + } else { + itti_free(TASK_RRC_ENB,message_p); + } return -1; } return 0; @@ -305,85 +315,99 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* mandatory */ /* c3. cells to be Activated list */ - ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; - int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; LOG_D(F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate); - for (i=0; - i<num_cells_to_activate; - i++) { - - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; - cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); - cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; - - /* 3.1 cells to be Activated list item */ - F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; - memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->nr_cellid[i], &nRCGI.nRCellIdentity); - cells_to_be_activated_list_item.nRCGI = nRCGI; - - /* optional */ - /* - nRPCI */ - if (1) { - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->nrpci[i]; // int 0..1007 - } - - /* optional */ - /* - gNB-CU System Information */ - if (1) { - /* 3.1.2 gNB-CUSystem Information */ - F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; - cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); - cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; - cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; - - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); - //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) - // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); + if (num_cells_to_activate >0) { + ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; + + + for (i=0; + i<num_cells_to_activate; + i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; + cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + + /* 3.1 cells to be Activated list item */ + F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; + memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); + MCC_MNC_TO_PLMNID(f1ap_setup_resp->cells_to_activate[i].mcc, f1ap_setup_resp->cells_to_activate[i].mnc, f1ap_setup_resp->cells_to_activate[i].mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity); + cells_to_be_activated_list_item.nRCGI = nRCGI; + + /* optional */ + /* - nRPCI */ + if (1) { + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->cells_to_activate[i].nrpci; // int 0..1007 + } + + /* optional */ + /* - gNB-CU System Information */ + if (1) { + /* 3.1.2 gNB-CUSystem Information */ + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; + cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); + cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; + + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); + //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); + //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) + // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); //printf("\n"); - OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, - (const char*)f1ap_setup_resp->SI_container[i][0], - f1ap_setup_resp->SI_container_length[i][0]); - - LOG_D(F1AP, "f1ap_setup_resp->SI_container_length = %d \n", f1ap_setup_resp->SI_container_length[0][0]); - cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; - - - F1AP_ProtocolExtensionContainer_160P9_t p_160P9_t; - memset((void *)&p_160P9_t, 0, sizeof(F1AP_ProtocolExtensionContainer_160P9_t)); - - ASN_SEQUENCE_ADD(&p_160P9_t.list, - cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_160P9_t; - - free(gNB_CUSystemInformation); - gNB_CUSystemInformation = NULL; - } - /* ADD */ - cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; + + // for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ? + for (int sIBtype=2;sIBtype<21;sIBtype++) { + if (f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype]!=NULL) { + AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype); + F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item)); + memset((void*)sib_item,0,sizeof(*sib_item)); + sib_item->sIBtype = sIBtype; + OCTET_STRING_fromBuf(&sib_item->sIBmessage, + (const char*)f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype], + f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); + + LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); + ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item); + } + } + cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; + + + F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t; + memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t)); + + ASN_SEQUENCE_ADD(&p_154P112_t.list, + cells_to_be_activated_list_itemExtIEs); + cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t; + + free(gNB_CUSystemInformation); + gNB_CUSystemInformation = NULL; + } + /* ADD */ + cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); + cells_to_be_activated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup response\n"); return -1; } @@ -469,7 +493,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup failure\n"); return -1; } @@ -508,7 +532,7 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, */ //void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { -int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP) { +int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configuration_update_t *f1ap_gnb_cu_configuration_update) { F1AP_F1AP_PDU_t pdu; F1AP_GNBCUConfigurationUpdate_t *out; F1AP_GNBCUConfigurationUpdateIEs_t *ie; @@ -517,10 +541,6 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ uint32_t len; int i = 0; - // for test - int mcc = 208; - int mnc = 93; - int mnc_digit_length = 8; /* Create */ /* 0. Message Type */ @@ -528,7 +548,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate; out = &pdu.choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; @@ -538,63 +558,106 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ ie->id = F1AP_ProtocolIE_ID_id_TransactionID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP); + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, 0); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // mandatory + // c2. Cells_to_be_Activated_List + if (f1ap_gnb_cu_configuration_update->num_cells_to_activate > 0) { + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List; + + for (i=0; + i<f1ap_gnb_cu_configuration_update->num_cells_to_activate; + i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; + cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + + // 2.1 cells to be Activated list item + F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; + memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + + // - nRCGI + F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); + MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc, + f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc, + f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, + &nRCGI.nRCellIdentity); + cells_to_be_activated_list_item.nRCGI = nRCGI; + + // optional + // -nRPCI + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = f1ap_gnb_cu_configuration_update->cells_to_activate[i].nrpci; // int 0..1007 + + // optional + // 3.1.2 gNB-CUSystem Information + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; + cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); + cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; - /* mandatory */ - /* c2. Cells_to_be_Activated_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List; - - for (i=0; - i<1; - i++) { - - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; - cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); - cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; - - /* 2.1 cells to be Activated list item */ - F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; - memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - cells_to_be_activated_list_item.nRCGI = nRCGI; - - /* optional */ - /* - nRPCI */ - if (0) { - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 - } - - /* optional */ - /* - gNB-CU System Information */ - //if (1) { - - //} - /* ADD */ - cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - + if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].num_SI > 0) { + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); + //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); + //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) + // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); + //printf("\n"); + + // for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ? + for (int sIBtype=2;sIBtype<21;sIBtype++) { + if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype]!=NULL) { + AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype); + F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item)); + memset((void*)sib_item,0,sizeof(*sib_item)); + sib_item->sIBtype = sIBtype; + OCTET_STRING_fromBuf(&sib_item->sIBmessage, + (const char*)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype], + f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]); + + LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]); + ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item); + } + } + cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; + + + F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t; + memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t)); + + ASN_SEQUENCE_ADD(&p_154P112_t.list, + cells_to_be_activated_list_itemExtIEs); + cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t; + + free(gNB_CUSystemInformation); + gNB_CUSystemInformation = NULL; + } + + // ADD + cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, + cells_to_be_activated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + } + + /* - /* mandatory */ - /* c3. Cells_to_be_Deactivated_List */ + // c3. Cells_to_be_Deactivated_List + // ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List; ie->criticality = F1AP_Criticality_reject; @@ -610,11 +673,11 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject; cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; - /* 3.1 cells to be Deactivated list item */ + // 3.1 cells to be Deactivated list item F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item; memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t)); - /* - nRCGI */ + F1AP_NRCGI_t nRCGI; memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, @@ -622,17 +685,17 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); cells_to_be_deactivated_list_item.nRCGI = nRCGI; - //} - /* ADD */ cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item; ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list, cells_to_be_deactivated_list_item_ies); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); +*/ - /* mandatory */ - /* c4. GNB_CU_TNL_Association_To_Add_List */ + /* + // c4. GNB_CU_TNL_Association_To_Add_List + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List; ie->criticality = F1AP_Criticality_reject; @@ -648,12 +711,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; - /* 4.1 GNB_CU_TNL_Association_To_Add_Item */ + // 4.1 GNB_CU_TNL_Association_To_Add_Item F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item; memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t)); - /* 4.1.1 tNLAssociationTransportLayerAddress */ + // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t transportLayerAddress; memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; @@ -666,21 +729,22 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - /* 4.1.2 tNLAssociationUsage */ + // 4.1.2 tNLAssociationUsage gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; - /* ADD */ + gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item; ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list, gnb_cu_tnl_association_to_add_item_ies); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + */ - - /* mandatory */ - /* c5. GNB_CU_TNL_Association_To_Remove_List */ + /* + + // c5. GNB_CU_TNL_Association_To_Remove_List ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List; ie->criticality = F1AP_Criticality_reject; @@ -695,12 +759,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ gnb_cu_tnl_association_to_remove_item_ies->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_remove_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; - /* 4.1 GNB_CU_TNL_Association_To_Remove_Item */ + // 4.1 GNB_CU_TNL_Association_To_Remove_Item F1AP_GNB_CU_TNL_Association_To_Remove_Item_t gnb_cu_tnl_association_to_remove_item; memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t)); - /* 4.1.1 tNLAssociationTransportLayerAddress */ + // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t transportLayerAddress; memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; @@ -714,15 +778,16 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - /* ADD */ + gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item; ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, gnb_cu_tnl_association_to_remove_item_ies); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + */ - /* mandatory */ - /* c6. GNB_CU_TNL_Association_To_Update_List */ + /* + //c6. GNB_CU_TNL_Association_To_Update_List ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List; ie->criticality = F1AP_Criticality_reject; @@ -737,12 +802,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; - /* 4.1 GNB_CU_TNL_Association_To_Update_Item */ + // 4.1 GNB_CU_TNL_Association_To_Update_Item F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item; memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t)); - /* 4.1.1 tNLAssociationTransportLayerAddress */ + // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t transportLayerAddress; memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; @@ -756,13 +821,13 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - /* 4.1.2 tNLAssociationUsage */ + // 4.1.2 tNLAssociationUsage if (1) { gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t)); *gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; } - /* ADD */ + gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item; ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list, gnb_cu_tnl_association_to_update_item_ies); @@ -770,9 +835,10 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + */ - /* mandatory */ - /* c7. Cells_to_be_Barred_List */ + /* + // c7. Cells_to_be_Barred_List ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List; ie->criticality = F1AP_Criticality_reject; @@ -787,11 +853,11 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ cells_to_be_barred_item_ies->criticality = F1AP_Criticality_reject; cells_to_be_barred_item_ies->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; - /* 7.1 cells to be Deactivated list item */ + // 7.1 cells to be Deactivated list item F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item; memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t)); - /* - nRCGI */ + // - nRCGI F1AP_NRCGI_t nRCGI; memset(&nRCGI,0,sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, @@ -799,20 +865,19 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); cells_to_be_barred_item.nRCGI = nRCGI; - /* 7.2 cellBarred*/ + // 7.2 cellBarred cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred; - /* ADD */ cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item = cells_to_be_barred_item; ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Barred_List.list, cells_to_be_barred_item_ies); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + */ - - /* mandatory */ - /* c8. Protected_EUTRA_Resources_List */ + /* + // c8. Protected_EUTRA_Resources_List ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; ie->criticality = F1AP_Criticality_reject; @@ -825,20 +890,16 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ F1AP_Protected_EUTRA_Resources_ItemIEs_t *protected_eutra_resources_item_ies; - /* 8.1 SpectrumSharingGroupID */ + // 8.1 SpectrumSharingGroupID protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; - protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_SpectrumSharingGroupID; - protected_eutra_resources_item_ies->value.choice.SpectrumSharingGroupID = 1L; - + protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_Protected_EUTRA_Resources_Item; + ((F1AP_Protected_EUTRA_Resources_Item_t*)&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item)->spectrumSharingGroupID = 123L; + memset(&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item,0, + sizeof(F1AP_Protected_EUTRA_Resources_Item_t)); ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); - /* 8.2 ListofEUTRACellsinGNBDUCoordination */ - protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); - protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; - protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; - protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_ListofEUTRACellsinGNBDUCoordination; F1AP_Served_EUTRA_Cells_Information_t served_eutra_cells_information; memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); @@ -870,16 +931,21 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ ASN_SEQUENCE_ADD(&protected_eutra_resources_item_ies->value.choice.ListofEUTRACellsinGNBDUCoordination.list, &served_eutra_cells_information); ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); + } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + */ /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 gNB-CU CONFIGURATION UPDATE\n"); return -1; } - + + printf("F1AP gNB-CU CONFIGURATION UPDATE : "); + for (int i=0;i<len;i++) printf("%02x ",buffer[i]); + printf("\n"); cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); return 0; } @@ -895,7 +961,8 @@ int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + LOG_I(F1AP,"Cell Configuration ok (assoc_id %d)\n",assoc_id); + return(0); } diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index acad13836dea4e8043791945cb853fa3551d30ec..de7dcfe99ba9b9b475813010a406a0a12d6297af 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -85,8 +85,7 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, /* * gNB-CU Configuration Update */ -int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP); - +int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configuration_update_t *f1ap_gnb_cu_configuration_update); int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, uint32_t assoc_id, uint32_t stream, diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 306a1fe14bb73216444dbab6d878f8bf925fba5b..2a029a3ac522551cd76674e5be7c1eb639cf2236 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -109,35 +109,67 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RNTI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_C_RNTI, true); - BUFFER_TO_INT16(ie->value.choice.C_RNTI.buf, rnti); + rnti = ie->value.choice.C_RNTI; /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - + AssertFatal(ie!=NULL,"RRCContainer is missing\n"); // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); - memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - ccch_sdu_len = ie->value.choice.RRCContainer.size; - memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - ccch_sdu_len); - - //LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, - // ie->value.choice.RRCContainer.size); - //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) - // printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - //printf("\n"); + if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { + message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND); + memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + ccch_sdu_len = ie->value.choice.RRCContainer.size; + memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + ccch_sdu_len); + } else { + message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); + memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + ccch_sdu_len = ie->value.choice.RRCContainer.size; + memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + ccch_sdu_len); + } + + LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, + ie->value.choice.RRCContainer.size); + for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + printf("\n"); + /* DUtoCURRCContainer */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, true); + if (ie) { + NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t)); + NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = ie->value.choice.DUtoCURRCContainer.size; + NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(ie->value.choice.DUtoCURRCContainer.size); + memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf, + ie->value.choice.DUtoCURRCContainer.buf, + ie->value.choice.DUtoCURRCContainer.size); + + } // Find instance from nr_cellid int rrc_inst = -1; - for (int i=0;i<RC.nb_inst;i++) { + if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { + for (int i=0;i<RC.nb_nr_inst;i++) { + // first get RRC instance (note, no the ITTI instance) + gNB_RRC_INST *rrc = RC.nrrrc[i]; + if (rrc->nr_cellid == nr_cellid) { + rrc_inst = i; + break; + } + } + } else { + for (int i=0;i<RC.nb_inst;i++) { // first get RRC instance (note, no the ITTI instance) - eNB_RRC_INST *rrc = RC.rrc[i]; - if (rrc->nr_cellid == nr_cellid) { - rrc_inst = i; - break; + eNB_RRC_INST *rrc = RC.rrc[i]; + if (rrc->nr_cellid == nr_cellid) { + rrc_inst = i; + break; + } } } + AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %llu\n",(unsigned long long int)nr_cellid); int f1ap_uid = f1ap_add_ue(&f1ap_cu_inst[rrc_inst], rrc_inst, CC_id, 0, rnti); @@ -148,15 +180,23 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; - - RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; - RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; - RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; - RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance - RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; - RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; - itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); - + if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { + NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; + NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; + NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; + NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance + NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; + NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; + itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p); + } else { + RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; + RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; + RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; + RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance + RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; + RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; + itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); + } return 0; } @@ -171,6 +211,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, f1ap_dl_rrc_message_t *f1ap_dl_rrc) { + LOG_D(F1AP, "CU send DL_RRC_MESSAGE_TRANSFER \n"); F1AP_F1AP_PDU_t pdu; F1AP_DLRRCMessageTransfer_t *out; F1AP_DLRRCMessageTransferIEs_t *ie; @@ -252,31 +293,36 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - //LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length); - //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) - // printf("%02x ", f1ap_dl_rrc->rrc_container[i]); - //printf("\n"); + LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length); + for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + printf("%02x ", f1ap_dl_rrc->rrc_container[i]); + printf("\n"); /* optional */ /* c7. RAT_FrequencyPriorityInformation */ /* TODO */ if (0) { + int endc=1; ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; - - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 123L; - - //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; - //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; + if (endc==1) { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 123L; + } + else { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; + } + //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; + //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 DL RRC MESSAGE TRANSFER \n"); return -1; } @@ -298,7 +344,6 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ULRRCMessageTransfer_t *container; F1AP_ULRRCMessageTransferIEs_t *ie; - uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; @@ -348,6 +393,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, // print message in debug mode // create an ITTI message and copy SDU + /* message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_DCCH_DATA_IND); @@ -370,6 +416,8 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ctxt.instance = instance; ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); ctxt.enb_flag = 1; + ctxt.eNB_index = 0; + ctxt.configured = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index d2f4c3a56b8295b01c3a2f528ee73d7df1a24d7d..24aec70b57e5dd4c6a510ff291be6235e69cf549 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -39,6 +39,7 @@ #include "proto_agent.h" extern RAN_CONTEXT_t RC; +extern uint8_t proto_agent_flag; f1ap_setup_req_t *f1ap_du_data_from_du; f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB]; @@ -72,13 +73,14 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat /* setup parameters for F1U and start the server */ const cudu_params_t params = { - .local_ipv4_address = RC.rrc[instance]->eth_params_s.my_addr, - .local_port = RC.rrc[instance]->eth_params_s.my_portd, - .remote_ipv4_address = RC.rrc[instance]->eth_params_s.remote_addr, - .remote_port = RC.rrc[instance]->eth_params_s.remote_portd + .local_ipv4_address = RC.nrrrc[instance]->eth_params_s.my_addr, + .local_port = RC.nrrrc[instance]->eth_params_s.my_portd, + .remote_ipv4_address = RC.nrrrc[instance]->eth_params_s.remote_addr, + .remote_port = RC.nrrrc[instance]->eth_params_s.remote_portd }; AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); + proto_agent_flag = 1; } void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { @@ -107,7 +109,11 @@ void cu_task_send_sctp_init_req(instance_t enb_id) { message_p->ittiMsg.sctp_init.ipv4 = 1; message_p->ittiMsg.sctp_init.ipv6 = 0; message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; - message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr); + if (RC.nrrrc[0]->node_type == ngran_gNB_CU) { + message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.nrrrc[enb_id]->eth_params_s.my_addr); + } else{ + message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr); + } /* * SR WARNING: ipv6 multi-homing fails sometimes for localhost. * * * * Disable it for now. @@ -166,13 +172,27 @@ void *F1AP_CU_task(void *arg) { &F1AP_SETUP_RESP(received_msg)); break; - case F1AP_DL_RRC_MESSAGE: // from rrc + case F1AP_GNB_CU_CONFIGURATION_UPDATE: // from rrc + LOG_I(F1AP, "CU Task Received F1AP_GNB_CU_CONFIGURAITON_UPDATE\n"); + // CU_send_f1setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + // &F1AP_SETUP_RESP(received_msg)); + CU_send_gNB_CU_CONFIGURATION_UPDATE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_GNB_CU_CONFIGURATION_UPDATE(received_msg)); + break; + + case F1AP_DL_RRC_MESSAGE: // from rrc LOG_I(F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_DL_RRC_MESSAGE(received_msg)); break; - case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc + case F1AP_UE_CONTEXT_SETUP_REQ: // from rrc + LOG_I(F1AP, "CU Task Received F1AP_UE_CONTEXT_SETUP_REQ\n"); + CU_send_UE_CONTEXT_SETUP_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_UE_CONTEXT_SETUP_REQ(received_msg)); + break; + + case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc LOG_I(F1AP, "CU Task Received F1AP_UE_CONTEXT_RELEASE_CMD\n"); CU_send_UE_CONTEXT_RELEASE_COMMAND(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UE_CONTEXT_RELEASE_CMD(received_msg)); diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 789ce4c715b3dd5336e866786b5fd5c150ce4962..85c992f7578005a2306b275e7fbd372a5c9484e5 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -45,6 +45,7 @@ extern f1ap_setup_req_t *f1ap_du_data_from_du; extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB]; extern RAN_CONTEXT_t RC; +extern uint32_t f1ap_assoc_id; int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { @@ -108,7 +109,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* mandatory */ /* c4. ServCellIndex */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->id = F1AP_ProtocolIE_ID_id_ServCellIndex; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; ie->value.choice.ServCellIndex = 2; @@ -150,7 +151,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - +if (0) { /* mandatory */ /* c7. Candidate_SpCell_List */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); @@ -379,75 +380,86 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } } else { - /* 12.1.2 dRB_Information */ - drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_dRB_Information; - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information = (F1AP_DRB_Information_t *)calloc(1, sizeof(F1AP_DRB_Information_t)); - + /* 12.1.2 DRB_Information */ + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_choice_extension; + + F1AP_QoSInformation_ExtIEs_t *ie; + ie = (F1AP_QoSInformation_ExtIEs_t *)calloc(1, sizeof(F1AP_QoS_Characteristics_ExtIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRB_Information; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_QoSInformation_ExtIEs__value_PR_DRB_Information; + F1AP_DRB_Information_t *DRB_Information = &ie->value.choice.DRB_Information; + + drbs_toBeSetup_item.qoSInformation.choice.choice_extension = (struct F1AP_ProtocolIE_SingleContainer*)ie; + + /* 12.1.2.1 dRB_QoS */ { /* qoS_Characteristics */ { int some_decide_qoS_characteristics = 1; // BK: Need Check if (some_decide_qoS_characteristics) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); + DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); /* fiveQI */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; /* OPTIONAL */ /* qoSPriorityLevel */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; } } else { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); + DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); /* qoSPriorityLevel */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; /* packetDelayBudget */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; /* packetErrorRate */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L; + /* OPTIONAL */ /* delayCritical */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; } } // if some_decide_qoS_characteristics @@ -456,32 +468,32 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* nGRANallocationRetentionPriority */ { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum } // nGRANallocationRetentionPriority /* OPTIONAL */ /* gBR_QoS_Flow_Information */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + DRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); /* OPTIONAL */ /* maxPacketLossRateDownlink */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + *DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + *DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; } } @@ -489,8 +501,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* reflective_QoS_Attribute */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; + DRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); + *DRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; } } // dRB_QoS @@ -498,21 +510,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.2 sNSSAI */ { /* sST */ - OCTET_STRING_fromBuf(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", + OCTET_STRING_fromBuf(&DRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); /* OPTIONAL */ /* sD */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD, "asdsa1d32sa1d31asd31as", + DRB_Information->sNSSAI.sD = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(DRB_Information->sNSSAI.sD, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); } } /* OPTIONAL */ /* 12.1.2.3 notificationControl */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = F1AP_NotificationControl_active; // enum + DRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); + *DRB_Information->notificationControl = F1AP_NotificationControl_active; // enum } /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy @@ -523,7 +535,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, memset((void *)&flows_mapped_to_drb_item, 0, sizeof(F1AP_Flows_Mapped_To_DRB_Item_t)); /* qoSFlowIndicator */ - flows_mapped_to_drb_item.qoSFlowIndicator = 1L; + flows_mapped_to_drb_item.qoSFlowIdentifier = 1L; /* qoSFlowLevelQoSParameters */ { @@ -569,8 +581,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; /* packetErrorRate */ - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; - + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L; + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L; /* OPTIONAL */ /* delayCritical */ if (0) { @@ -637,7 +649,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } // qoSFlowLevelQoSParameters // BK: need check - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->flows_Mapped_To_DRB_List.list, &flows_mapped_to_drb_item); + ASN_SEQUENCE_ADD(&DRB_Information->flows_Mapped_To_DRB_List.list, &flows_mapped_to_drb_item); } } // if some_decide_qos @@ -672,7 +684,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; break; default: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um_bidirectional; } /* OPTIONAL */ @@ -696,7 +708,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - +} /* OPTIONAL */ /* InactivityMonitoringRequest */ if (0) { @@ -716,28 +728,26 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation; - int some_decide_rat = 1; // BK: Need Check - if (some_decide_rat) { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 11L; + int endc = 1; // RK: Get this from somewhere ... + if (endc) { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 11L; } else { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 11L; + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* OPTIONAL */ /* RRCContainer */ - if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_ue_context_setup_req->rrc_container, + f1ap_ue_context_setup_req->rrc_container_length); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* OPTIONAL */ /* MaskedIMEISV */ @@ -752,10 +762,26 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP REQUEST\n"); return -1; } + // xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)pdu); + + // asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + // buffer = res.buffer; + // len = res.result.encoded; + + // if (res.result.encoded <= 0) { + // LOG_E(F1AP, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded); + // return -1; + // } + + LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %u bits\n", len); + + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/ , buffer, len, 0 /* BK: fix me*/); + return 0; } @@ -763,7 +789,42 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + F1AP_UEContextSetupResponse_t *container; + F1AP_UEContextSetupResponseIEs_t *ie; + + DevAssert(pdu); + + container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; + + /* GNB_CU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + + /* DUtoCURRCInformation */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true); + + /* DRBs_Setup_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true); + + /* SRBs_FailedToBeSetup_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, true); + + /* DRBs_FailedToBeSetup_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, true); + + /* SCell_FailedtoSetup_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, true); + + return 0; } int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, @@ -1070,7 +1131,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* mandatory */ /* c4. ServCellIndex */ ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->id = F1AP_ProtocolIE_ID_id_ServCellIndex; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex; ie->value.choice.ServCellIndex = 5L; @@ -1114,13 +1175,13 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { } /* optional */ - /* c6. TransmissionStopIndicator */ + /* c6. TransmissionActionIndicator */ if (1) { ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransmissionStopIndicator; + ie->id = F1AP_ProtocolIE_ID_id_TransmissionActionIndicator; ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionStopIndicator; - ie->value.choice.TransmissionStopIndicator = F1AP_TransmissionStopIndicator_true; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator; + ie->value.choice.TransmissionActionIndicator = F1AP_TransmissionActionIndicator_stop; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -1140,10 +1201,10 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* c7. RRCRconfigurationCompleteIndicator */ if (1) { ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCRconfigurationCompleteIndicator; + ie->id = F1AP_ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator; ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCRconfigurationCompleteIndicator; - ie->value.choice.RRCRconfigurationCompleteIndicator = F1AP_RRCRconfigurationCompleteIndicator_true; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCReconfigurationCompleteIndicator; + ie->value.choice.RRCReconfigurationCompleteIndicator = F1AP_RRCReconfigurationCompleteIndicator_true; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -1325,7 +1386,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { } /* rLCMode */ - drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um; // enum + drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um_bidirectional; // enum /* OPTIONAL */ /* ULConfiguration */ @@ -1366,9 +1427,10 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { drbs_toBeModified_item.dRBID = 30L; /* qoSInformation */ - drbs_toBeModified_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; + drbs_toBeModified_item.qoSInformation =calloc(1,sizeof(*drbs_toBeModified_item.qoSInformation)); + drbs_toBeModified_item.qoSInformation->present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeModified_item.qoSInformation->choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeModified_item.qoSInformation->choice.eUTRANQoS->qCI = 254L; /* ULTunnels_ToBeModified_List */ int j = 0; @@ -1472,7 +1534,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 UE CONTEXT_MODIFICATION REQUEST\n"); return -1; } diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 7bd5359e29fa0665f387134c28a6a1be8c5dd837..1b35ca6ccf8fc69d941e0ae349eb7155bbcabe66 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -49,6 +49,11 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); break; + case F1AP_ProcedureCode_id_gNBCUConfigurationUpdate: + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n", __func__); + break; + case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_InitialULRRCMessageTransfer\n", __func__); @@ -69,6 +74,9 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) case F1AP_ProcedureCode_id_UEContextReleaseRequest: LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextReleaseRequest\n", __func__); break; + case F1AP_ProcedureCode_id_UEContextSetup: + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__); + break; // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); // message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; @@ -102,6 +110,10 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); break; + case F1AP_ProcedureCode_id_gNBCUConfigurationUpdate: + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n", __func__); + break; + case F1AP_ProcedureCode_id_UEContextRelease: LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); break; @@ -149,7 +161,7 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t 0, 0); - if (asn1_decoder_xer_print) { + if (1 /*asn1_decoder_xer_print*/) { LOG_E(F1AP, "----------------- ASN1 DECODER PRINT START----------------- \n"); xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); LOG_E(F1AP, "----------------- ASN1 DECODER PRINT END ----------------- \n"); @@ -157,7 +169,7 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t //LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code); if (dec_ret.code != RC_OK) { - LOG_E(F1AP, "Failed to decode pdu\n"); + AssertFatal(1==0,"Failed to decode pdu\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 86b5b1cb77748c836525e84a5911b3e6b11837a4..6f43240e66b3c1782b73ec8aab49fca5a478cbe6 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -38,7 +38,14 @@ #include "assertions.h" extern f1ap_setup_req_t *f1ap_du_data; +extern RAN_CONTEXT_t RC; +int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273}; + +int to_NRNRB(int nrb) { + for (int i=0;i<29;i++) if (nrb_lut[i] == nrb) return i; + AssertFatal(1==0,"nrb %d is not in the list of possible NRNRB\n",nrb); +} int DU_handle_RESET(instance_t instance, uint32_t assoc_id, @@ -95,7 +102,6 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { uint8_t *buffer; uint32_t len; int i = 0; - int j = 0; /* Create */ /* 0. pdu Type */ @@ -189,8 +195,13 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - (const char*)&f1ap_du_data->tac[i], + uint8_t fiveGS_TAC[3]; + served_cell_information.fiveGS_TAC=calloc(1,sizeof(*served_cell_information.fiveGS_TAC)); + fiveGS_TAC[0] = ((uint8_t*)&f1ap_du_data->tac[i])[2]; + fiveGS_TAC[1] = ((uint8_t*)&f1ap_du_data->tac[i])[1]; + fiveGS_TAC[2] = ((uint8_t*)&f1ap_du_data->tac[i])[0]; + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, + (const char *)fiveGS_TAC, 3); /* - Configured_EPS_TAC */ @@ -201,19 +212,11 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { 2); } - /* - broadcast PLMNs */ - // RK: add the num_available_broadcast_PLMNs to the message - int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; - LOG_D(F1AP, "num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); - for (j=0; - j<num_available_broadcast_PLMNs; // num_available_broadcast_PLMNs - j++) { - /* > PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //MCC_MNC_TO_PLMNID(208, 95, 2, &broadcastPLMNs_Item->pLMN_Identity); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } + /* servedPLMN information */ + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; @@ -308,10 +311,10 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.3 UL Transmission Bandwidth */ fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.ul_nrb; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.ul_nrb); /* FDD.4 DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.dl_nrb; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.dl_nrb); nR_Mode_Info.choice.fDD = fDD_Info; } else { // TDD @@ -362,7 +365,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* TDD.2 transmission_Bandwidth */ tDD_Info->transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].tdd.scs; - tDD_Info->transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].tdd.nrb; + tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].tdd.nrb); nR_Mode_Info.choice.tDD = tDD_Info; } // if nR_Mode_Info @@ -399,6 +402,18 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + /* c5. RRC VERSION */ + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version; + ie->value.choice.RRC_Version.latest_RRC_Version.buf=calloc(1,sizeof(char)); + ie->value.choice.RRC_Version.latest_RRC_Version.buf[0] = 0xe0; + ie->value.choice.RRC_Version.latest_RRC_Version.size = 1; + ie->value.choice.RRC_Version.latest_RRC_Version.bits_unused = 5; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 setup request\n"); @@ -425,126 +440,175 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_F1AP_PDU_t *pdu) { - LOG_D(F1AP, "DU_handle_F1_SETUP_RESPONSE\n"); - - AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome, - "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); - AssertFatal(pdu->choice.successfulOutcome->procedureCode == F1AP_ProcedureCode_id_F1Setup, - "pdu->choice.successfulOutcome->procedureCode != F1AP_ProcedureCode_id_F1Setup\n"); - AssertFatal(pdu->choice.successfulOutcome->criticality == F1AP_Criticality_reject, - "pdu->choice.successfulOutcome->criticality != F1AP_Criticality_reject\n"); - AssertFatal(pdu->choice.successfulOutcome->value.present == F1AP_SuccessfulOutcome__value_PR_F1SetupResponse, - "pdu->choice.successfulOutcome->value.present != F1AP_SuccessfulOutcome__value_PR_F1SetupResponse\n"); - - F1AP_F1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.F1SetupResponse; - - - F1AP_F1SetupResponseIEs_t *ie; - int TransactionId = -1; - int num_cells_to_activate = 0; - F1AP_Cells_to_be_Activated_List_Item_t *cell; - - MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_SETUP_RESP); - - LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", - in->protocolIEs.list.count); - for (int i=0;i < in->protocolIEs.list.count; i++) { - ie = in->protocolIEs.list.array[i]; - switch (ie->id) { - case F1AP_ProtocolIE_ID_id_TransactionID: - AssertFatal(ie->criticality == F1AP_Criticality_reject, - "ie->criticality != F1AP_Criticality_reject\n"); - AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID, - "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); - TransactionId=ie->value.choice.TransactionID; - LOG_D(F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n", - TransactionId); - break; - case F1AP_ProtocolIE_ID_id_gNB_CU_Name: - AssertFatal(ie->criticality == F1AP_Criticality_ignore, - "ie->criticality != F1AP_Criticality_ignore\n"); - AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name, - "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); - F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); - memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size); - F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0'; - LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", - F1AP_SETUP_RESP (msg_p).gNB_CU_name); - break; - case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: - AssertFatal(ie->criticality == F1AP_Criticality_reject, - "ie->criticality != F1AP_Criticality_reject\n"); - AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List, - "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n"); - num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; - LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); - for (int i=0;i<num_cells_to_activate;i++) { - - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *) ie->value.choice.Cells_to_be_Activated_List.list.array[i]; - - AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item, - "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); - AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject, - "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); - AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, - "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); - - cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; - - TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]); - AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n"); - LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", - cell->nRCGI.nRCellIdentity.buf[0], - cell->nRCGI.nRCellIdentity.buf[1], - cell->nRCGI.nRCellIdentity.buf[2], - cell->nRCGI.nRCellIdentity.buf[3], - cell->nRCGI.nRCellIdentity.buf[4]); - BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, - F1AP_SETUP_RESP (msg_p).nr_cellid[i]); - F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI; - - F1AP_ProtocolExtensionContainer_160P9_t *ext = (F1AP_ProtocolExtensionContainer_160P9_t *)cell->iE_Extensions; - AssertFatal(ext!=NULL,"Extension for SI is null\n"); - F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; - AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - LOG_D(F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", - i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], - F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]); - for (int si =0;si < ext->list.count;si++) { - size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; - F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; - LOG_D(F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, si, size); - F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); - - memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si], - (void*)ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.buf, - F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); - } - } - break; - } - } - AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); - AssertFatal(num_cells_to_activate>0,"No cells activated\n"); - F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; - - for (int i=0;i<num_cells_to_activate;i++) - AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i); - - MSC_LOG_RX_MESSAGE( - MSC_F1AP_DU, - MSC_F1AP_CU, - 0, - 0, - MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - assoc_id); - - LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", + LOG_D(F1AP, "DU_handle_F1_SETUP_RESPONSE\n"); + + AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome, + "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); + AssertFatal(pdu->choice.successfulOutcome->procedureCode == F1AP_ProcedureCode_id_F1Setup, + "pdu->choice.successfulOutcome->procedureCode != F1AP_ProcedureCode_id_F1Setup\n"); + AssertFatal(pdu->choice.successfulOutcome->criticality == F1AP_Criticality_reject, + "pdu->choice.successfulOutcome->criticality != F1AP_Criticality_reject\n"); + AssertFatal(pdu->choice.successfulOutcome->value.present == F1AP_SuccessfulOutcome__value_PR_F1SetupResponse, + "pdu->choice.successfulOutcome->value.present != F1AP_SuccessfulOutcome__value_PR_F1SetupResponse\n"); + + F1AP_F1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.F1SetupResponse; + + + F1AP_F1SetupResponseIEs_t *ie; + int TransactionId = -1; + int num_cells_to_activate = 0; + F1AP_Cells_to_be_Activated_List_Item_t *cell; + + MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_SETUP_RESP); + + LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", + in->protocolIEs.list.count); + for (int i=0;i < in->protocolIEs.list.count; i++) { + ie = in->protocolIEs.list.array[i]; + switch (ie->id) { + case F1AP_ProtocolIE_ID_id_TransactionID: + AssertFatal(ie->criticality == F1AP_Criticality_reject, + "ie->criticality != F1AP_Criticality_reject\n"); + AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID, + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); + TransactionId=ie->value.choice.TransactionID; + LOG_D(F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n", + TransactionId); + break; + case F1AP_ProtocolIE_ID_id_gNB_CU_Name: + AssertFatal(ie->criticality == F1AP_Criticality_ignore, + "ie->criticality != F1AP_Criticality_ignore\n"); + AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name, + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); + F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); + memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size); + F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0'; + LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", + F1AP_SETUP_RESP (msg_p).gNB_CU_name); + break; + case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version: + LOG_D(F1AP, "F1AP: Received GNB-CU-RRC-Version, ignoring\n"); + break; + case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: + { + AssertFatal(ie->criticality == F1AP_Criticality_reject, + "ie->criticality != F1AP_Criticality_reject\n"); + AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List, + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n"); + num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; + LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); + for (int i=0;i<num_cells_to_activate;i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *) ie->value.choice.Cells_to_be_Activated_List.list.array[i]; + + AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item, + "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); + AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject, + "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); + AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, + "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); + + cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; + + TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc_digit_length); + + LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", + cell->nRCGI.nRCellIdentity.buf[0], + cell->nRCGI.nRCellIdentity.buf[1], + cell->nRCGI.nRCellIdentity.buf[2], + cell->nRCGI.nRCellIdentity.buf[3], + cell->nRCGI.nRCellIdentity.buf[4]); + BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid); + F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions; + if (ext==NULL) continue; + + for (int cnt=0;cnt<ext->list.count;cnt++) { + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt]; + switch (cells_to_be_activated_list_itemExtIEs->id) { + /* + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING: + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List + */ + case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: + { + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0; + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; + AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); + LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", + i, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI); + for (int si = 0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) { + F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; + size_t size = sib_item->sIBmessage.size; + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si] = size; + LOG_D(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size); + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si]); + memcpy((void*)F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si], + (void*)sib_item->sIBmessage.buf, + size); + } + break; + } + case F1AP_ProtocolIE_ID_id_AvailablePLMNList: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + default: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id); + break; + } + } // for (cnt=... + } // for (cells_to_activate... + break; + } // case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List + + default: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n", (int)ie->id); + break; + } // switch ie + } // for IE + AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); + LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); + F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; + // tmp + // F1AP_SETUP_RESP (msg_p).num_SI[0] = 1; + for (int i=0;i<num_cells_to_activate;i++) + AssertFatal(F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI > 0, "System Information %d is missing",i); + + MSC_LOG_RX_MESSAGE( + MSC_F1AP_DU, + MSC_F1AP_CU, + 0, + 0, + MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + assoc_id); + + if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { + LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to GNB_APP with assoc_id (%d->%d)\n", assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); - itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + } else { + LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + } - return 0; + return 0; } // SETUP FAILURE @@ -553,6 +617,26 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { LOG_E(F1AP, "DU_handle_F1_SETUP_FAILURE\n"); + + F1AP_F1SetupFailure_t *out; + F1AP_F1SetupFailureIEs_t *ie; + + out = &pdu->choice.unsuccessfulOutcome->value.choice.F1SetupFailure; + + /* Transaction ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, + F1AP_ProtocolIE_ID_id_TransactionID, true); + + /* Cause */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, + F1AP_ProtocolIE_ID_id_Cause, true); + + if(0) { + /* TimeToWait */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, + F1AP_ProtocolIE_ID_id_TimeToWait, true); + } + return 0; } @@ -635,8 +719,12 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - (const char *) &f1ap_setup_req->tac[i], + uint8_t fiveGS_TAC[3]; + fiveGS_TAC[0] = ((uint8_t*)&f1ap_setup_req->tac[i])[2]; + fiveGS_TAC[1] = ((uint8_t*)&f1ap_setup_req->tac[i])[1]; + fiveGS_TAC[2] = ((uint8_t*)&f1ap_setup_req->tac[i])[0]; + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, + (const char *)fiveGS_TAC, 3); /* - Configured_EPS_TAC */ @@ -647,17 +735,11 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, 2); } - /* - broadcast PLMNs */ - int maxnoofBPLMNS = 1; - for (i=0; - i<maxnoofBPLMNS; - i++) { - /* > PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; @@ -803,7 +885,8 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + served_cell_information.fiveGS_TAC=calloc(1,sizeof(*served_cell_information.fiveGS_TAC)); + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, (const char *) &f1ap_setup_req->tac[i], 3); @@ -815,17 +898,12 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, 2); } - /* - broadcast PLMNs */ - int maxnoofBPLMNS = 1; - for (i=0; - i<maxnoofBPLMNS; - i++) { - /* > PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + + // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; @@ -963,45 +1041,9 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ - /* c5. Active_Cells_List */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Active_Cells_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Active_Cells_List; - - for (i=0; - i<1; - i++) { - // - F1AP_Active_Cells_ItemIEs_t *active_cells_item_ies; - active_cells_item_ies = (F1AP_Active_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_Active_Cells_ItemIEs_t)); - active_cells_item_ies->id = F1AP_ProtocolIE_ID_id_Active_Cells_Item; - active_cells_item_ies->criticality = F1AP_Criticality_reject; - active_cells_item_ies->value.present = F1AP_Active_Cells_ItemIEs__value_PR_Active_Cells_Item; - - F1AP_Active_Cells_Item_t active_cells_item; - memset((void *)&active_cells_item, 0, sizeof(F1AP_Active_Cells_Item_t)); - - /* 3.1 oldNRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); - active_cells_item.nRCGI = nRCGI; - - /* ADD */ - active_cells_item_ies->value.choice.Active_Cells_Item = active_cells_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Active_Cells_List.list, - active_cells_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 gNB-DU CONFIGURATION UPDATE\n"); return -1; } @@ -1029,17 +1071,221 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + + LOG_D(F1AP, "DU_handle_gNB_CU_CONFIGURATION_UPDATE\n"); + + AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_initiatingMessage, + "pdu->present != F1AP_F1AP_PDU_PR_initiatingMessage\n"); + AssertFatal(pdu->choice.initiatingMessage->procedureCode == F1AP_ProcedureCode_id_gNBCUConfigurationUpdate, + "pdu->choice.initiatingMessage->procedureCode != F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n"); + AssertFatal(pdu->choice.initiatingMessage->criticality == F1AP_Criticality_reject, + "pdu->choice.initiatingMessage->criticality != F1AP_Criticality_reject\n"); + AssertFatal(pdu->choice.initiatingMessage->value.present == F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate, + "pdu->choice.initiatingMessage->value.present != F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate\n"); + + F1AP_GNBCUConfigurationUpdate_t *in = &pdu->choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; + + + F1AP_GNBCUConfigurationUpdateIEs_t *ie; + int TransactionId = -1; + int num_cells_to_activate = 0; + F1AP_Cells_to_be_Activated_List_Item_t *cell; + + MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); + + LOG_D(F1AP, "F1AP: gNB_CU_Configuration_Update: protocolIEs.list.count %d\n", + in->protocolIEs.list.count); + for (int i=0;i < in->protocolIEs.list.count; i++) { + ie = in->protocolIEs.list.array[i]; + switch (ie->id) { + case F1AP_ProtocolIE_ID_id_TransactionID: + AssertFatal(ie->criticality == F1AP_Criticality_reject, + "ie->criticality != F1AP_Criticality_reject\n"); + AssertFatal(ie->value.present == F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID, + "ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID\n"); + TransactionId=ie->value.choice.TransactionID; + LOG_D(F1AP, "F1AP: GNB-CU-ConfigurationUpdate: TransactionId %d\n", + TransactionId); + break; + case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: + { + AssertFatal(ie->criticality == F1AP_Criticality_reject, + "ie->criticality != F1AP_Criticality_reject\n"); + AssertFatal(ie->value.present == F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List, + "ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List\n"); + num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; + LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); + for (int i=0;i<num_cells_to_activate;i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *) ie->value.choice.Cells_to_be_Activated_List.list.array[i]; + + AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item, + "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); + AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject, + "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); + AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, + "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); + + cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; + + TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc_digit_length); + + LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", + cell->nRCGI.nRCellIdentity.buf[0], + cell->nRCGI.nRCellIdentity.buf[1], + cell->nRCGI.nRCellIdentity.buf[2], + cell->nRCGI.nRCellIdentity.buf[3], + cell->nRCGI.nRCellIdentity.buf[4]); + BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid); + F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions; + + if (ext==NULL) continue; + + for (int cnt=0;cnt<ext->list.count;cnt++) { + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt]; + switch (cells_to_be_activated_list_itemExtIEs->id) { + /* + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING: + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List + */ + case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: + { + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0; + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; + AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); + LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", + i, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI); + for (int si = 0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) { + F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; + size_t size = sib_item->sIBmessage.size; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si] = size; + LOG_D(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size); + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si]); + memcpy((void*)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si], + (void*)sib_item->sIBmessage.buf, + size); + } + break; + } + case F1AP_ProtocolIE_ID_id_AvailablePLMNList: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + default: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id); + break; + } + } // for (cnt=... + } // for (cells_to_activate... + break; + } // case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List + + default: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n", (int)ie->id); + break; + } // switch ie + } // for IE + AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); + LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).num_cells_to_activate = num_cells_to_activate; + + MSC_LOG_RX_MESSAGE( + MSC_F1AP_DU, + MSC_F1AP_CU, + 0, + 0, + MSC_AS_TIME_FMT" DU_handle_GNB_CU_CONFIGURATION_UPDATE initiatingMessage assoc_id %d", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + assoc_id); + + if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { + LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to GNB_APP with assoc_id (%d->%d)\n", + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + } else { + LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to ENB_APP with assoc_id (%d->%d)\n", + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + } + + return 0; } int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { - AssertFatal(1==0,"Not implemented yet\n"); + f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure) { + AssertFatal(1==0,"received gNB CU CONFIGURATION UPDATE FAILURE with cause %d\n", + GNBCUConfigurationUpdateFailure->cause); } int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); + f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge) { + + AssertFatal(GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated == 0, + "%d cells failed to activate\n", + GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated); + + AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_to_setup == 0, + "%d TNLAssociations to setup, handle this ...\n", + GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_to_setup); + + + AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed == 0, + "%d TNLAssociations failed\n", + GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed); + + AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs == 0, + "%d DedicatedSIDeliveryNeededUEs\n", + GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs); + + F1AP_F1AP_PDU_t pdu; + uint8_t *buffer; + uint32_t len; + + /* Create */ + /* 0. pdu Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge; + F1AP_GNBCUConfigurationUpdateAcknowledge_t *out = &pdu.choice.successfulOutcome->value.choice.GNBCUConfigurationUpdateAcknowledge; + + /* mandatory */ + /* c1. Transaction ID (integer value)*/ + F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *ie = (F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + LOG_E(F1AP, "Failed to encode GNB-DU-Configuration-Update-Acknowledge\n"); + return -1; + } + + du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); + + + + return 0; } diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index 941b86a6d4228d7e61539c5de198178de363471e..f15decb6f566c7f3d49b283fda569be6c2f10680 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -98,10 +98,10 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, F1AP_F1AP_PDU_t *pdu); int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure); + f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure); int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge); + f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge); /* diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index ee096337ddb508ca0ed6ec4f24a444976f4a35ac..23e6b2921755c1227ccc4d1f0580e821bccfaf4f 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -42,13 +42,19 @@ #include "LTE_DL-DCCH-Message.h" #include "LTE_UL-DCCH-Message.h" +#include "NR_DL-CCCH-Message.h" +#include "NR_UL-CCCH-Message.h" +#include "NR_DL-DCCH-Message.h" +#include "NR_UL-DCCH-Message.h" // for SRB1_logicalChannelConfig_defaultValue #include "rrc_extern.h" #include "common/ran_context.h" #include "rrc_eNB_UE_context.h" +#include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "asn1_msg.h" #include "intertask_interface.h" +#include "LAYER2/NR_MAC_gNB/mac_proto.h" // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which @@ -61,13 +67,25 @@ extern f1ap_setup_req_t *f1ap_du_data; extern RAN_CONTEXT_t RC; extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; +uint8_t du_ccch_flag = 1; +int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* DL RRC Message Transfer */ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { + + if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { + LOG_I(F1AP, "node is gNB DU, call DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n"); + DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance, assoc_id, stream, pdu); + return 0; + } + LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); F1AP_DLRRCMessageTransfer_t *container; @@ -161,10 +179,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) { - case F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP: + case F1AP_RAT_FrequencyPriorityInformation_PR_eNDC: //subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP; break; - case F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority: + case F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN: //rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; break; default: @@ -455,35 +473,35 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } rrc_mac_config_req_eNB( - ctxt.module_id, - 0,0,0,0,0,0, - 0, - ue_context_p->ue_context.rnti, - (LTE_BCCH_BCH_Message_t *) NULL, - (LTE_RadioResourceConfigCommonSIB_t *) NULL, - (LTE_RadioResourceConfigCommonSIB_t *) NULL, - physicalConfigDedicated, - (LTE_SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, - (LTE_MeasObjectToAddMod_t **) NULL, - mac_MainConfig, - DRB2LCHAN[i], - DRB_configList->list.array[i]->logicalChannelConfig, - measGapConfig, - (LTE_TDD_Config_t *) NULL, - NULL, - (LTE_SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL - , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL, - (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL, - 0, - (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL, - (LTE_SchedulingInfo_MBMS_r14_t *) NULL, - (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL, - (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL, - (LTE_MBSFN_AreaInfoList_r9_t *) NULL, - (LTE_MBSFNAreaConfiguration_r9_t*) NULL - ); + ctxt.module_id, + 0,0,0,0,0,0, + 0, + ue_context_p->ue_context.rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, + physicalConfigDedicated, + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (LTE_MeasObjectToAddMod_t **) NULL, + mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + measGapConfig, + (LTE_TDD_Config_t *) NULL, + NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL, + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL, + 0, + (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL, + (LTE_SchedulingInfo_MBMS_r14_t *) NULL, + (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL, + (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL, + (LTE_MBSFN_AreaInfoList_r9_t *) NULL, + (LTE_MBSFNAreaConfiguration_r9_t*) NULL + ); } } else { // remove LCHAN from MAC/PHY @@ -765,7 +783,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 UL RRC MESSAGE TRANSFER\n"); return -1; } @@ -780,7 +798,9 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int UE_id, rnti_t rntiP, const uint8_t *sduP, - sdu_size_t sdu_lenP) { + sdu_size_t sdu_lenP, + const uint8_t *sdu2P, + sdu_size_t sdu2_lenP) { F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransferIEs_t *ie; @@ -836,7 +856,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_C_RNTI; - C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + ie->value.choice.C_RNTI=rntiP; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -850,29 +870,39 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, /* optional */ /* c5. DUtoCURRCContainer */ - if (0) { + if (sdu2P) { ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, "dummy_val", - strlen("dummy_val")); + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, + sdu2P, + sdu2_lenP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } + } + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 INITIAL UL RRC MESSAGE TRANSFER\n"); return -1; } - - struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); - ue_context_p->ue_id_rnti = rntiP; - ue_context_p->ue_context.rnti = rntiP; - ue_context_p->ue_context.random_ue_identity = rntiP; - ue_context_p->ue_context.Srb0.Active = 1; - RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); + if (RC.nrrrc[module_idP]->node_type == ngran_gNB_DU) { + struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]); + ue_context_p->ue_id_rnti = rntiP; + ue_context_p->ue_context.rnti = rntiP; + ue_context_p->ue_context.random_ue_identity = rntiP; + ue_context_p->ue_context.Srb0.Active = 1; + RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p); + } else { + struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); + ue_context_p->ue_id_rnti = rntiP; + ue_context_p->ue_context.rnti = rntiP; + ue_context_p->ue_context.random_ue_identity = rntiP; + ue_context_p->ue_context.Srb0.Active = 1; + RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); + } du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; @@ -884,4 +914,629 @@ void init_f1ap_du_ue_inst (void) { memset(f1ap_du_inst, 0, sizeof(f1ap_du_inst)); } +int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, + const f1ap_ul_rrc_message_t *msg) { + const rnti_t rnti = msg->rnti; + + F1AP_F1AP_PDU_t pdu; + F1AP_ULRRCMessageTransfer_t *out; + F1AP_ULRRCMessageTransferIEs_t *ie; + + uint8_t *buffer = NULL; + uint32_t len; + + + LOG_I(F1AP, "[DU %ld] %s: size %d UE RNTI %x in SRB %d\n", + instance, __func__, msg->rrc_container_length, rnti, msg->srb_id); + + //LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, msg->rrc_container_length); + //for (int i = 0;i < msg->rrc_container_length; i++) + // printf("%02x ", msg->rrc_container[i]); + //printf("\n"); + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; + out = &pdu.choice.initiatingMessage->value.choice.ULRRCMessageTransfer; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; + + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], rnti); + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], rnti); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. SRBID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; + ie->value.choice.SRBID = msg->srb_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // issue in here + /* mandatory */ + /* c4. RRCContainer */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, + (const char *) msg->rrc_container, + msg->rrc_container_length); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + if (msg->srb_id == 1 || msg->srb_id == 2) { + struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], rnti); + + + NR_UL_DCCH_Message_t* ul_dcch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_UL_DCCH_Message, + (void**)&ul_dcch_msg, + &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header + msg->rrc_container_length, 0, 0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); + /* for rfsim, because UE send RRCSetupRequest in SRB1 */ + // NR_UL_CCCH_Message_t *ul_ccch_msg; + // dec_rval = uper_decode(NULL, + // &asn_DEF_NR_UL_CCCH_Message, + // (void**)&ul_ccch_msg, + // &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header + // msg->rrc_container_length, 0, 0); + // if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + // LOG_E(F1AP, " Failed to decode UL-CCCH (%zu bytes)\n",dec_rval.consumed); + // } else { + // LOG_I(F1AP, "decode UL-CCCH success \n"); + // LOG_I(F1AP, "Received message: present %d and c1 present %d\n", + // ul_ccch_msg->message.present, ul_ccch_msg->message.choice.c1->present); + + // if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) { + // if (ul_ccch_msg->message.choice.c1->present == NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest) { + // LOG_I(F1AP, "[MSG] RRC Setup Request\n"); + + // } + // } + // } + } + else + LOG_I(F1AP, "Received message: present %d and c1 present %d\n", + ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1->present); + + if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) { + + switch (ul_dcch_msg->message.choice.c1->present) { + case NR_UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ + break; + + case NR_UL_DCCH_MessageType__c1_PR_measurementReport: + break; + + case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete: + LOG_I(F1AP, "[MSG] RRC UL rrcReconfigurationComplete\n"); + + /* CDRX: activated when RRC Connection Reconfiguration Complete is received */ +#if(0) + int UE_id_mac = find_nr_UE_id(instance, rnti); + + if (UE_id_mac == -1) { + LOG_E(F1AP, "Can't find UE_id(MAC) of UE rnti %x\n", rnti); + break; + } + + UE_sched_ctrl_t *UE_scheduling_control = &(RC.nrmac[instance]->UE_info.UE_sched_ctrl[UE_id_mac]); + + if (UE_scheduling_control->cdrx_waiting_ack == TRUE) { + UE_scheduling_control->cdrx_waiting_ack = FALSE; + UE_scheduling_control->cdrx_configured = TRUE; // Set to TRUE when RRC Connection Reconfiguration Complete is received + LOG_I(F1AP, "CDRX configuration activated after RRC Connection Reconfiguration Complete reception\n"); + } + /* End of CDRX processing */ +#endif + break; + + case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete: + LOG_I(F1AP, "[MSG] RRC UL rrcSetupComplete \n"); + + if(!ue_context_p){ + LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti); + + } else { + LOG_I(F1AP, "Processing RRCSetupComplete UE %x\n", rnti); + ue_context_p->ue_context.Status = NR_RRC_CONNECTED; + } + break; + + case NR_UL_DCCH_MessageType__c1_PR_rrcReestablishmentComplete: + LOG_I(F1AP, "[MSG] RRC ReestablishmentComplete \n"); + break; + + case NR_UL_DCCH_MessageType__c1_PR_rrcResumeComplete: + LOG_I(F1AP, "[MSG] RRC ResumeComplete \n"); + break; + + case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete: + LOG_I(F1AP, "[MSG] RRC securityModeComplete \n"); + break; + + case NR_UL_DCCH_MessageType__c1_PR_securityModeFailure: + LOG_I(F1AP, "[MSG] RRC securityModeFailure \n"); + break; + + case NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + LOG_I(F1AP, "[MSG] RRC UL Information Transfer \n"); + break; + + case NR_UL_DCCH_MessageType__c1_PR_locationMeasurementIndication: + break; + + case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + LOG_I(F1AP, "[MSG] RRC ueCapabilityInformation \n"); + break; + + case NR_UL_DCCH_MessageType__c1_PR_ueAssistanceInformation: + break; + + case NR_UL_DCCH_MessageType__c1_PR_failureInformation: + break; + + case NR_UL_DCCH_MessageType__c1_PR_scgFailureInformation: + break; + + case NR_UL_DCCH_MessageType__c1_PR_scgFailureInformationEUTRA: + break; + + default: + LOG_E(NR_RRC, "Unknown UL DCCH message type, present %d \n", ul_dcch_msg->message.choice.c1->present); + break; + } + } + } + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + LOG_E(F1AP, "Failed to encode F1 UL RRC MESSAGE TRANSFER \n"); + return -1; + } + + du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); + return 0; +} + +/* DL NR RRC Message Transfer */ +int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { + LOG_D(F1AP, "DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n"); + + F1AP_DLRRCMessageTransfer_t *container; + F1AP_DLRRCMessageTransferIEs_t *ie; + + uint64_t cu_ue_f1ap_id; + uint64_t du_ue_f1ap_id; + uint64_t srb_id; + int executeDuplication; + sdu_size_t rrc_dl_sdu_len; + //uint64_t subscriberProfileIDforRFP; + //uint64_t rAT_FrequencySelectionPriority; + + DevAssert(pdu != NULL); + + if (stream != 0) { + LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", + assoc_id, stream); + return -1; + } + + container = &pdu->choice.initiatingMessage->value.choice.DLRRCMessageTransfer; + + + /* GNB_CU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + LOG_D(F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer + + if (f1ap_du_add_cu_ue_id(&f1ap_du_inst[instance],du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { + LOG_E(F1AP, "Failed to find the F1AP UID \n"); + //return -1; + } + + /* optional */ + /* oldgNB_DU_UE_F1AP_ID */ + if (0) { + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, true); + } + + /* mandatory */ + /* SRBID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SRBID, true); + srb_id = ie->value.choice.SRBID; + LOG_D(F1AP, "srb_id %lu \n", srb_id); + + /* optional */ + /* ExecuteDuplication */ + if (0) { + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); + executeDuplication = ie->value.choice.ExecuteDuplication; + LOG_D(F1AP, "ExecuteDuplication %d \n", executeDuplication); + } + + // issue in here + /* mandatory */ + /* RRC Container */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RRCContainer, true); + // BK: need check + // create an ITTI message and copy SDU + + // message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; + // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + // ccch_sdu_len); + + //LOG_I(F1AP, "%s() RRCContainer size %lu: ", __func__, ie->value.choice.RRCContainer.size); + //for (int i = 0;i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", ie->value.choice.RRCContainer.buf[i]); + //printf("\n"); + + /* optional */ + /* RAT_FrequencyPriorityInformation */ + if (0) { + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); + + switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) { + case F1AP_RAT_FrequencyPriorityInformation_PR_eNDC: + //subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP; + break; + case F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN: + //rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; + break; + default: + LOG_W(F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n"); + break; + } + } + + // decode RRC Container and act on the message type + AssertFatal(srb_id<3,"illegal srb_id\n"); + protocol_ctxt_t ctxt; + ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id); + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + + struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_get_ue_context( + RC.nrrrc[ctxt.module_id], + ctxt.rnti); + + gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; + if (srb_id == 0) { + NR_DL_CCCH_Message_t* dl_ccch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_DL_CCCH_Message, + (void**)&dl_ccch_msg, + ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len,0,0); + AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n"); + switch (dl_ccch_msg->message.choice.c1->present) { + + case NR_DL_CCCH_MessageType__c1_PR_NOTHING: + + LOG_I(F1AP, "Received PR_NOTHING on DL-CCCH-Message\n"); + break; + + case NR_DL_CCCH_MessageType__c1_PR_rrcReject: + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received RRCReject\n"); + break; + + case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: + { + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received RRCSetup DU_ID %lx/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + // Get configuration + + NR_RRCSetup_t* rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup; + AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n"); + NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup; + + ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList; + AssertFatal(rrcSetup_ies->masterCellGroup.buf!=NULL,"masterCellGroup is null\n"); + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_CellGroupConfig, + (void**)&ue_context_p->ue_context.masterCellGroup, + rrcSetup_ies->masterCellGroup.buf, + rrcSetup_ies->masterCellGroup.size,0,0); + AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n"); + + // configure MAC + rrc_mac_config_req_gNB(ctxt.module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + NULL, + 0, + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.masterCellGroup + ); + // rrc_rlc_config_asn1_req + nr_rrc_rlc_config_asn1_req(&ctxt, + ue_context_p->ue_context.SRB_configList, + NULL, + NULL, + NULL, + NULL, + NULL); + // This should be somewhere in the f1ap_cudu_ue_inst_t + /*int macrlc_instance = 0; + + rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id); + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[macrlc_instance],rnti); + */ + gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + + memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, + (void*)ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size + + ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; + + // NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL; + // if (cellGroupConfig->mac_CellGroupConfig) + // mac_CellGroupConfig = cellGroupConfig->mac_CellGroupConfig; + + // rrc_mac_config_req_gNB + break; + } // case + + case NR_DL_CCCH_MessageType__c1_PR_spare2: + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received spare2\n"); + break; + + case NR_DL_CCCH_MessageType__c1_PR_spare1: + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received spare1\n"); + break; + + default: + AssertFatal(1==0, + "Unknown message\n"); + break; + }// switch case + return(0); + } else if (srb_id == 1) { + + NR_DL_DCCH_Message_t* dl_dcch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_DL_DCCH_Message, + (void**)&dl_dcch_msg, + &ie->value.choice.RRCContainer.buf[2], // buf[0] includes the pdcp header + rrc_dl_sdu_len-6,0,0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); + else + LOG_D(F1AP, "Received message: present %d and c1 present %d\n", + dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1->present); + + if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { + switch (dl_dcch_msg->message.choice.c1->present) { + case NR_DL_DCCH_MessageType__c1_PR_NOTHING: + LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); + return 0; + + case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: + // handle RRCReconfiguration + LOG_I(F1AP, + "Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration DU_ID %lx/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + + NR_RRCReconfiguration_t* rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration; + + if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { + NR_RRCReconfiguration_IEs_t* rrcReconfiguration_ies = + rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; + + if (rrcReconfiguration_ies->measConfig != NULL) { + LOG_I(F1AP, "Measurement Configuration is present\n"); + } + + if (rrcReconfiguration_ies->radioBearerConfig) { + LOG_I(F1AP, "Radio Resource Configuration is present\n"); + long drb_id; + int i; + NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList; + NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList; + // NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList; + + // rrc_rlc_config_asn1_req + + if (SRB_configList != NULL) { + for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { + if (SRB_configList->list.array[i]->srb_Identity == 1 ){ + ue_context_p->ue_context.Srb1.Active=1; + } + else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { + ue_context_p->ue_context.Srb2.Active=1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); + } else { + LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + SRB_configList->list.array[i]->srb_Identity); + } + } + } + + if (DRB_configList != NULL) { + for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) { + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + LOG_I(F1AP, + "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n", + ctxt.module_id, + ctxt.rnti, + (int)DRB_configList->list.array[i]->drb_Identity); + // (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { + ue_context_p->ue_context.DRB_active[drb_id] = 1; + + // logicalChannelIdentity + // rrc_mac_config_req_eNB + } + + } else { // remove LCHAN from MAC/PHY + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } + } + } + } + } + break; + case NR_DL_DCCH_MessageType__c1_PR_rrcResume: + LOG_I(F1AP,"Received rrcResume\n"); + break; + case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: + LOG_I(F1AP,"Received rrcRelease\n"); + break; + case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: + LOG_I(F1AP,"Received rrcReestablishment\n"); + break; + case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: + LOG_I(F1AP,"Received securityModeCommand\n"); + break; + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + LOG_I(F1AP, "Received dlInformationTransfer\n"); + break; + case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); + break; + case NR_DL_DCCH_MessageType__c1_PR_counterCheck: + LOG_I(F1AP, "Received counterCheck\n"); + break; + case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: + case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: + case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: + case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: + case NR_DL_DCCH_MessageType__c1_PR_spare3: + case NR_DL_DCCH_MessageType__c1_PR_spare2: + case NR_DL_DCCH_MessageType__c1_PR_spare1: + break; + } + } + } + else if (srb_id == 2) { + // TODO + } + + LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id); + + +// rlc_op_status_t rlc_status; +// boolean_t ret = TRUE; + mem_block_t *pdcp_pdu_p = NULL; + pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); + + //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); + //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", ie->value.choice.RRCContainer.buf[i]); + + //printf (", PDCP PDU size %d:", rrc_dl_sdu_len); + //for (int i=0;i<rrc_dl_sdu_len;i++) printf("%2x ",pdcp_pdu_p->data[i]); + //printf("\n"); + + if (pdcp_pdu_p != NULL) { + memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); + + /* for rfsim */ + du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, rrc_dl_sdu_len, pdcp_pdu_p); + // rlc_status = rlc_data_req(&ctxt + // , 1 + // , MBMS_FLAG_NO + // , srb_id + // , 0 + // , 0 + // , rrc_dl_sdu_len + // , pdcp_pdu_p + // ,NULL + // ,NULL + // ); + // switch (rlc_status) { + // case RLC_OP_STATUS_OK: + // //LOG_I(F1AP, "Data sending request over RLC succeeded!\n"); + // ret=TRUE; + // break; + + // case RLC_OP_STATUS_BAD_PARAMETER: + // LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + // ret= FALSE; + // break; + + // case RLC_OP_STATUS_INTERNAL_ERROR: + // LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + // ret= FALSE; + // break; + + // case RLC_OP_STATUS_OUT_OF_RESSOURCES: + // LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + // ret= FALSE; + // break; + + // default: + // LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + // ret= FALSE; + // break; + // } // switch case + // return ret; + } // if pdcp_pdu_p + + return 0; +} diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 1406e48f3d3a76320a2d4ca99b7fc1b5cbdd6bd6..0bb6371fe80115db541fa7caf491c35d92f5bedc 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -42,12 +42,15 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_F1AP_PDU_t *pdu); int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); +int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, int UE_id, rnti_t rntiP, const uint8_t *sduP, - sdu_size_t sdu_lenP); + sdu_size_t sdu_lenP, + const uint8_t *sdu2P, + sdu_size_t sdu2_lenP); #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index b66141250b5f117d22b4e58986f7106733eb37a3..726d5629f8ad8a722a69b1d82bcc0c4ab70385b0 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -103,10 +103,10 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat /* setup parameters for F1U and start the server */ const cudu_params_t params = { - .local_ipv4_address = RC.mac[instance]->eth_params_n.my_addr, - .local_port = RC.mac[instance]->eth_params_n.my_portd, - .remote_ipv4_address = RC.mac[instance]->eth_params_n.remote_addr, - .remote_port = RC.mac[instance]->eth_params_n.remote_portd + .local_ipv4_address = RC.nrmac[instance]->eth_params_n.my_addr, + .local_port = RC.nrmac[instance]->eth_params_n.my_portd, + .remote_ipv4_address = RC.nrmac[instance]->eth_params_n.remote_addr, + .remote_port = RC.nrmac[instance]->eth_params_n.remote_portd }; AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); @@ -159,6 +159,14 @@ void *F1AP_DU_task(void *arg) { du_task_send_sctp_association_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; + case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE: + DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(received_msg)); + break; + case F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE: + DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(received_msg)); + break; case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon @@ -175,10 +183,27 @@ void *F1AP_DU_task(void *arg) { &received_msg->ittiMsg.sctp_data_ind); break; + case F1AP_INITIAL_UL_RRC_MESSAGE: // to rrc + LOG_I(F1AP, "DU Task Received F1AP_INITIAL_UL_RRC_MESSAGE\n"); + + f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg); + DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti, + msg->rrc_container, + msg->rrc_container_length, + msg->du2cu_rrc_container, + msg->du2cu_rrc_container_length + ); + break; + case F1AP_UL_RRC_MESSAGE: // to rrc LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); - DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_UL_RRC_MESSAGE(received_msg)); + if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { + DU_send_UL_NR_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_UL_RRC_MESSAGE(received_msg)); + } else { + DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_UL_RRC_MESSAGE(received_msg)); + } break; case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 841c77eef5f906896ffb44af3cb51b33fef5c9ca..51bf7da32d59bd16a246da16fa169af704b67e12 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -91,7 +91,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); /* ServCellIndex */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_ServCellndex, true); + F1AP_ProtocolIE_ID_id_ServCellIndex, true); f1ap_ue_context_setup_req->servCellIndex = ie->value.choice.ServCellIndex; /* optional */ /* CellULConfigured */ @@ -118,41 +118,70 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* SRBs_ToBeSetup_List */ /* DRBs_ToBeSetup_List */ /* Decode DRBs_ToBeSetup_List */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); - f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count; - f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, - sizeof(f1ap_drb_to_be_setup_t)); - AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); - - for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { - f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; - F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; - drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; - drb_p->drb_id = drbs_tobesetup_item_p->dRBID; - /* TODO in the following, assume only one UP UL TNL is present. - * this matches/assumes OAI CU implementation, can be up to 2! */ - drb_p->up_ul_tnl_length = 1; - AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, - "no UL UP TNL Information in DRBs to be Setup list\n"); - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; - F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; - BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); - OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid); - - switch (drbs_tobesetup_item_p->rLCMode) { - case F1AP_RLCMode_rlc_am: - drb_p->rlc_mode = RLC_MODE_AM; - break; - - default: - drb_p->rlc_mode = RLC_MODE_TM; - break; + if(0) { + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); + f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, + sizeof(f1ap_drb_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, + "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); + + for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { + f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; + F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; + drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + drb_p->drb_id = drbs_tobesetup_item_p->dRBID; + /* TODO in the following, assume only one UP UL TNL is present. + * this matches/assumes OAI CU implementation, can be up to 2! */ + drb_p->up_ul_tnl_length = 1; + AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, + "no UL UP TNL Information in DRBs to be Setup list\n"); + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; + F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; + BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); + OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid); + + switch (drbs_tobesetup_item_p->rLCMode) { + case F1AP_RLCMode_rlc_am: + drb_p->rlc_mode = RLC_MODE_AM; + break; + + default: + drb_p->rlc_mode = RLC_MODE_TM; + break; + } } } + /* RRCContainer */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RRCContainer, false); + if (ie) { + /* correct here */ + f1ap_ue_context_setup_req->rrc_container = malloc(ie->value.choice.RRCContainer.size); + memcpy(f1ap_ue_context_setup_req->rrc_container, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); + } else { + LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); + } + + // AssertFatal(0, "check configuration, send to appropriate handler\n"); + + protocol_ctxt_t ctxt; + // ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); + ctxt.rnti = 0x1234; + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; - AssertFatal(0, "check configuration, send to appropriate handler\n"); + mem_block_t *pdcp_pdu_p = NULL; + pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__); + if (pdcp_pdu_p != NULL) { + memset(pdcp_pdu_p->data, 0, ie->value.choice.RRCContainer.size); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); + + /* for rfsim */ + du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p); + } return 0; } @@ -227,7 +256,8 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI; - C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + //C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + ie->value.choice.C_RNTI=rntiP; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -510,7 +540,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP RESPONSE\n"); return -1; } @@ -1016,7 +1046,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { srbs_failedToBeSetupMod_item.sRBID = 50L; srbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); srbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item = srbs_failedToBeSetupMod_item; ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetupMod_List.list, @@ -1047,7 +1077,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { drbs_failedToBeSetupMod_item.dRBID = 30L; drbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); drbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item = drbs_failedToBeSetupMod_item; ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetupMod_List.list, @@ -1083,7 +1113,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { scell_failedtoSetupMod_item.sCell_ID = nRCGI; scell_failedtoSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); scell_failedtoSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item = scell_failedtoSetupMod_item; ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetupMod_List.list, @@ -1114,7 +1144,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { drbs_failedToBeModified_item.dRBID = 30L; drbs_failedToBeModified_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); drbs_failedToBeModified_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item = drbs_failedToBeModified_item; ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeModified_List.list, @@ -1180,7 +1210,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 UE CONTEXT MODIFICATION RESPONSE\n"); return -1; } diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index e448690139f64ebb62a4a34394ffa29bf35d0683..1dbfd707c0f29b1518c6f84d7d4c901f5f1eda52 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -33,7 +33,7 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" -int asn1_encoder_xer_print = 0; +int asn1_encoder_xer_print = 1; /* static inline int f1ap_encode_initiating(f1ap_message *message, diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 45f76d3dabf08c2b71ef9f0024cc2d6014c1659f..5aca059ae40d297a607fb9779bac8993cb5b74ab 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -50,7 +50,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, DU_handle_F1_SETUP_FAILURE }, /* F1Setup */ { 0, 0, 0 }, /* ErrorIndication */ { 0, 0, 0 }, /* gNBDUConfigurationUpdate */ - { 0, 0, 0 }, /* gNBCUConfigurationUpdate */ + { DU_handle_gNB_CU_CONFIGURATION_UPDATE, CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE, CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE }, /* gNBCUConfigurationUpdate */ { DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0 }, /* UEContextSetup */ { DU_handle_UE_CONTEXT_RELEASE_COMMAND, CU_handle_UE_CONTEXT_RELEASE_COMPLETE, 0 }, /* UEContextRelease */ { 0, 0, 0 }, /* UEContextModification */ diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 67be560778b9848ffe29e254d75f788988b06be6..fd22e9273023542aa0376c551078dee85f10be80 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -47,7 +47,9 @@ #define CONFIG_STRING_L1_REMOTE_N_PORTD "remote_n_portd" #define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE "tr_n_preference" #define CONFIG_STRING_L1_PUSCH_PROC_THREADS "pusch_proc_threads" - +#define CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD "pucch0_dtx_threshold" +#define CONFIG_STRING_L1_PRACH_DTX_THRESHOLD "prach_dtx_threshold" +#define CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD "pusch_dtx_threshold" /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* L1 configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -62,7 +64,10 @@ {CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0} \ +{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:200, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \ } #define L1_CC_IDX 0 #define L1_TRANSPORT_N_PREFERENCE_IDX 1 @@ -74,6 +79,9 @@ #define L1_LOCAL_N_PORTD_IDX 7 #define L1_REMOTE_N_PORTD_IDX 8 #define L1_PUSCH_PROC_THREADS 9 +#define L1_PUCCH0_DTX_THRESHOLD 10 +#define L1_PRACH_DTX_THRESHOLD 11 +#define L1_PUSCH_DTX_THRESHOLD 12 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/MACRLC_nr_paramdef.h b/openair2/GNB_APP/MACRLC_nr_paramdef.h index 308af2eeb916b760f5643f19c0e84b4874d5dc7d..dd971801e91563a7aec052f085e3ecb2dfe0f3d4 100644 --- a/openair2/GNB_APP/MACRLC_nr_paramdef.h +++ b/openair2/GNB_APP/MACRLC_nr_paramdef.h @@ -55,7 +55,10 @@ #define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc" #define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd" #define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd" - +#define CONFIG_STRING_MACRLC_PUSCHTARGETSNRX10 "pusch_TargetSNRx10" +#define CONFIG_STRING_MACRLC_PUCCHTARGETSNRX10 "pucch_TargetSNRx10" +#define CONFIG_STRING_MACRLC_PUCCHFAILURETHRES "pucch_FailureThres" +#define CONFIG_STRING_MACRLC_PUSCHFAILURETHRES "pusch_FailureThres" /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* MacRLC configuration parameters */ @@ -79,6 +82,10 @@ {CONFIG_STRING_MACRLC_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ +{CONFIG_STRING_MACRLC_PUSCHTARGETSNRX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ +{CONFIG_STRING_MACRLC_PUCCHTARGETSNRX10, NULL, 0, iptr:NULL, defintval:150, TYPE_INT, 0}, \ +{CONFIG_STRING_MACRLC_PUCCHFAILURETHRES, NULL, 0, iptr:NULL, defintval:10, TYPE_INT, 0}, \ +{CONFIG_STRING_MACRLC_PUSCHFAILURETHRES, NULL, 0, iptr:NULL, defintval:10, TYPE_INT, 0}, \ } #define MACRLC_CC_IDX 0 #define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1 @@ -97,5 +104,9 @@ #define MACRLC_REMOTE_S_PORTC_IDX 14 #define MACRLC_LOCAL_S_PORTD_IDX 15 #define MACRLC_REMOTE_S_PORTD_IDX 16 +#define MACRLC_PUSCHTARGETSNRX10_IDX 17 +#define MACRLC_PUCCHTARGETSNRX10_IDX 18 +#define MACRLC_PUCCHFAILURETHRES_IDX 19 +#define MACRLC_PUSCHFAILURETHRES_IDX 20 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 1f1d076e9d2c002ee21cf74e8f18798fcd6b604d..70295b1c313ada7c60650c4106f9b5f8dcd08ece 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -141,6 +141,7 @@ #define GNB_CONFIG_STRING_PUCCHGROUPHOPPING "pucchGroupHopping" #define GNB_CONFIG_STRING_HOPPINGID "hoppingId" #define GNB_CONFIG_STRING_P0NOMINAL "p0_nominal" +#define GNB_CONFIG_STRING_PUCCHRES "pucch_ResourceCommon" #define GNB_CONFIG_STRING_INITIALULBWPK2_0 "initialULBWPk2_0" #define GNB_CONFIG_STRING_INITIALULBWPMAPPINGTYPE_0 "initialULBWPmappingType_0" #define GNB_CONFIG_STRING_INITIALULBWPSTARTSYMBOLANDLENGTH_0 "initialULBWPstartSymbolAndLength_0" @@ -211,6 +212,24 @@ #define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273} +/* Serving Cell Config Dedicated */ +#define GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED "servingCellConfigDedicated" +#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0 "dl_ptrsFreqDensity0_0" +#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0 "dl_ptrsFreqDensity1_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0 "dl_ptrsTimeDensity0_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0 "dl_ptrsTimeDensity1_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0 "dl_ptrsTimeDensity2_0" +#define GNB_CONFIG_STRING_DLPTRSEPRERATIO_0 "dl_ptrsEpreRatio_0" +#define GNB_CONFIG_STRING_DLPTRSREOFFSET_0 "dl_ptrsReOffset_0" +#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0 "ul_ptrsFreqDensity0_0" +#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0 "ul_ptrsFreqDensity1_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0 "ul_ptrsTimeDensity0_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0 "ul_ptrsTimeDensity1_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0 "ul_ptrsTimeDensity2_0" +#define GNB_CONFIG_STRING_ULPTRSREOFFSET_0 "ul_ptrsReOffset_0" +#define GNB_CONFIG_STRING_ULPTRSMAXPORTS_0 "ul_ptrsMaxPorts_0" +#define GNB_CONFIG_STRING_ULPTRSPOWER_0 "ul_ptrsPower_0" + /*--------------------------------------------------------------------------------------------------------------------*/ /* pdcch_ConfigSIB1 parameters */ /*--------------------------------------------------------------------------------------------------------------------*/ @@ -379,6 +398,7 @@ {GNB_CONFIG_STRING_PUCCHGROUPHOPPING, NULL,0,i64ptr:&scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_GroupHopping,defint64val:NR_PUCCH_ConfigCommon__pucch_GroupHopping_neither,TYPE_INT64,0},\ {GNB_CONFIG_STRING_HOPPINGID, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->hoppingId,defint64val:40,TYPE_INT64,0},\ {GNB_CONFIG_STRING_P0NOMINAL, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal,defint64val:1,TYPE_INT64,0},\ +{GNB_CONFIG_STRING_PUCCHRES, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon,defint64val:0,TYPE_INT64,0},\ {GNB_CONFIG_STRING_SSBPOSITIONSINBURSTPR,NULL,0,uptr:&scc->ssb_PositionsInBurst->present,defuintval:NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap,TYPE_UINT,0/*140*/}, \ {GNB_CONFIG_STRING_SSBPOSITIONSINBURST,NULL,0,u64ptr:&ssb_bitmap,defintval:0xff,TYPE_UINT64,0}, \ {GNB_CONFIG_STRING_REFERENCESUBCARRIERSPACING,NULL,0,i64ptr:&scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing,defint64val:NR_SubcarrierSpacing_kHz30,TYPE_INT64,0},\ @@ -395,6 +415,26 @@ {GNB_CONFIG_STRING_SSPBCHBLOCKPOWER,NULL,0,i64ptr:&scc->ss_PBCH_BlockPower,defint64val:20,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_MSG1SUBCARRIERSPACING,NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing,defintval:-1,TYPE_INT64,0}} +/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* Serving Cell Config Dedicated configuration parameters */ +/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ + +#define SCDPARAMS_DESC(scd) { \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[0],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[1],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[0],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[1],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[2],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSEPRERATIO_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio,defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSREOFFSET_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset,defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[0],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[1],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[0],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[1],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[2],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSREOFFSET_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset,defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSMAXPORTS_0,NULL,0,i64ptr:&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->maxNrofPorts,defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSPOWER_0,NULL,0,i64ptr:&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->ptrs_Power,defint64val:0,TYPE_INT64,0}} diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 77e456463266660ef8bf4202a37eb3aebba700a8..767a3c203be1b8f5e73a11a11e2d95c9c8590269 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -43,7 +43,9 @@ #include "sctp_eNB_task.h" #include "gtpv1u_eNB_task.h" #include "PHY/INIT/phy_init.h" - +#include "f1ap_cu_task.h" +#include "f1ap_du_task.h" +#include "nfapi/oai_integration/vendor_ext.h" extern unsigned char NB_gNB_INST; extern RAN_CONTEXT_t RC; @@ -61,7 +63,7 @@ static void configure_nr_rrc(uint32_t gnb_id) if (RC.nrrrc[gnb_id]) { RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); - + LOG_I(GNB_APP, "RRC starting with node type %d\n", RC.nrrrc[gnb_id]->node_type); LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n"); itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); @@ -82,26 +84,25 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, { if(NGAP_CONF_MODE){ ngap_register_gnb_req_t *ngap_register_gNB; //Type Temporarily reuse - - // note: there is an implicit relationship between the data structure and the message name + + // note: there is an implicit relationship between the data structure and the message name msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse RCconfig_NR_NG(msg_p, gnb_id); - - ngap_register_gNB = &NGAP_REGISTER_GNB_REQ(msg_p); //Message Temporarily reuse - LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx); + ngap_register_gNB = &NGAP_REGISTER_GNB_REQ(msg_p); //Message Temporarily reuse - itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); - } + LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx); + itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); + } if (gnb_id == 0) RCconfig_nr_gtpu(); + } - LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id)); + LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id)); - register_gnb_pending++; + register_gnb_pending++; } - } return register_gnb_pending; } @@ -126,7 +127,6 @@ static uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end) return register_gnb_x2_pending; } - /*------------------------------------------------------------------------------*/ void *gNB_app_task(void *args_p) { @@ -134,7 +134,6 @@ 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 gnb_id; MessageDef *msg_p = NULL; const char *msg_name = NULL; @@ -143,13 +142,13 @@ void *gNB_app_task(void *args_p) /* for no gcc warnings */ (void)instance; + int cell_to_activate = 0; itti_mark_task_ready (TASK_GNB_APP); LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); - RCconfig_NR_L1(); - RCconfig_nr_macrlc(); + if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc(); LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); @@ -171,19 +170,51 @@ void *gNB_app_task(void *args_p) configure_nr_rrc(gnb_id); } + for (int gnb_id = 0; gnb_id < RC.nb_nr_inst; gnb_id++) { + MessageDef *msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); + NRRRC_CONFIGURATION_REQ(msg_p) = RC.nrrrc[gnb_id]->configuration; + LOG_I(GNB_APP, "Sending configuration message to NR_RRC task\n"); + itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); + } + + if (RC.nb_nr_inst > 0) { + init_pdcp(); + + } if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(RC.rrc[0]->node_type) LOG_I(X2AP, "X2AP enabled \n"); __attribute__((unused)) uint32_t x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end); } - if (AMF_MODE_ENABLED) { - /* Try to register each gNB */ - //registered_gnb = 0; - __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, 0, INITIALIZE_MESSAGE); - itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p); + /* For the CU case the gNB registration with the AMF might have to take place after the F1 setup, as the PLMN info + * can originate from the DU. */ + if (AMF_MODE_ENABLED && !NODE_IS_DU(RC.nrrrc[0]->node_type) && !NODE_IS_CU(RC.nrrrc[0]->node_type)) { + /* Try to register each gNB */ + //registered_gnb = 0; + __attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end); + } + + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + + if (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) { + LOG_E(F1AP, "Create task for F1AP CU failed\n"); + AssertFatal(1==0,"exiting"); + } + pdcp_layer_init_for_CU(); + } + + if (NODE_IS_DU(RC.nrrrc[0]->node_type)) { + + if (itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL) < 0) { + LOG_E(F1AP, "Create task for F1AP DU failed\n"); + AssertFatal(1==0,"exiting"); + } + // configure F1AP here for F1C + LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); + msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ); + RCconfig_NR_DU_F1(msg_p, 0); + + itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); } do { @@ -247,6 +278,29 @@ void *gNB_app_task(void *args_p) */ break; + case F1AP_SETUP_RESP: + AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_SETUP_RESP in CU/gNB\n"); + + LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p), + F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); + cell_to_activate = F1AP_SETUP_RESP(msg_p).num_cells_to_activate; + + gNB_app_handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p)); + + break; + case F1AP_GNB_CU_CONFIGURATION_UPDATE: + AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_GNB_CU_CONFIGURATION_UPDATE in CU/gNB\n"); + + LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p), + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).gNB_CU_name,F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate); + + cell_to_activate += F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate; + gNB_app_handle_f1ap_gnb_cu_configuration_update(&F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p)); + + /* Check if at least gNB is registered with one AMF */ + AssertFatal(cell_to_activate == 1,"No cells to activate or cells > 1 %d\n",cell_to_activate); + + break; case NGAP_DEREGISTERED_GNB_IND: LOG_W(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name, NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 957485a9923341f75b8373efc4a05fbd3a183d66..8eb9670934d93e52e2d0b19e2447bf88c7e68bd9 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -42,6 +42,7 @@ #include "ngap_gNB.h" #include "sctp_eNB_task.h" #include "sctp_default_values.h" +#include "F1AP_CauseRadioNetwork.h" // #include "SystemInformationBlockType2.h" // #include "LAYER2/MAC/extern.h" // #include "LAYER2/MAC/proto.h" @@ -53,11 +54,12 @@ //#include "L1_paramdef.h" #include "L1_nr_paramdef.h" -#include "MACRLC_paramdef.h" +#include "MACRLC_nr_paramdef.h" #include "common/config/config_userapi.h" //#include "RRC_config_tools.h" #include "gnb_paramdef.h" #include "NR_MAC_gNB/mac_proto.h" +#include <openair3/ocp-gtpu/gtp_itf.h> #include "NR_asn_constant.h" #include "executables/thread-common.h" @@ -77,7 +79,12 @@ #include "NR_ControlResourceSet.h" #include "NR_EUTRA-MBSFN-SubframeConfig.h" +#include "RRC/NR/MESSAGES/asn1_msg.h" +#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h" + extern uint16_t sf_ahead; +int macrlc_has_f1 = 0; +extern ngran_node_t node_type; extern int config_check_band_frequencies(int ind, int16_t band, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint32_t frame_type); @@ -123,7 +130,37 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) { scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon)); scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = CALLOC(1,sizeof(long)); scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero = CALLOC(1,sizeof(long)); - // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = CALLOC(1,sizeof(struct NR_ControlResourceSet)); + + NR_ControlResourceSet_t *coreset0 = CALLOC(1,sizeof(struct NR_ControlResourceSet)); + coreset0->controlResourceSetId = 0; + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, + if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6); + coreset0->frequencyDomainResources.buf[0] = 0xff; + coreset0->frequencyDomainResources.buf[1] = 0; + coreset0->frequencyDomainResources.buf[2] = 0; + coreset0->frequencyDomainResources.buf[3] = 0; + coreset0->frequencyDomainResources.buf[4] = 0; + coreset0->frequencyDomainResources.buf[5] = 0; + coreset0->frequencyDomainResources.size = 6; + coreset0->frequencyDomainResources.bits_unused = 3; + coreset0->duration = 1; + coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved; + coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved)); + coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; + coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId; + coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + coreset0->tci_PresentInDCI = NULL; + coreset0->pdcch_DMRS_ScramblingID = NULL; + scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = coreset0; // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList)); // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = CALLOC(1,sizeof(NR_SearchSpaceId_t)); @@ -291,6 +328,167 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { free(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing); scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing=NULL; } + + // check pucch_ResourceConfig + AssertFatal(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon < 2, + "pucch_ResourceConfig should be 0 or 1 for now\n"); +} + +/* Function to allocate dedicated serving cell config strutures */ +void prepare_scd(NR_ServingCellConfig_t *scd) { + // Allocate downlink structures + + scd->downlinkBWP_ToAddModList = CALLOC(1, sizeof(*scd->downlinkBWP_ToAddModList)); + + // Downlink bandwidth part + NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); + bwp->bwp_Id = 1; + + // Allocate downlink dedicated bandwidth part and PDSCH structures + bwp->bwp_Dedicated = calloc(1, sizeof(*bwp->bwp_Dedicated)); + bwp->bwp_Dedicated->pdsch_Config = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); + 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; + + // Allocate DL DMRS and PTRS configuration + 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)); + NR_DMRS_DownlinkConfig_t *NR_DMRS_DownlinkCfg = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; + NR_DMRS_DownlinkCfg->phaseTrackingRS=CALLOC(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS)); + NR_DMRS_DownlinkCfg->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; + NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup = CALLOC(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup)); + NR_PTRS_DownlinkConfig_t *NR_PTRS_DownlinkCfg = NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup; + NR_PTRS_DownlinkCfg->frequencyDensity = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->frequencyDensity)); + long *dl_rbs = CALLOC(2, sizeof(long)); + for (int i=0;i<2;i++) { + ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->frequencyDensity->list, &dl_rbs[i]); + } + NR_PTRS_DownlinkCfg->timeDensity = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->timeDensity)); + long *dl_mcs = CALLOC(3, sizeof(long)); + for (int i=0;i<3;i++) { + ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->timeDensity->list, &dl_mcs[i]); + } + NR_PTRS_DownlinkCfg->epre_Ratio = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->epre_Ratio)); + NR_PTRS_DownlinkCfg->resourceElementOffset = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->resourceElementOffset)); + *NR_PTRS_DownlinkCfg->resourceElementOffset = 0; + ASN_SEQUENCE_ADD(&scd->downlinkBWP_ToAddModList->list,bwp); + + // Allocate uplink structures + + scd->uplinkConfig = CALLOC(1, sizeof(*scd->uplinkConfig)); + scd->uplinkConfig->uplinkBWP_ToAddModList = CALLOC(1, sizeof(*scd->uplinkConfig->uplinkBWP_ToAddModList)); + + NR_PUSCH_Config_t *pusch_Config = CALLOC(1, sizeof(*pusch_Config)); + + // Allocate UL DMRS and PTRS structures + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = CALLOC(1, sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = CALLOC(1, sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); + NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; + NR_DMRS_UplinkConfig->phaseTrackingRS = CALLOC(1, sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS)); + NR_DMRS_UplinkConfig->phaseTrackingRS->present = NR_SetupRelease_PTRS_UplinkConfig_PR_setup; + NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup = CALLOC(1, sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup)); + NR_PTRS_UplinkConfig_t *NR_PTRS_UplinkConfig = NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup; + NR_PTRS_UplinkConfig->transformPrecoderDisabled = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled)); + NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity)); + long *n_rbs = CALLOC(2, sizeof(long)); + for (int i=0;i<2;i++) { + ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity->list, &n_rbs[i]); + } + NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity)); + long *ptrs_mcs = CALLOC(3, sizeof(long)); + for (int i = 0; i < 3; i++) { + ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity->list, &ptrs_mcs[i]); + } + NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset)); + *NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = 0; + + // UL bandwidth part + NR_BWP_Uplink_t *ubwp = CALLOC(1, sizeof(*ubwp)); + ubwp->bwp_Id = 1; + ubwp->bwp_Dedicated = CALLOC(1, sizeof(*ubwp->bwp_Dedicated)); + + ubwp->bwp_Dedicated->pusch_Config = CALLOC(1, sizeof(*ubwp->bwp_Dedicated->pusch_Config)); + ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; + ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; + + ASN_SEQUENCE_ADD(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); +} + +/* This function checks dedicated serving cell configuration and performs fixes as needed */ +void fix_scd(NR_ServingCellConfig_t *scd) { + // Check for DL PTRS parameters validity + if (scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS) { + // If any of the frequencyDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.count-1; i >= 0; i--) { + if ((*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] < 1) + || (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] > 276)) { + LOG_I(RRC, "DL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS = NULL; + break; + } + } + } + if (scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS) { + // If any of the timeDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.count-1; i >= 0; i--) { + if ((*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] < 0) + || (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] > 29)) { + LOG_I(RRC, "DL PTRS timeDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS = NULL; + break; + } + } + } + if (scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS) { + if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset > 2) { + LOG_I(RRC, "Freeing DL PTRS resourceElementOffset \n"); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = NULL; + } + if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio > 1) { + LOG_I(RRC, "Freeing DL PTRS epre_Ratio \n"); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = NULL; + } + } + + if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + // If any of the frequencyDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.count-1; i >= 0; i--) { + if ((*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[i] < 1) + || (*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[i] > 276)) { + LOG_I(RRC, "UL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS); + scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS = NULL; + break; + } + } + } + + if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + // If any of the timeDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.count-1; i >= 0; i--) { + if ((*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[i] < 0) + || (*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[i] > 29)) { + LOG_I(RRC, "UL PTRS timeDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS); + scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS = NULL; + break; + } + } + } + if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + // Check for UL PTRS parameters validity + if (*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset > 2) { + LOG_I(RRC, "Freeing UL PTRS resourceElementOffset \n"); + free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset); + scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset = NULL; + } + } } void RCconfig_nr_flexran() @@ -399,11 +597,13 @@ void RCconfig_NR_L1(void) { RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB)); LOG_I(NR_PHY,"RC.gNB[%d] = %p\n",j,RC.gNB[j]); memset(RC.gNB[j],0,sizeof(PHY_VARS_gNB)); - RC.gNB[j]->Mod_id = j; + RC.gNB[j]->Mod_id = j; } RC.gNB[j]->pusch_proc_threads = *(L1_ParamList.paramarray[j][L1_PUSCH_PROC_THREADS].uptr); - + RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr); + RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr); + RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr); if(strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { //sf_ahead = 2; // Need 4 subframe gap between RX and TX }else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { @@ -424,15 +624,17 @@ void RCconfig_NR_L1(void) { RC.nb_nr_CC = (int *)malloc((1+RC.nb_nr_inst)*sizeof(int)); RC.nb_nr_CC[0]=1; - RC.nb_nr_inst =1; // DJP - feptx_prec uses num_gNB but phy_init_RU uses nb_nr_inst - LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_inst=1 this is because phy_init_RU() uses that to index and not RC.num_gNB - why the 2 similar variables?\n", __FUNCTION__); LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_CC[0]=%d for init_gNB_afterRU()\n", __FUNCTION__, RC.nb_nr_CC[0]); LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_macrlc_inst:%d because used by mac_top_init_gNB()\n", __FUNCTION__, RC.nb_nr_macrlc_inst); mac_top_init_gNB(); - configure_nr_nfapi_pnf(RC.gNB[j]->eth_params_n.remote_addr, RC.gNB[j]->eth_params_n.remote_portc, RC.gNB[j]->eth_params_n.my_addr, RC.gNB[j]->eth_params_n.my_portd, RC.gNB[j]->eth_params_n .remote_portd); + configure_nr_nfapi_pnf(RC.gNB[j]->eth_params_n.remote_addr, + RC.gNB[j]->eth_params_n.remote_portc, + RC.gNB[j]->eth_params_n.my_addr, + RC.gNB[j]->eth_params_n.my_portd, + RC.gNB[j]->eth_params_n.remote_portd); }else { // other midhaul } }// for (j = 0; j < RC.nb_nr_L1_inst; j++) @@ -471,10 +673,25 @@ void RCconfig_nr_macrlc() { for (j=0;j<RC.nb_nr_macrlc_inst;j++) { RC.nb_nr_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr); - + RC.nrmac[j]->pusch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHTARGETSNRX10_IDX].iptr); + RC.nrmac[j]->pucch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHTARGETSNRX10_IDX].iptr); + RC.nrmac[j]->pucch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHFAILURETHRES_IDX].iptr); + RC.nrmac[j]->pusch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHFAILURETHRES_IDX].iptr); + if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) { // check number of instances is same as RRC/PDCP + }else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) { + printf("Configuring F1 interfaces for MACRLC\n"); + RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr)); + RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr)); + RC.nrmac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr)); + RC.nrmac[j]->eth_params_n.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr); + RC.nrmac[j]->eth_params_n.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr); + RC.nrmac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr); + RC.nrmac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);; + RC.nrmac[j]->eth_params_n.transp_preference = ETH_UDP_MODE; + macrlc_has_f1 = 1; }else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) { RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr)); RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr)); @@ -500,8 +717,6 @@ void RCconfig_nr_macrlc() { RC.nrmac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr); RC.nrmac[j]->eth_params_s.transp_preference = ETH_UDP_MODE; - //sf_ahead = 2; // Cannot cope with 4 subframes between RX and TX - set it to 2 - printf("**************** vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc); configure_nr_nfapi_vnf(RC.nrmac[j]->eth_params_s.my_addr, RC.nrmac[j]->eth_params_s.my_portc); printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc); @@ -510,7 +725,8 @@ void RCconfig_nr_macrlc() { } }// for (j=0;j<RC.nb_nr_macrlc_inst;j++) }else {// MacRLC_ParamList.numelt > 0 - AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found"); + printf("No %s configuration found \n", CONFIG_STRING_MACRLC_LIST); + // AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found"); } } @@ -615,7 +831,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { int num_gnbs = 0; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; int32_t gnb_id = 0; - int k; + int k = 0; + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; ////////// Identification parameters paramdef_t GNBParams[] = GNBPARAMS_DESC; @@ -627,6 +844,13 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { prepare_scc(scc); paramdef_t SCCsParams[] = SCCPARAMS_DESC(scc); paramlist_def_t SCCsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, NULL, 0}; + + // Serving Cell Config Dedicated + NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); + memset((void*)scd,0,sizeof(NR_ServingCellConfig_t)); + prepare_scd(scd); + paramdef_t SCDsParams[] = SCDPARAMS_DESC(scd); + paramlist_def_t SCDsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, NULL, 0}; ////////// Physical parameters @@ -700,7 +924,59 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { (int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower); fix_scc(scc,ssb_bitmap); } + + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + + config_getlist(&SCDsParamList, NULL, 0, aprefix); + if (SCDsParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0); + config_get( SCDsParams,sizeof(SCDsParams)/sizeof(paramdef_t),aprefix); + LOG_I(RRC,"Read in ServingCellConfigDedicated UL (FreqDensity_0 %d, FreqDensity_1 %d, TimeDensity_0 %d, TimeDensity_1 %d, TimeDensity_2 %d, RE offset %d \n", + (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[0], + (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[1], + (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[0], + (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[1], + (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[2], + (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset); + } + fix_scd(scd); + printf("NRRRC %d: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); + + if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { + paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + sprintf(aprefix,"%s.[%u].%s",GNB_CONFIG_STRING_GNB_LIST,i,GNB_CONFIG_STRING_SCTP_CONFIG); + config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); + rrc->node_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); + LOG_I(GNB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,rrc->node_id); + rrc->node_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); + LOG_I(GNB_APP,"F1AP: gNB_CU_name[%d] %s\n",k,rrc->node_name); + rrc->eth_params_s.local_if_name = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_IF_NAME_IDX].strptr)); + rrc->eth_params_s.my_addr = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_ADDRESS_IDX].strptr)); + rrc->eth_params_s.remote_addr = strdup(*(GNBParamList.paramarray[i][GNB_REMOTE_S_ADDRESS_IDX].strptr)); + rrc->eth_params_s.my_portc = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTC_IDX].uptr); + rrc->eth_params_s.remote_portc = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTC_IDX].uptr); + rrc->eth_params_s.my_portd = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTD_IDX].uptr); + rrc->eth_params_s.remote_portd = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTD_IDX].uptr); + rrc->eth_params_s.transp_preference = ETH_UDP_MODE; + rrc->node_type = ngran_gNB_CU; + rrc->sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); + rrc->sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); + } else { + // set to ngran_gNB for now, it will get set to ngran_gNB_DU if macrlc entity which uses F1 is present + // Note: we will have to handle the case of ngran_ng_gNB_DU + if (macrlc_has_f1 == 0) { + rrc->node_type = ngran_gNB; + LOG_I(NR_RRC,"Setting node_type to ngran_gNB\n"); + } else { + rrc->node_type = ngran_gNB_DU; + LOG_I(NR_RRC,"Setting node_type to ngran_gNB_DU\n"); + } + } + + rrc->nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); + if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { } else if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) { @@ -765,15 +1041,15 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { NRRRC_CONFIGURATION_REQ (msg_p).ssb_SubcarrierOffset = *GNBParamList.paramarray[i][GNB_SSB_SUBCARRIEROFFSET_IDX].iptr; printf("pdsch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr; - printf("pusch_TargetSNRx10 %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_TARGETPOW_X10_IDX].iptr); - NRRRC_CONFIGURATION_REQ (msg_p).pusch_TargetSNRx10 = *GNBParamList.paramarray[i][GNB_PUSCH_TARGETPOW_X10_IDX].iptr; - printf("pucch_TargetSNRx10 %d\n",*GNBParamList.paramarray[i][GNB_PUCCH_TARGETPOW_X10_IDX].iptr); - NRRRC_CONFIGURATION_REQ (msg_p).pucch_TargetSNRx10 = *GNBParamList.paramarray[i][GNB_PUCCH_TARGETPOW_X10_IDX].iptr; + printf("pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr); + NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).scc = scc; + NRRRC_CONFIGURATION_REQ (msg_p).scd = scd; }// }//End for (k=0; k <num_gnbs ; k++) + memcpy(&rrc->configuration, &NRRRC_CONFIGURATION_REQ(msg_p), sizeof(NRRRC_CONFIGURATION_REQ(msg_p))); }//End if (num_gnbs>0) config_security(rrc); @@ -828,20 +1104,25 @@ int RCconfig_nr_gtpu(void ) { MessageDef *message; if (gnb_mode == 1) { // NSA - AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_ENB_S1_REQ))!=NULL,""); + message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_ENB_S1_REQ); + AssertFatal(message!=NULL,""); // IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); // LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U; + strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address); + sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", gnb_port_for_NGU); } else {// TODO SA - AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ))!=NULL,""); + message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ); + AssertFatal(message!=NULL,""); IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up); GTPV1U_GNB_NG_REQ(message).gnb_port_for_NGu_up = gnb_port_for_NGU; + strcpy(GTPV1U_GNB_NG_REQ(message).addrStr,address); + sprintf(GTPV1U_GNB_NG_REQ(message).portStr,"%d", gnb_port_for_NGU); } - - itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for NGU\n"); @@ -1018,12 +1299,13 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1; NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1; } +/* not in configuration yet ... if (NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr) NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].numelt; else NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = 0; - +*/ AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] <= NGAP_REGISTER_GNB_REQ(msg_p).num_plmn, "List of broadcast PLMN to be sent to AMF can not be longer than actual " "PLMN list (max %d, but is %d)\n", @@ -1129,7 +1411,7 @@ void NRRCConfig(void) { // Get num MACRLC instances config_getlist( &MACRLCParamList,NULL,0, NULL); - RC.nb_macrlc_inst = MACRLCParamList.numelt; + RC.nb_nr_macrlc_inst = MACRLCParamList.numelt; // Get num L1 instances config_getlist( &L1ParamList,NULL,0, NULL); RC.nb_nr_L1_inst = L1ParamList.numelt; @@ -1348,3 +1630,461 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { return 0; } +int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { + int k; + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + paramdef_t GNBParams[] = GNBPARAMS_DESC; + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal (i < num_gnbs, + "Failed to parse config file no %uth element in %s \n",i, GNB_CONFIG_STRING_ACTIVE_GNBS); + + if (num_gnbs > 0) { + // Output a list of all eNBs. + config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); + AssertFatal(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr != NULL, + "gNB id %u is not defined in configuration file\n",i); + F1AP_SETUP_REQ (msg_p).num_cells_available = 0; + + for (k=0; k <num_gnbs ; k++) { + if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[k], *(GNBParamList.paramarray[i][GNB_GNB_NAME_IDX].strptr)) == 0) { + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k); + paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC; + paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0}; + /* map parameter checking array instances to parameter definition array instances */ + checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK; + + for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) + PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); + + config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix); + paramdef_t SCTPParams[] = SCTPPARAMS_DESC; + F1AP_SETUP_REQ (msg_p).num_cells_available++; + F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); + LOG_I(GNB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); + F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); + LOG_I(GNB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); + F1AP_SETUP_REQ (msg_p).tac[k] = *GNBParamList.paramarray[i][GNB_TRACKING_AREA_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]); + F1AP_SETUP_REQ (msg_p).mcc[k] = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]); + F1AP_SETUP_REQ (msg_p).mnc[k] = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]); + F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; + LOG_I(GNB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); + AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) || + (F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3), + "BAD MNC DIGIT LENGTH %d", + F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); + F1AP_SETUP_REQ (msg_p).nr_cellid[k] = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); + LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).nr_cellid[k]); + LOG_I(GNB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.remote_addr); + LOG_I(GNB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.remote_addr)); + F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6 = 0; + F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4 = 1; + //strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6_address, ""); + strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.remote_addr); + LOG_I(GNB_APP,"F1AP: DU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.my_addr); + LOG_I(GNB_APP,"FIAP: DU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.my_addr)); + F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6 = 0; + F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4 = 1; + //strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6_address, ""); + strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.my_addr); + //strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); + sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); + config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); + F1AP_SETUP_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); + F1AP_SETUP_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); + gNB_RRC_INST *rrc = RC.nrrrc[k]; + // wait until RRC cell information is configured + int cell_info_configured = 0; + + do { + LOG_I(GNB_APP,"ngran_gNB_DU: Waiting for basic cell configuration\n"); + usleep(100000); + pthread_mutex_lock(&rrc->cell_info_mutex); + cell_info_configured = rrc->cell_info_configured; + pthread_mutex_unlock(&rrc->cell_info_mutex); + } while (cell_info_configured == 0); + + rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).mcc[k]; + rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).mnc[k]; + rrc->configuration.tac = F1AP_SETUP_REQ (msg_p).tac[k]; + rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).nr_cellid[k]; + F1AP_SETUP_REQ (msg_p).nr_pci[k] = *rrc->configuration.scc->physCellId; + F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; + + if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) { + LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); + F1AP_SETUP_REQ (msg_p).fdd_flag = 0; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.scs = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = *rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.sul_active = 0; + } else { + /***************** for test *****************/ + LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); + F1AP_SETUP_REQ (msg_p).fdd_flag = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = 26200UL; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_arfcn = 26200UL; + // For LTE use scs field to carry prefix type and number of antennas + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_scs = 0; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_scs = 0; + // use nrb field to hold LTE N_RB_DL (0...5) + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = 3; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = 3; + // RK: we need to check there value for FDD's frequency_bands DL/UL + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_band[0] = 7; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_band[0] = 7; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_sul_frequency_bands = 0; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_sul_band[0] = 7; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_sul_frequency_bands = 0; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_sul_band[0] = 7; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; + /***************** for test *****************/ + } + + F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = "0"; + F1AP_SETUP_REQ (msg_p).ranac[k] = 0; + F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier.MIB; + F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier.SIB1; + F1AP_SETUP_REQ (msg_p).mib_length[k] = rrc->carrier.sizeof_MIB; + F1AP_SETUP_REQ (msg_p).sib1_length[k] = rrc->carrier.sizeof_SIB1; + break; + } + } + } + return 0; +} + +int du_check_plmn_identity(rrc_gNB_carrier_data_t *carrier,uint16_t mcc,uint16_t mnc,uint8_t mnc_digit_length) { + NR_SIB1_t *sib1 = carrier->siblock1->message.choice.c1->choice.systemInformationBlockType1; + AssertFatal(sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_IdentityList.list.count > 0, + "plmn info isn't there\n"); + AssertFatal(mnc_digit_length == 2 || mnc_digit_length == 3, + "impossible mnc_digit_length %d\n", mnc_digit_length); + NR_PLMN_Identity_t *plmn_Identity = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0] + ->plmn_IdentityList.list.array[0]; + + // check if mcc is different and return failure if so + if (mcc != + ((*plmn_Identity->mcc->list.array[0])*100)+ + ((*plmn_Identity->mcc->list.array[1])*10) + + (*plmn_Identity->mcc->list.array[2])) { + LOG_E(GNB_APP, "mcc in F1AP_SETUP_RESP message is different from mcc in DU \n"); + return(0); + } + + // check that mnc digit length is different and return failure if so + if (mnc_digit_length != plmn_Identity->mnc.list.count) { + LOG_E(GNB_APP, "mnc(length: %d) in F1AP_SETUP_RESP message is different from mnc(length: %d) in DU \n", + mnc_digit_length, plmn_Identity->mnc.list.count); + return 0; + } + + // check that 2 digit mnc is different and return failure if so + if (mnc_digit_length == 2 && + (mnc != + (*plmn_Identity->mnc.list.array[0]*10) + + (*plmn_Identity->mnc.list.array[1]))) { + LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld) in DU \n", + mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1]); + return(0); + } + else if (mnc_digit_length == 3 && + (mnc != + (*plmn_Identity->mnc.list.array[0]*100) + + (*plmn_Identity->mnc.list.array[1]*10) + + (*plmn_Identity->mnc.list.array[2]))) { + LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld%ld) in DU \n", + mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1], *plmn_Identity->mnc.list.array[2]); + return(0); + } + + // if we're here, the mcc/mnc match so return success + return(1); +} + +void du_extract_and_decode_SI(int inst, int si_ind, uint8_t *si_container, int si_container_length) { + gNB_RRC_INST *rrc = RC.nrrrc[inst]; + rrc_gNB_carrier_data_t *carrier = &rrc->carrier; + NR_BCCH_DL_SCH_Message_t *bcch_message ; + AssertFatal(si_ind == 0, "Can only handle a single SI block for now\n"); + LOG_I(GNB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n", inst, si_ind, si_container, si_container_length); + // point to first SI block + bcch_message = &carrier->systemInformation; + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_NR_BCCH_DL_SCH_Message, + (void **)&bcch_message, + (const void *)si_container, + si_container_length); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + AssertFatal(1==0, "[GNB_APP][NR_RRC inst %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", + inst, + dec_rval.consumed ); + } + + if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) { + switch (bcch_message->message.choice.c1->present) { + case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + AssertFatal(1 == 0, "Should have received SIB1 from CU\n"); + break; + + case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + { + NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation; + + if (si->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_systemInformation) { + for (int i = 0; i < si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count; i++) { + LOG_I(GNB_APP, "Extracting SI %d/%d\n", i, si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count); + SystemInformation_IEs__sib_TypeAndInfo__Member *typeAndInfo; + typeAndInfo = si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.array[i]; + + switch(typeAndInfo->present) { + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_NOTHING: + AssertFatal(0, "Should have received SIB2 SIB3 from CU\n"); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst); + carrier->sib2 = typeAndInfo->choice.sib2; + carrier->SIB23 = (uint8_t *)malloc(64); + memcpy((void *)carrier->SIB23, (void *)si_container, si_container_length); + carrier->sizeof_SIB23 = si_container_length; + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3: + carrier->sib3 = typeAndInfo->choice.sib3; + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst); + break; + case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610: + LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB14 in CU F1AP_SETUP_RESP message\n", inst); + break; + default: + AssertFatal(1 == 0,"Shouldn't have received this SI %d\n", typeAndInfo->present); + break; + } + } + } + + break; + } + + case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: + AssertFatal(0, "Should have received SIB1 from CU\n"); + break; + } + } else AssertFatal(1 == 0, "No SI messages\n"); +} + +void configure_gnb_du_mac(int inst) { + gNB_RRC_INST *rrc = RC.nrrrc[inst]; + // LOG_I(GNB_APP,"Configuring MAC/L1 %d, carrier->sib2 %p\n", inst, &carrier->sib2->radioResourceConfigCommon); + LOG_I(GNB_APP,"Configuring gNB DU MAC/L1 %d \n", inst); + rrc_mac_config_req_gNB(rrc->module_id, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.scc, + 0, + 0, // rnti + (NR_CellGroupConfig_t *)NULL + ); +} + + +int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { + int i, j, si_ind; + int ret=0; + LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n", + resp->num_cells_to_activate, RC.nb_nr_inst); + + for (j = 0; j < resp->num_cells_to_activate; j++) { + for (i = 0; i < RC.nb_nr_inst; i++) { + rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier; + // identify local index of cell j by nr_cellid, plmn identity and physical cell ID + LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", + j, i, RC.nrrrc[i]->nr_cellid, resp->cells_to_activate[j].nr_cellid); + + if (RC.nrrrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid && + (du_check_plmn_identity(carrier, resp->cells_to_activate[j].mcc, resp->cells_to_activate[j].mnc, resp->cells_to_activate[j].mnc_digit_length)>0 && + resp->cells_to_activate[j].nrpci == carrier->physCellId)) { + // copy system information and decode it + for (si_ind=0; si_ind<resp->cells_to_activate[j].num_SI; si_ind++) { + + du_extract_and_decode_SI(i, + si_ind, + resp->cells_to_activate[j].SI_container[si_ind], + resp->cells_to_activate[j].SI_container_length[si_ind]); + } + + // perform MAC/L1 common configuration + configure_gnb_du_mac(i); + ret++; + } else { + LOG_E(GNB_APP, "F1 Setup Response not matching\n"); + } + } + } + return(ret); +} + +int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update) { + int i, j, si_ind, ret=0; + LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n", + gnb_cu_cfg_update->num_cells_to_activate, RC.nb_nr_inst); + + for (j = 0; j < gnb_cu_cfg_update->num_cells_to_activate; j++) { + for (i = 0; i < RC.nb_nr_inst; i++) { + rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier; + // identify local index of cell j by nr_cellid, plmn identity and physical cell ID + LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, gnb_cu_cfg_updatenr_cellid %lx\n", + j, i, RC.nrrrc[i]->nr_cellid, gnb_cu_cfg_update->cells_to_activate[j].nr_cellid); + + if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid && + (du_check_plmn_identity(carrier, gnb_cu_cfg_update->cells_to_activate[j].mcc, gnb_cu_cfg_update->cells_to_activate[j].mnc, gnb_cu_cfg_update->cells_to_activate[j].mnc_digit_length)>0 && + gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId)) { + // copy system information and decode it + for (si_ind=0; si_ind<gnb_cu_cfg_update->cells_to_activate[j].num_SI; si_ind++) { + + du_extract_and_decode_SI(i, + si_ind, + gnb_cu_cfg_update->cells_to_activate[j].SI_container[si_ind], + gnb_cu_cfg_update->cells_to_activate[j].SI_container_length[si_ind]); + } + + // perform MAC/L1 common configuration + configure_gnb_du_mac(i); + ret++; + } else { + LOG_E(GNB_APP, "GNB_CU_CONFIGURATION_UPDATE not matching\n"); + } + } + } + MessageDef *msg_ack_p = NULL; + if (ret > 0) { + // generate gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE + msg_ack_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE); + F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).num_cells_failed_to_be_activated = 0; + F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).have_criticality = 0; + F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofTNLAssociations_to_setup =0; + F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofTNLAssociations_failed = 0; + F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofDedicatedSIDeliveryNeededUEs = 0; + itti_send_msg_to_task (TASK_DU_F1, INSTANCE_DEFAULT, msg_ack_p); + + } + else { + // generate gNB_CU_CONFIGURATION_UPDATE_FAILURE + msg_ack_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE); + F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(msg_ack_p).cause = F1AP_CauseRadioNetwork_cell_not_available; + + itti_send_msg_to_task (TASK_DU_F1, INSTANCE_DEFAULT, msg_ack_p); + + } + + return(ret); +} + +void set_node_type(void) { + int j; + paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC; + paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0}; + paramdef_t GNBParams[] = GNBPARAMS_DESC; + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; + + config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL); + config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); + + if ( MacRLC_ParamList.numelt > 0) { + RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; + for (j=0;j<RC.nb_nr_macrlc_inst;j++) { + if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) { + macrlc_has_f1 = 1; + } + } + } + + if (strcmp(*(GNBParamList.paramarray[0][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { + node_type = ngran_gNB_CU; + } else { + if (macrlc_has_f1 == 0) { + node_type = ngran_gNB; + LOG_I(NR_RRC,"Setting node_type to ngran_gNB\n"); + } else { + node_type = ngran_gNB_DU; + LOG_I(NR_RRC,"Setting node_type to ngran_gNB_DU\n"); + } + } +} + +void nr_read_config_and_init(void) { + MessageDef *msg_p = NULL; + uint32_t gnb_id; + uint32_t gnb_nb = RC.nb_nr_inst; + + RCconfig_NR_L1(); + set_node_type(); + RCconfig_nr_macrlc(); + + LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); + + if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n"); + + AssertFatal (gnb_nb <= RC.nb_nr_inst, + "Number of gNB is greater than gNB defined in configuration file (%d/%d)!", + gnb_nb, RC.nb_nr_inst); + + LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst); + + RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *)); + LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); + + for (gnb_id = 0; gnb_id < RC.nb_nr_inst ; gnb_id++) { + RC.nrrrc[gnb_id] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST)); + LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, RC.nb_nr_inst); + memset((void *)RC.nrrrc[gnb_id],0,sizeof(gNB_RRC_INST)); + msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); + RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); + } + + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + pdcp_layer_init_for_CU(); +// nr_DRB_preconfiguration(0x1234); + rrc_init_nr_global_param(); + } +} diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 0d965171ef081599c8eb0c37a95209aefccc6701..035a3ce76c079643acc33eeb53fb010decec5e9d 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -40,6 +40,7 @@ #include "PHY/defs_eNB.h" #include "s1ap_messages_types.h" #include "ngap_messages_types.h" +#include "f1ap_messages_types.h" #ifdef CMAKER #include "rrc_messages_types.h" @@ -105,6 +106,10 @@ extern void NRRCConfig(void); void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); +int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i); +int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp); +int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update); +void nr_read_config_and_init(void); #endif /* GNB_CONFIG_H_ */ /** @} */ diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 403602c109ff6ce4899c02268223bee6b610be44..6d9c9b83420da30c67c91251d8adfd5992ed5262 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -115,8 +115,8 @@ typedef enum { #define GNB_CONFIG_STRING_REMOTE_S_PORTD "remote_s_portd" #define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset" #define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts" -#define GNB_CONFIG_STRING_PUSCHTARGETPOWX10 "pusch_TargetSNRx10" -#define GNB_CONFIG_STRING_PUCCHTARGETPOWX10 "pucch_TargetSNRx10" +#define GNB_CONFIG_STRING_PUSCHANTENNAPORTS "pusch_AntennaPorts" +#define GNB_CONFIG_STRING_NRCELLID "nr_cellid" /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ @@ -139,8 +139,8 @@ typedef enum { {GNB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ -{GNB_CONFIG_STRING_PUSCHTARGETPOWX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ -{GNB_CONFIG_STRING_PUCCHTARGETPOWX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_PUSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_NRCELLID , NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ } #define GNB_GNB_ID_IDX 0 @@ -159,8 +159,8 @@ typedef enum { #define GNB_REMOTE_S_PORTD_IDX 13 #define GNB_SSB_SUBCARRIEROFFSET_IDX 14 #define GNB_PDSCH_ANTENNAPORTS_IDX 15 -#define GNB_PUSCH_TARGETPOW_X10_IDX 16 -#define GNB_PUCCH_TARGETPOW_X10_IDX 17 +#define GNB_PUSCH_ANTENNAPORTS_IDX 16 +#define GNB_NRCELLID_IDX 17 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 781347abaaea42610de39f573ff1a4385af2d5d3..71f91a67ec31ff3e4ab822587608a397d2c4f954 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -337,7 +337,8 @@ config_sib2(int Mod_idP, LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreqP, long *ul_BandwidthP, LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmissionP, - struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP) { + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP, + int dl_Bandwidth) { nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; cfg->subframe_config.pb.value = radioResourceConfigCommonP->pdsch_ConfigCommon.p_b; cfg->subframe_config.pb.tl.tag = NFAPI_SUBFRAME_CONFIG_PB_TAG; @@ -345,7 +346,7 @@ config_sib2(int Mod_idP, cfg->rf_config.reference_signal_power.value = radioResourceConfigCommonP->pdsch_ConfigCommon.referenceSignalPower; cfg->rf_config.reference_signal_power.tl.tag = NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG; cfg->num_tlv++; - cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value + power_off_dB[cfg->rf_config.dl_channel_bandwidth.value]; + cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value + power_off_dB[dl_Bandwidth]; cfg->nfapi_config.max_transmit_power.tl.tag = NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG; cfg->num_tlv++; cfg->prach_config.configuration_index.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_ConfigIndex; @@ -870,7 +871,8 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, radioResourceConfigCommon_BR, NULL, ul_Bandwidth, additionalSpectrumEmission, - mbsfn_SubframeConfigList); + mbsfn_SubframeConfigList, + mib->message.dl_Bandwidth); } // mib != NULL if (mobilityControlInfo !=NULL) { diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c index 1c5e70621803a3ad8dec8b80aead42b771b11ac3..79202d87e32733b5026aca200f0d0825c61567a9 100644 --- a/openair2/LAYER2/MAC/config_ue.c +++ b/openair2/LAYER2/MAC/config_ue.c @@ -85,10 +85,6 @@ void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index) { ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure } -int32_t **rxdata; -int32_t **txdata; - - int rrc_mac_config_req_ue(module_id_t Mod_idP, int CC_idP, diff --git a/openair2/LAYER2/MAC/defs_NB_IoT.h b/openair2/LAYER2/MAC/defs_NB_IoT.h index 517f01d1b932be33b345681118ed69a6ee5f2150..78524e104d2895eca07b67d3eff9dd453bac5d8f 100644 --- a/openair2/LAYER2/MAC/defs_NB_IoT.h +++ b/openair2/LAYER2/MAC/defs_NB_IoT.h @@ -537,9 +537,6 @@ typedef struct { // global variables -nprach_parameters_NB_IoT_t nprach_list[3]; -//DLSF Table -DLSF_INFO_t DLSF_information; #endif /*__LAYER2_MAC_DEFS_NB_IoT_H__ */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index f3a77ed7030e86615b738a8dafe795f4f115313f..1272b16ec06d3ce915a1bf9e99e993a25daac342 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -84,7 +84,7 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, static uint32_t bytes_in_buffer=0; static uint32_t msi_pmch_stop=0; -uint16_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static uint32_t msi_sfs=0; diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h index cee6066a9ebb174119b3fe6b22ce4ed6c9ae738a..cda64ec0e9834b5bf2ba09cc6e426ec003f66593 100644 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -65,6 +65,7 @@ extern const int cqi_to_mcs[16]; extern uint32_t RRC_CONNECTION_FLAG; extern uint8_t rb_table[34]; +extern rb_id_t mbms_rab_id; #if defined(PRE_SCD_THREAD) @@ -77,4 +78,5 @@ extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern mac_rlc_am_muilist_t rlc_am_mui; extern SCHEDULER_MODES global_scheduler_mode; +extern rb_id_t mbms_rab_id; #endif //DEF_H diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 0dedacb11ffc2aa7d16daa2051905c750ed2e0a4..9ae8f82a00cd2d0363c4cb4c644bd36ce2051c5e 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -72,7 +72,7 @@ extern UL_IND_t *UL_INFO; extern int next_ra_frame; extern module_id_t next_Mod_id; -int mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static int mbms_mch_i=0; //static int num_msi_per_CSA[28]; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c index 452ed45b3a9872c9bbefa6913e59acb1a5317ade..996c2fbe27c07b8bec4c6d2018a160da70754033 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c @@ -51,6 +51,8 @@ uint32_t nr_compute_tbs(uint16_t Qm, uint32_t Ninfo, Np_info, C; uint8_t n, scale; + LOG_D(MAC,"nb_symb_sch %d, nb_dmrs_prb %d, nb_rb_oh %d\n",nb_symb_sch,nb_dmrs_prb,nb_rb_oh); + nbp_re = NR_NB_SC_PER_RB * nb_symb_sch - nb_dmrs_prb - nb_rb_oh; nb_re = min(156, nbp_re) * nb_rb; scale = (R>1024)?11:10; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index 381dce11b2cddce03c9633c17add5dc24d3ad7e6..ba12d9c5c3c9dc7524cef5ea6a1c0ffaff218272 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -36,6 +36,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdbool.h> #define TABLE_38213_13_1_NUM_INDEXES 15 #define TABLE_38213_13_2_NUM_INDEXES 14 @@ -334,12 +335,12 @@ typedef struct { #define DL_SCH_LCID_CON_RES_ID 0x3E #define DL_SCH_LCID_PADDING 0x3F -#define UL_SCH_LCID_CCCH 0x00 +#define UL_SCH_LCID_CCCH1 0x00 #define UL_SCH_LCID_SRB1 0x01 #define UL_SCH_LCID_SRB2 0x02 #define UL_SCH_LCID_SRB3 0x03 #define UL_SCH_LCID_DTCH 0x04 -#define UL_SCH_LCID_CCCH_MSG3 0x21 +#define UL_SCH_LCID_CCCH 0x34 #define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35 #define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36 #define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37 @@ -418,14 +419,6 @@ typedef enum { NR_RNTI_MCS_C, } nr_rnti_type_t; -typedef enum subcarrier_spacing_e { - scs_15kHz = 0x1, - scs_30kHz = 0x2, - scs_60kHz = 0x4, - scs_120kHz = 0x8, - scs_240kHz = 0x16 -} subcarrier_spacing_t; - typedef enum channel_bandwidth_e { bw_5MHz = 0x1, bw_10MHz = 0x2, @@ -462,6 +455,7 @@ typedef struct Type0_PDCCH_CSS_config_s { uint32_t ssb_length; uint32_t ssb_index; uint32_t cset_start_rb; + bool active; } NR_Type0_PDCCH_CSS_config_t; #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 ce4e0f81f301a9aa864207aa7d811f203ef04c7e..7004cf7aaf7e8d5104444ea768be403960c3333f 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -36,6 +36,13 @@ #define reserved 0xffff +// start symbols for SSB types A,B,C,D,E +uint16_t symbol_ssb_AC[8]={2,8,16,22,30,36,44,50}; +uint16_t symbol_ssb_BD[64]={4,8,16,20,32,36,44,48,60,64,72,76,88,92,100,104,144,148,156,160,172,176,184,188,200,204,212,216,228,232,240,244,284,288, + 296,300,312,316,324,328,340,344,352,356,368,372,380,384,424,428,436,440,452,456,464,468,480,484,492,496,508,512,520,524}; +uint16_t symbol_ssb_E[64]={8,12,16,20,32,36,40,44,64,68,72,76,88,92,96,100,120,124,128,132,144,148,152,156,176,180,184,188,200,204,208,212,288,292, + 296,300,312,316,320,324,344,348,352,356,368,372,376,380,400,404,408,412,424,428,432,436,456,460,464,468,480,484,488,492}; + 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 @@ -118,6 +125,152 @@ const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; +// for PDSCH from TS 38.214 subclause 5.1.2.1.1 +const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3]={ + {0,2,12}, // row index 1 + {0,2,10}, // row index 2 + {0,2,9}, // row index 3 + {0,2,7}, // row index 4 + {0,2,5}, // row index 5 + {0,9,4}, // row index 6 + {0,4,4}, // row index 7 + {0,5,7}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,12,2}, // row index 11 + {0,1,13}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,7}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3]={ + {0,3,11}, // row index 1 + {0,3,9}, // row index 2 + {0,3,8}, // row index 3 + {0,3,6}, // row index 4 + {0,3,4}, // row index 5 + {0,10,4}, // row index 6 + {0,6,4}, // row index 7 + {0,5,7}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,12,2}, // row index 11 + {0,1,13}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,7}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3]={ + {0,2,6}, // row index 1 + {0,2,10}, // row index 2 + {0,2,9}, // row index 3 + {0,2,7}, // row index 4 + {0,2,5}, // row index 5 + {0,6,4}, // row index 6 + {0,4,4}, // row index 7 + {0,5,6}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,10,2}, // row index 11 + {0,1,11}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,6}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3]={ + {0,3,5}, // row index 1 + {0,3,9}, // row index 2 + {0,3,8}, // row index 3 + {0,3,6}, // row index 4 + {0,3,4}, // row index 5 + {0,8,2}, // row index 6 + {0,6,4}, // row index 7 + {0,5,6}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,10,2}, // row index 11 + {0,1,11}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,6}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {1,2,2}, // row index 6 + {1,4,2}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,2,12}, // row index 14 + {1,2,4}, // row index 15 + {0,0,0} // row index 16 +}; +const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {1,2,2}, // row index 6 + {1,4,2}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,3,11}, // row index 14 + {1,2,4}, // row index 15 + {0,0,0} // row index 16 +}; +const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {0,0,0}, // row index 6 + {0,0,0}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,2,12}, // row index 14 + {0,0,6}, // row index 15 + {0,2,6} // row index 16 +}; +const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {0,0,0}, // row index 6 + {0,0,0}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,3,11}, // row index 14 + {0,0,6}, // row index 15 + {0,2,6} // row index 16 +}; + const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"}; const char *duplex_mode[]={"FDD","TDD"}; @@ -1010,7 +1163,7 @@ int get_format0(uint8_t index, uint8_t unpaired, frequency_range_t frequency_range){ - uint16_t format; + uint16_t format=0; if (unpaired) { if (frequency_range==FR1) format = table_6_3_3_2_3_prachConfig_Index[index][0]; @@ -1026,12 +1179,12 @@ int get_format0(uint8_t index, return format; } -int64_t *get_prach_config_info(uint32_t pointa, +int64_t *get_prach_config_info(int fr2_flag, uint8_t index, uint8_t unpaired) { int64_t *prach_config_info_p; - if (pointa > 2016666) { //FR2 + if (fr2_flag > 0) { //FR2 prach_config_info_p = table_6_3_3_2_4_prachConfig_Index[index]; } else { // FR1 @@ -1402,19 +1555,17 @@ 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 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", - frame, - slot, - index, - table_6_3_3_2_3_prachConfig_Index[index][6], - pointa, - mu, - unpaired, - *start_symbol, - *N_t_slot, - *N_dur, - *N_RA_slot, - *RA_sfn_index); + LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", frame, + slot, + index, table_6_3_3_2_3_prachConfig_Index[index][6], + pointa, + mu, + unpaired, + *start_symbol, + *N_t_slot, + *N_dur, + *N_RA_slot, + *RA_sfn_index); } return 1; } @@ -2161,8 +2312,8 @@ int get_num_dmrs(uint16_t dmrs_mask ) { return(num_dmrs); } /* returns the total DMRS symbols in a slot*/ -uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols){ - return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols)); +uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol){ + return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols,startSymbol)); } // Table 5.1.2.2.1-1 38.214 @@ -2275,7 +2426,7 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint mcs4 = 28; if (I_mcs < mcs1) { - LOG_I(PHY, "PUSH PT-RS is not present.\n"); + LOG_D(PHY, "PUSH PT-RS is not present.\n"); return -1; } else if (I_mcs >= mcs1 && I_mcs < mcs2) return 2; @@ -2305,7 +2456,7 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint 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"); + LOG_D(PHY,"PUSH PT-RS is not present.\n"); return -1; } else if (N_RB >= nrb0 && N_RB < nrb1) return 2; @@ -2315,7 +2466,7 @@ uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) { // Set the transform precoding status according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16: // - "UE procedure for applying transform precoding on PUSCH" -uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc, +uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP, const NR_PUSCH_Config_t *pusch_config, const NR_BWP_Uplink_t *ubwp, uint8_t *dci_format, @@ -2330,7 +2481,7 @@ uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc, } } - if (rnti_type != NR_RNTI_RA) { + if (rnti_type != NR_RNTI_RA && rnti_type != NR_RNTI_TC) { if (*dci_format != NR_UL_DCI_FORMAT_0_0) { if (pusch_config->transformPrecoder != NULL) { return *pusch_config->transformPrecoder; @@ -2338,7 +2489,7 @@ uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc, } } - if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) { + if (initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) { return 1; // Transformprecoding disabled } else { LOG_D(PHY, "MAC_COMMON: Transform Precodig enabled through msg3_transformPrecoder\n"); @@ -2349,8 +2500,8 @@ uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc, return -1; } -uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, - const NR_CellGroupConfig_t *secondaryCellGroup, +uint16_t nr_dci_size(const NR_BWP_UplinkCommon_t *initialUplinkBWP, + const NR_CellGroupConfig_t *cg, dci_pdu_rel15_t *dci_pdu, nr_dci_format_t format, nr_rnti_type_t rnti_type, @@ -2369,8 +2520,9 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, NR_PUSCH_Config_t *pusch_Config = NULL; NR_SRS_Config_t *srs_config = NULL; if(bwp_id > 0) { - bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; + AssertFatal(cg!=NULL,"Cellgroup is null and bwp_id!=0"); + bwp=cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + ubwp=cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup; pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup; srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup; @@ -2382,7 +2534,7 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, /// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20 size += 20; size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment -- hopping scenario to be updated - size += nr_dci_size(scc,secondaryCellGroup,dci_pdu,NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, bwp_id) - size; // Padding to match 1_0 size + size += nr_dci_size(initialUplinkBWP,cg,dci_pdu,NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, bwp_id) - size; // Padding to match 1_0 size // UL/SUL indicator assumed to be 0 break; @@ -2390,24 +2542,24 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, /// fixed: Format identifier 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2, ULSCH indicator 1 --16 size += 16; // Carrier indicator - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) { + if (cg->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) { dci_pdu->carrier_indicator.nbits=3; size += dci_pdu->carrier_indicator.nbits; } // UL/SUL indicator - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink != NULL) { + if (cg->spCellConfig->spCellConfigDedicated->supplementaryUplink != NULL) { dci_pdu->carrier_indicator.nbits=1; size += dci_pdu->ul_sul_indicator.nbits; } // BWP Indicator - uint8_t n_ul_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; + uint8_t n_ul_bwp = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; if (n_ul_bwp < 2) dci_pdu->bwp_indicator.nbits = n_ul_bwp; else dci_pdu->bwp_indicator.nbits = 2; size += dci_pdu->bwp_indicator.nbits; // Freq domain assignment - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pusch_Config->choice.setup->rbg_Size != NULL) + if (cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pusch_Config->choice.setup->rbg_Size != NULL) rbg_size_config = 1; else rbg_size_config = 0; @@ -2438,13 +2590,13 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, size += 1; } // 1st DAI - if (secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook==NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) + if (cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook==NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) dci_pdu->dai[0].nbits = 2; else dci_pdu->dai[0].nbits = 1; size += dci_pdu->dai[0].nbits; // 2nd DAI - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { //TODO not sure about that + if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { //TODO not sure about that dci_pdu->dai[1].nbits = 2; size += dci_pdu->dai[1].nbits; } @@ -2464,9 +2616,9 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, else { int lmin,Lmax = 0; int lsum = 0; - if ( secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig != NULL) { - if ( secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers != NULL) - Lmax = *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers; + if ( cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig != NULL) { + if ( cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers != NULL) + Lmax = *cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers; else AssertFatal(1==0,"MIMO on PUSCH not supported, maxMIMO_Layers needs to be set to 1\n"); } @@ -2486,7 +2638,7 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, } } // Precoding info and number of layers - long transformPrecoder = get_transformPrecoding(scc, pusch_Config, ubwp, (uint8_t*)&format, rnti_type, 0); + long transformPrecoder = get_transformPrecoding(initialUplinkBWP, pusch_Config, ubwp, (uint8_t*)&format, rnti_type, 0); if (pusch_Config->txConfig != NULL){ if (*pusch_Config->txConfig == NR_PUSCH_Config__txConfig_codebook){ @@ -2530,21 +2682,21 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, dci_pdu->antenna_ports.nbits = xb; size += dci_pdu->antenna_ports.nbits; // SRS request - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL) + if (cg->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL) dci_pdu->srs_request.nbits = 2; else dci_pdu->srs_request.nbits = 3; size += dci_pdu->srs_request.nbits; // CSI request - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig != NULL) { - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize != NULL) { - dci_pdu->csi_request.nbits = *secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize; + if (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig != NULL) { + if (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize != NULL) { + dci_pdu->csi_request.nbits = *cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize; size += dci_pdu->csi_request.nbits; } } // CBGTI - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { - int num = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; + if (cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { + int num = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; dci_pdu->cbgti.nbits = 2 + (num<<1); size += dci_pdu->cbgti.nbits; } @@ -2577,7 +2729,6 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, dci_pdu->frequency_domain_assignment.nbits = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); dci_pdu->time_domain_assignment.nbits = 4; dci_pdu->vrb_to_prb_mapping.nbits = 1; - break; case NR_DL_DCI_FORMAT_1_1: @@ -2585,19 +2736,19 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, // Format identifier size = 1; // Carrier indicator - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) { + if (cg->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) { dci_pdu->carrier_indicator.nbits=3; size += dci_pdu->carrier_indicator.nbits; } // BWP Indicator - uint8_t n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; + uint8_t n_dl_bwp = cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; if (n_dl_bwp < 2) dci_pdu->bwp_indicator.nbits = n_dl_bwp; else dci_pdu->bwp_indicator.nbits = 2; size += dci_pdu->bwp_indicator.nbits; // Freq domain assignment - rbg_size_config = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size; + rbg_size_config = cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size; numRBG = getNRBG(NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE), NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE), rbg_size_config); @@ -2653,7 +2804,7 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, // HARQ PID size += 4; // DAI - if (secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell + if (cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell dci_pdu->dai[0].nbits = 2; size += dci_pdu->dai[0].nbits; } @@ -2677,20 +2828,20 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, size += dci_pdu->transmission_configuration_indication.nbits; } // SRS request - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL) + if (cg->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL) dci_pdu->srs_request.nbits = 2; else dci_pdu->srs_request.nbits = 3; size += dci_pdu->srs_request.nbits; // CBGTI - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { - uint8_t maxCBGperTB = (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2; + if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { + uint8_t maxCBGperTB = (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2; long *maxCWperDCI_rrc = pdsch_config->maxNrofCodeWordsScheduledByDCI; uint8_t maxCW = (maxCWperDCI_rrc == NULL) ? 1 : *maxCWperDCI_rrc; dci_pdu->cbgti.nbits = maxCBGperTB * maxCW; size += dci_pdu->cbgti.nbits; // CBGFI - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator) { + if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator) { dci_pdu->cbgfi.nbits = 1; size += dci_pdu->cbgfi.nbits; } @@ -2741,81 +2892,85 @@ int ul_ant_bits(NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig, long transformPrec int tdd_period_to_num[8] = {500,625,1000,1250,2000,2500,5000,10000}; -int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slot) { +int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slot) { int period,period1,period2=0; - if (scc->tdd_UL_DL_ConfigurationCommon==NULL) return(1); + if (tdd_UL_DL_ConfigurationCommon==NULL) return(1); - if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 && - scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530) - period1 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; + if (tdd_UL_DL_ConfigurationCommon->pattern1.ext1 && + tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530) + period1 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; else - period1 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity]; + period1 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity]; - if (scc->tdd_UL_DL_ConfigurationCommon->pattern2) { - if (scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1 && - scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530) - period2 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530; + if (tdd_UL_DL_ConfigurationCommon->pattern2) { + if (tdd_UL_DL_ConfigurationCommon->pattern2->ext1 && + tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530) + period2 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530; else - period2 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity]; + period2 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity]; } period = period1+period2; - int scs=scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; + int scs=tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; int slots=period*(1<<scs)/1000; int slots1=period1*(1<<scs)/1000; int slot_in_period = slot % slots; - if (slot_in_period < slots1) return(slot_in_period <= scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0); - else return(slot_in_period <= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); + if (slot_in_period < slots1) return(slot_in_period <= tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0); + else return(slot_in_period <= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } -int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slot, lte_frame_type_t frame_type) { +int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, lte_frame_type_t frame_type) { int period,period1,period2=0; // Note: condition on frame_type // goal: the UL scheduler assumes mode is TDD therefore this hack is needed to make FDD work - if (scc->tdd_UL_DL_ConfigurationCommon == NULL || frame_type == FDD) { + if (tdd_UL_DL_ConfigurationCommon == NULL || frame_type == FDD) { return(1); } - if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 && - scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530) - period1 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; + if (tdd_UL_DL_ConfigurationCommon->pattern1.ext1 && + tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530) + period1 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; else - period1 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity]; + period1 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity]; - if (scc->tdd_UL_DL_ConfigurationCommon->pattern2) { - if (scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1 && - scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530) - period2 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530; + if (tdd_UL_DL_ConfigurationCommon->pattern2) { + if (tdd_UL_DL_ConfigurationCommon->pattern2->ext1 && + tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530) + period2 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530; else - period2 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity]; + period2 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity]; } period = period1+period2; - int scs=scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; + int scs=tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; int slots=period*(1<<scs)/1000; int slots1=period1*(1<<scs)/1000; int slot_in_period = slot % slots; - if (slot_in_period < slots1) return(slot_in_period >= scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0); - else return(slot_in_period >= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); + if (slot_in_period < slots1) return(slot_in_period >= tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0); + else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } -int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols) { +int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol) { int l0; + int ld = NrOfSymbols+startSymbol; if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2; else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3; else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position); if (pdsch_Config == NULL) { // Initial BWP - return(1<<l0); + if (ld <= 7) return(1<<l0); + else if (ld <= 9) return(1<<l0 | 1<<7); + else if (ld <= 12) return(1<<l0 | 1<<6 | 1<<9); + else if (ld <= 14) return(1<<l0 | 1<<7 | 1<<11); } else { if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) { // Relative to start of slot NR_DMRS_DownlinkConfig_t *dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; - AssertFatal(NrOfSymbols>1 && NrOfSymbols < 15,"Illegal NrOfSymbols %d\n",NrOfSymbols); + AssertFatal(ld>1 && ld < 15,"Illegal l_d %d\n",ld); int pos2=0; if (dmrs_config->maxLength == NULL) { // this is Table 7.4.1.1.2-3: PDSCH DM-RS positions l for single-symbol DM-RS @@ -2824,7 +2979,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i return(1<<l0); - switch (NrOfSymbols) { + switch (ld) { case 2 : case 3 : case 4 : @@ -2865,10 +3020,10 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i } else { // Table 7.4.1.1.2-4: PDSCH DM-RS positions l for double-symbol DM-RS. - AssertFatal(NrOfSymbols>3,"Illegal NrOfSymbols %d for len2 DMRS\n",NrOfSymbols); - if (NrOfSymbols < 10) return(1<<l0); - if (NrOfSymbols < 13 && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0); - if (NrOfSymbols < 13 && *dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0 | 1<<8); + AssertFatal(ld>3,"Illegal l_d %d for len2 DMRS\n",ld); + if (ld < 10) return(1<<l0); + if (ld < 13 && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0); + if (ld < 13 && *dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0 | 1<<8); if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0); if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<<l0 | 1<<10); if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0); @@ -3001,60 +3156,67 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, valid = false; return valid; } - //printf("[MAC] PTRS is set K= %u L= %u\n", *K_ptrs,1<<*L_ptrs); + + /* Moved below check from scheduler function to here */ + if (*L_ptrs >= NrOfSymbols) { + valid = false; + return valid; + } return valid; } -uint32_t get_ssb_slot(uint32_t ssb_index){ - // this function now only support f <= 3GHz - return ssb_index & 0x3 ; +uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb) { - // return first_symbol(case, freq, ssb_index) / 14 + switch (scs) { + case NR_SubcarrierSpacing_kHz15: + return symbol_ssb_AC[i_ssb]; //type A + case NR_SubcarrierSpacing_kHz30: + if (band == 5 || band == 66) + return symbol_ssb_BD[i_ssb]; //type B + else + return symbol_ssb_AC[i_ssb]; //type C + case NR_SubcarrierSpacing_kHz120: + return symbol_ssb_BD[i_ssb]; //type D + case NR_SubcarrierSpacing_kHz240: + return symbol_ssb_E[i_ssb]; + default: + AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n",scs); + } } -int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - NR_MIB_t *mib, - uint8_t extra_bits, - uint32_t ssb_length, - uint32_t ssb_index, - uint32_t ssb_offset_point_a) { +void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + frame_t frameP, + NR_MIB_t *mib, + uint8_t num_slot_per_frame, + uint8_t ssb_subcarrier_offset, + uint16_t ssb_start_symbol, + NR_SubcarrierSpacing_t scs_ssb, + frequency_range_t frequency_range, + uint32_t ssb_index, + uint32_t ssb_offset_point_a) { - // deafult for testing - subcarrier_spacing_t scs_ssb = scs_30kHz; - channel_bandwidth_t min_channel_bw = bw_10MHz; - frequency_range_t frequency_range = FR1; - const uint32_t num_slot_per_frame = 20; + NR_SubcarrierSpacing_t scs_pdcch; - type0_PDCCH_CSS_config->ssb_length = ssb_length; - type0_PDCCH_CSS_config->ssb_index = ssb_index; - type0_PDCCH_CSS_config->frame = (mib->systemFrameNumber.buf[0] >> mib->systemFrameNumber.bits_unused); + channel_bandwidth_t min_channel_bw = bw_10MHz; // TODO remove hardcoding and implement Table 5.3.5-1 in 38.104 - uint16_t frame_number_4lsb = 0; - for (int i=0; i<4; i++) { - frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); + if (frequency_range == FR2) { + if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60) + scs_pdcch = NR_SubcarrierSpacing_kHz60; + else + scs_pdcch = NR_SubcarrierSpacing_kHz120; } - - uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] - uint8_t ssb_subcarrier_offset = (uint8_t)mib->ssb_SubcarrierOffset; - - type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame << 4; - type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame | frame_number_4lsb; - - if(type0_PDCCH_CSS_config->ssb_length == 64){ - type0_PDCCH_CSS_config->ssb_index = type0_PDCCH_CSS_config->ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] } - }else{ - if(ssb_subcarrier_offset_msb){ - ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; - } + else { + frequency_range = FR1; + if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60) + scs_pdcch = NR_SubcarrierSpacing_kHz15; + else + scs_pdcch = NR_SubcarrierSpacing_kHz30; } - // assume carrier frequency < 6GHz - subcarrier_spacing_t scs_pdcch; - if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){ - scs_pdcch = scs_15kHz; - }else{ //NR_MIB__subCarrierSpacingCommon_scs30or120 - scs_pdcch = scs_30kHz; - } + type0_PDCCH_CSS_config->ssb_index = ssb_index; + type0_PDCCH_CSS_config->frame = frameP; + + uint8_t ssb_slot = ssb_start_symbol/14; uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 uint32_t index_4msb = (mib->pdcch_ConfigSIB1.controlResourceSetZero); @@ -3065,8 +3227,8 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = -1; // type0-pdcch coreset - switch( (scs_ssb << 5) | scs_pdcch ){ - case (scs_15kHz << 5) | scs_15kHz : + switch( (scs_ssb << 3) | scs_pdcch ){ + case (NR_SubcarrierSpacing_kHz15 << 5) | NR_SubcarrierSpacing_kHz15: AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_1_c2[index_4msb]; @@ -3074,7 +3236,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = table_38213_13_1_c4[index_4msb]; break; - case (scs_15kHz << 5) | scs_30kHz: + case (NR_SubcarrierSpacing_kHz15 << 3) | NR_SubcarrierSpacing_kHz30: AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_2_c2[index_4msb]; @@ -3082,7 +3244,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = table_38213_13_2_c4[index_4msb]; break; - case (scs_30kHz << 5) | scs_15kHz: + case (NR_SubcarrierSpacing_kHz30 << 3) | NR_SubcarrierSpacing_kHz15: if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3099,7 +3261,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC break; - case (scs_30kHz << 5) | scs_30kHz: + case (NR_SubcarrierSpacing_kHz30 << 3) | NR_SubcarrierSpacing_kHz30: if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_4_c2[index_4msb]; @@ -3115,7 +3277,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC }else{ ; } break; - case (scs_120kHz << 5) | scs_60kHz: + case (NR_SubcarrierSpacing_kHz120 << 3) | NR_SubcarrierSpacing_kHz60: AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n"); if(index_4msb & 0x7){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3132,7 +3294,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC } break; - case (scs_120kHz << 5) | scs_120kHz: + case (NR_SubcarrierSpacing_kHz120 << 3) | NR_SubcarrierSpacing_kHz120: AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n"); if(index_4msb & 0x3){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3149,7 +3311,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC } break; - case (scs_240kHz << 5) | scs_60kHz: + case (NR_SubcarrierSpacing_kHz240 << 3) | NR_SubcarrierSpacing_kHz60: AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_9_c2[index_4msb]; @@ -3157,7 +3319,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = table_38213_13_9_c4[index_4msb]; break; - case (scs_240kHz << 5) | scs_120kHz: + case (NR_SubcarrierSpacing_kHz240 << 3) | NR_SubcarrierSpacing_kHz120: AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n"); if(index_4msb & 0x3){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3228,7 +3390,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; big_m = table_38213_13_11_c3[index_4lsb]; - uint32_t temp = (uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); + uint32_t temp = (uint32_t)(big_o*(1<<scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); type0_PDCCH_CSS_config->n_c = temp / num_slot_per_frame; if((temp/num_slot_per_frame) & 0x1){ type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_1; @@ -3264,12 +3426,12 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC /// MUX PATTERN 2 if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 2){ - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ + if((scs_ssb == NR_SubcarrierSpacing_kHz120) && (scs_pdcch == NR_SubcarrierSpacing_kHz60)){ // 38.213 Table 13-13 AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // sfn_c = SFN_C_EQ_SFN_SSB; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + type0_PDCCH_CSS_config->n_c = ssb_slot; switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: type0_PDCCH_CSS_config->first_symbol_index = 0; @@ -3286,12 +3448,12 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC default: break; } - }else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ + }else if((scs_ssb == NR_SubcarrierSpacing_kHz240) && (scs_pdcch == NR_SubcarrierSpacing_kHz120)){ // 38.213 Table 13-14 AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // sfn_c = SFN_C_EQ_SFN_SSB; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + type0_PDCCH_CSS_config->n_c = ssb_slot; switch(type0_PDCCH_CSS_config->ssb_index & 0x7){ // ssb_index(i) mod 8 case 0: type0_PDCCH_CSS_config->first_symbol_index = 0; @@ -3307,11 +3469,11 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC break; case 4: type0_PDCCH_CSS_config->first_symbol_index = 12; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + type0_PDCCH_CSS_config->n_c = ssb_slot - 1; break; case 5: type0_PDCCH_CSS_config->first_symbol_index = 13; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + type0_PDCCH_CSS_config->n_c = ssb_slot - 1; break; case 6: type0_PDCCH_CSS_config->first_symbol_index = 0; @@ -3328,12 +3490,12 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC /// MUX PATTERN 3 if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 3){ - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){ + if((scs_ssb == NR_SubcarrierSpacing_kHz120) && (scs_pdcch == NR_SubcarrierSpacing_kHz120)){ // 38.213 Table 13-15 AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // sfn_c = SFN_C_EQ_SFN_SSB; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + type0_PDCCH_CSS_config->n_c = ssb_slot; switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: type0_PDCCH_CSS_config->first_symbol_index = 4; @@ -3370,8 +3532,83 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,""); AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,""); - type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; + type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*(1<<scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; type0_PDCCH_CSS_config->cset_start_rb = ssb_offset_point_a - type0_PDCCH_CSS_config->rb_offset; - return 0; } + +/* extract UL PTRS values from RRC and validate it based upon 38.214 6.2.3 */ +bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, + uint16_t rbSize,uint8_t mcsIndex, uint8_t mcsTable, + uint8_t *K_ptrs, uint8_t *L_ptrs, + uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower, + uint8_t NrOfSymbols) +{ + bool valid = true; + + /* as defined in T 38.214 6.2.3 */ + if(rbSize < 3) { + valid = false; + return valid; + } + /* Check for Frequency Density values */ + if(ul_ptrs_config->transformPrecoderDisabled->frequencyDensity->list.count < 2) { + /* Default value for K_PTRS = 2 as defined in T 38.214 6.2.3 */ + *K_ptrs = 2; + } + else { + *K_ptrs = get_K_ptrs(*ul_ptrs_config->transformPrecoderDisabled->frequencyDensity->list.array[0], + *ul_ptrs_config->transformPrecoderDisabled->frequencyDensity->list.array[1], + rbSize); + } + /* Check for time Density values */ + if(ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.count < 3) { + *L_ptrs = 0; + } + else { + *L_ptrs = get_L_ptrs(*ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.array[0], + *ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.array[1], + *ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.array[2], + mcsIndex, + mcsTable); + } + + *reOffset = *ul_ptrs_config->transformPrecoderDisabled->resourceElementOffset; + *maxNumPorts = ul_ptrs_config->transformPrecoderDisabled->maxNrofPorts; + *ulPower = ul_ptrs_config->transformPrecoderDisabled->ptrs_Power; + /* If either or both of the parameters PT-RS time density (LPT-RS) and PT-RS frequency density (KPT-RS), shown in Table + * 6.2.3.1-1 and Table 6.2.3.1-2, indicates that 'PT-RS not present', the UE shall assume that PT-RS is not present + */ + if(*K_ptrs ==2 || *K_ptrs ==4 ) { + valid = true; + } + else { + valid = false; + return valid; + } + if(*L_ptrs ==0 || *L_ptrs ==1 || *L_ptrs ==2 ) { + valid = true; + } + else { + valid = false; + return valid; + } + /* PTRS is not present also : + * When the UE is receiving a PUSCH with allocation duration of 4 symbols and if LPT-RS is set to 4, the UE shall assume + * PT-RS is not transmitted + * When the UE is receiving a PUSCH with allocation duration of 2 symbols as defined in Clause 6.4.1.2.2 of [4, TS + * 38.211] and if LPT-RS is set to 2 or 4, the UE shall assume PT-RS is not transmitted. + */ + if((NrOfSymbols == 4 && *L_ptrs ==2) || ((NrOfSymbols == 2 && *L_ptrs > 0))) { + valid = false; + return valid; + } + + /* Moved below check from nr_ue_scheduler function to here */ + if (*L_ptrs >= NrOfSymbols) { + valid = false; + return valid; + } + return valid; +} + diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index ffb36963a7eb24660de056f4d83d1bed41ab4186..c6cb0341ac537e38d4566baa18c24c5158a4cba3 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -47,14 +47,14 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); -int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols); +int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol); -int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); +int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP); -int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slotP, lte_frame_type_t frame_type); +int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, lte_frame_type_t frame_type); -uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, - const NR_CellGroupConfig_t *secondaryCellGroup, +uint16_t nr_dci_size(const NR_BWP_UplinkCommon_t *initialULBWP, + const NR_CellGroupConfig_t *cg, dci_pdu_rel15_t *dci_pdu, nr_dci_format_t format, nr_rnti_type_t rnti_type, @@ -81,7 +81,7 @@ int get_nr_prach_info_from_index(uint8_t index, uint8_t *N_dur, uint16_t *RA_sfn_index, uint8_t *N_RA_slot, - uint8_t *config_period); + uint8_t *config_period); int get_nr_prach_occasion_info_from_index(uint8_t index, uint32_t pointa, @@ -113,7 +113,7 @@ int ul_ant_bits(NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig,long transformPreco int get_format0(uint8_t index, uint8_t unpaired,frequency_range_t); -int64_t *get_prach_config_info(uint32_t pointa, +int64_t *get_prach_config_info(int fr2_flag, uint8_t index, uint8_t unpaired); @@ -126,12 +126,18 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr 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); -int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - NR_MIB_t *mib, - uint8_t extra_bits, - uint32_t ssb_length, - uint32_t ssb_index, - uint32_t ssb_offset_point_a); +void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + frame_t frameP, + NR_MIB_t *mib, + uint8_t num_slot_per_frame, + uint8_t ssb_subcarrier_offset, + uint16_t ssb_start_symbol, + NR_SubcarrierSpacing_t scs_ssb, + frequency_range_t frequency_range, + uint32_t ssb_index, + uint32_t ssb_offset_point_a); + +uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb); int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH); @@ -141,7 +147,13 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, uint8_t *nERatio,uint8_t *reOffset, uint8_t NrOfSymbols); -uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols); +bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, + uint16_t rbSize,uint8_t mcsIndex, uint8_t mcsTable, + uint8_t *K_ptrs, uint8_t *L_ptrs, + uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower, + uint8_t NrOfSymbols); + +uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol); /* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16 @param *pusch_config, pointer to pusch config @@ -150,7 +162,7 @@ uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Posi @param rnti_type rnti type @param configuredGrant indicates whether a configured grant was received or not @returns transformPrecoding value */ -uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc, +uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP, const NR_PUSCH_Config_t *pusch_config, const NR_BWP_Uplink_t *ubwp, uint8_t *dci_format, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index 8f7a726bb8f94dc29b3c17a12f439ba292ee773d..1e0ab98d4c0b1724f75993bbc35bf7bf53f7f34d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -139,4 +139,13 @@ extern const float table_38213_13_12_c3[16]; extern const int32_t table_38213_10_1_1_c2[5]; +extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3]; +extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3]; +extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3]; +extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3]; + #endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index fee2efc4a8175200f503bb38bd044b8b3f529c7c..5e08379eee0f85e665b5c4c6639c1878b97676ff 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -31,9 +31,13 @@ */ //#include "mac_defs.h" +#include <NR_MAC_gNB/mac_proto.h> #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC-CellGroupConfig.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" +#include <executables/softmodem-common.h> + +extern uint32_t N_RB_DL; int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, int mu, @@ -147,6 +151,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; NR_ServingCellConfigCommon_t *scc = mac->scc; + NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB; int i; mac->phy_config.Mod_id = module_id; @@ -155,18 +160,186 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, // carrier config LOG_D(MAC, "Entering UE Config Common\n"); - cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); + AssertFatal(scc==NULL || scc_SIB==NULL,"Both scc and scc_SIB cannot be null\n"); + + if (scc) { + cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, + *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); + + cfg->carrier_config.dl_frequency = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing, + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz + + for (i=0; i<5; i++) { + if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + } + else { + cfg->carrier_config.dl_grid_size[i] = 0; + cfg->carrier_config.dl_k0[i] = 0; + } + } + + cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, + *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]); + + int UL_pointA; + if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL) + UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + else + UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + + cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0], + *scc->ssbSubcarrierSpacing, + UL_pointA)/1000; // freq in kHz + + + for (i=0; i<5; i++) { + if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + } + else { + cfg->carrier_config.ul_grid_size[i] = 0; + cfg->carrier_config.ul_k0[i] = 0; + } + } + + uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + frequency_range_t frequency_range = band<100?FR1:FR2; + + lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + + // cell config + + cfg->cell_config.phy_cell_id = *scc->physCellId; + cfg->cell_config.frame_duplex_type = frame_type; + + // SSB config + cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; + cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing; + + // SSB Table config + int scs_scaling = 1<<(cfg->ssb_config.scs_common); + if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000) + scs_scaling = scs_scaling*3; + if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666) + scs_scaling = scs_scaling>>2; + uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); + cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10; + cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; + cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC? + + switch (scc->ssb_PositionsInBurst->present) { + case 1 : + cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24; + cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; + break; + case 2 : + cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]<<24; + cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; + break; + case 3 : + cfg->ssb_table.ssb_mask_list[0].ssb_mask = 0; + cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; + for (i=0; i<4; i++) { + cfg->ssb_table.ssb_mask_list[0].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[3-i]<<i*8); + cfg->ssb_table.ssb_mask_list[1].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[7-i]<<i*8); + } + break; + default: + AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present); + } + + // TDD Table Configuration + if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL) + cfg->tdd_table.tdd_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; + else { + AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL, + "scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n"); + cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; + } + if(cfg->cell_config.frame_duplex_type == TDD){ + LOG_I(MAC,"Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period); + int return_tdd = set_tdd_config_nr_ue(cfg, + scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols + ); + + if (return_tdd !=0) + LOG_E(PHY,"TDD configuration can not be done\n"); + else + LOG_I(PHY,"TDD has been properly configurated\n"); + } + + // PRACH configuration + + uint8_t nb_preambles = 64; + if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) + nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; + + cfg->prach_config.prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1; + + if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing) + cfg->prach_config.prach_sub_c_spacing = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing; + else + cfg->prach_config.prach_sub_c_spacing = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + + cfg->prach_config.restricted_set_config = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig; + + switch (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) { + case 0 : + cfg->prach_config.num_prach_fd_occasions = 1; + break; + case 1 : + cfg->prach_config.num_prach_fd_occasions = 2; + break; + case 2 : + cfg->prach_config.num_prach_fd_occasions = 4; + break; + case 3 : + cfg->prach_config.num_prach_fd_occasions = 8; + break; + default: + AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM); + } + + cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t)); + for (i=0; i<cfg->prach_config.num_prach_fd_occasions; i++) { + cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i; + if (cfg->prach_config.prach_sequence_length) + cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; + else + cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; + + cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; + cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; + cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, frame_type,frequency_range); + //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? + } + + cfg->prach_config.ssb_per_rach = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; + + } // scc - cfg->carrier_config.dl_frequency = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *scc->ssbSubcarrierSpacing, - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz + else { // scc_SIB + + cfg->carrier_config.dl_bandwidth = config_bandwidth(scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth, + *scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR); + + cfg->carrier_config.dl_frequency = downlink_frequency[0][0] - (10+scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA)*(15<<scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); for (i=0; i<5; i++) { - if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + if (i==scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.dl_grid_size[i] = scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.dl_k0[i] = scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->offsetToCarrier; } else { cfg->carrier_config.dl_grid_size[i] = 0; @@ -174,25 +347,23 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, } } - cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]); - - int UL_pointA; - if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL) - UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - else - UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth, + scc_SIB->uplinkConfigCommon->frequencyInfoUL.frequencyBandList==NULL ? *scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR : *scc_SIB->uplinkConfigCommon->frequencyInfoUL.frequencyBandList->list.array[0]->freqBandIndicatorNR); - cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0], - *scc->ssbSubcarrierSpacing, - UL_pointA)/1000; // freq in kHz + if (scc_SIB->uplinkConfigCommon->frequencyInfoUL.absoluteFrequencyPointA == NULL) + cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency; + else + cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc_SIB->uplinkConfigCommon->frequencyInfoUL.frequencyBandList->list.array[0]->freqBandIndicatorNR, + scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *scc_SIB->uplinkConfigCommon->frequencyInfoUL.absoluteFrequencyPointA)/1000; // freq in kHz + for (i=0; i<5; i++) { - if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + if (i==scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.ul_grid_size[i] = scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.ul_k0[i] = scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->offsetToCarrier; } else { cfg->carrier_config.ul_grid_size[i] = 0; @@ -200,68 +371,55 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, } } - uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + uint32_t band = *scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR; frequency_range_t frequency_range = band<100?FR1:FR2; - mac->frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + lte_frame_type_t frame_type = get_frame_type(band, get_softmodem_params()->numerology); // cell config - cfg->cell_config.phy_cell_id = *scc->physCellId; - cfg->cell_config.frame_duplex_type = mac->frame_type; + cfg->cell_config.phy_cell_id = mac->physCellId; + cfg->cell_config.frame_duplex_type = frame_type; // SSB config - cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; - cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing; + cfg->ssb_config.ss_pbch_power = scc_SIB->ss_PBCH_BlockPower; + cfg->ssb_config.scs_common = get_softmodem_params()->numerology; // SSB Table config - int scs_scaling = 1<<(cfg->ssb_config.scs_common); - if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000) - scs_scaling = scs_scaling*3; - if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666) - scs_scaling = scs_scaling>>2; - uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); - cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10; - cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; + + cfg->ssb_table.ssb_offset_point_a = scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA; + cfg->ssb_table.ssb_period = scc_SIB->ssb_PeriodicityServingCell; cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC? - switch (scc->ssb_PositionsInBurst->present) { - case 1 : - cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24; - cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; - break; - case 2 : - cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]<<24; - cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; - break; - case 3 : - cfg->ssb_table.ssb_mask_list[0].ssb_mask = 0; - cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; - for (i=0; i<4; i++) { - cfg->ssb_table.ssb_mask_list[0].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[3-i]<<i*8); - cfg->ssb_table.ssb_mask_list[1].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[7-i]<<i*8); - } - break; - default: - AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present); - } + AssertFatal(scc_SIB->ssb_PositionsInBurst.groupPresence==NULL, "Cannot handle more than 8 SSBs for now (%x.%x.%x.%x.%x.%x.%x.%x)\n", + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[0], + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[1], + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[2], + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[3], + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[4], + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[5], + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[6], + scc_SIB->ssb_PositionsInBurst.groupPresence->buf[7]); + cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc_SIB->ssb_PositionsInBurst.inOneGroup.buf[0]<<24; + cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; + // TDD Table Configuration - if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL) - cfg->tdd_table.tdd_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; + if (scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL) + cfg->tdd_table.tdd_period = scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; else { - AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL, - "scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n"); - cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; + AssertFatal(scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL, + "scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n"); + cfg->tdd_table.tdd_period = *scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; } if(cfg->cell_config.frame_duplex_type == TDD){ LOG_I(MAC,"Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period); int return_tdd = set_tdd_config_nr_ue(cfg, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols + scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, + scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, + scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, + scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols ); if (return_tdd !=0) @@ -273,19 +431,19 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, // PRACH configuration uint8_t nb_preambles = 64; - if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) - nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; + if(scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) + nb_preambles = *scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; - cfg->prach_config.prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1; + cfg->prach_config.prach_sequence_length = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1; - if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing) - cfg->prach_config.prach_sub_c_spacing = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing; + if (scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing) + cfg->prach_config.prach_sub_c_spacing = *scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing; else - cfg->prach_config.prach_sub_c_spacing = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + cfg->prach_config.prach_sub_c_spacing = scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - cfg->prach_config.restricted_set_config = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig; + cfg->prach_config.restricted_set_config = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->restrictedSetConfig; - switch (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) { + switch (scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) { case 0 : cfg->prach_config.num_prach_fd_occasions = 1; break; @@ -299,34 +457,37 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, cfg->prach_config.num_prach_fd_occasions = 8; break; default: - AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM); + AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM); } cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t)); for (i=0; i<cfg->prach_config.num_prach_fd_occasions; i++) { cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i; if (cfg->prach_config.prach_sequence_length) - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; + cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; else - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - - cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; - cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; - cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); + cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; + cfg->prach_config.num_prach_fd_occasions_list[i].k1 = NRRIV2PRBOFFSET(scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; + cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? } - cfg->prach_config.ssb_per_rach = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; + cfg->prach_config.ssb_per_rach = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; + + } + } /** \brief This function performs some configuration routines according to clause 12 "Bandwidth part operation" 3GPP TS 38.213 version 16.3.0 Release 16 @param NR_UE_MAC_INST_t mac: pointer to local MAC instance @returns void */ + void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format){ - NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated; + NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated; if (bwp_ind && dci_format){ @@ -361,6 +522,70 @@ void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format } + +void fill_default_coreset_zero(NR_UE_MAC_INST_t *mac) { + + // Search space zero + + if(mac->search_space_zero == NULL) mac->search_space_zero=calloc(1,sizeof(*mac->search_space_zero)); + if(mac->search_space_zero->controlResourceSetId == NULL) mac->search_space_zero->controlResourceSetId=calloc(1,sizeof(*mac->search_space_zero->controlResourceSetId)); + if(mac->search_space_zero->monitoringSymbolsWithinSlot == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot = calloc(1,sizeof(*mac->search_space_zero->monitoringSymbolsWithinSlot)); + if(mac->search_space_zero->monitoringSymbolsWithinSlot->buf == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot->buf = calloc(1,2); + if(mac->search_space_zero->nrofCandidates == NULL) mac->search_space_zero->nrofCandidates = calloc(1,sizeof(*mac->search_space_zero->nrofCandidates)); + if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType)); + if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common)); + if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); + mac->search_space_zero->searchSpaceId = 0; + *mac->search_space_zero->controlResourceSetId = 0; + mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset)); + mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + mac->search_space_zero->duration=NULL; + // should be '1100 0000 0000 00'B (LSB first!), first two symbols in slot, adjust if needed + mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0; + mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7); + mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2; + mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2; + + // FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1 + mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; + mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; + + // Coreset0 + if(mac->coreset0 == NULL) mac->coreset0 = calloc(1,sizeof(*mac->coreset0)); + mac->coreset0->controlResourceSetId = 0; + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, + if(mac->coreset0->frequencyDomainResources.buf == NULL) mac->coreset0->frequencyDomainResources.buf = calloc(1,6); + mac->coreset0->frequencyDomainResources.buf[0] = 0xff; + mac->coreset0->frequencyDomainResources.buf[1] = 0; + mac->coreset0->frequencyDomainResources.buf[2] = 0; + mac->coreset0->frequencyDomainResources.buf[3] = 0; + mac->coreset0->frequencyDomainResources.buf[4] = 0; + mac->coreset0->frequencyDomainResources.buf[5] = 0; + mac->coreset0->frequencyDomainResources.size = 6; + mac->coreset0->frequencyDomainResources.bits_unused = 3; + mac->coreset0->duration = 1; + mac->coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved; + mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved)); + mac->coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; + mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = NULL; + mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&mac->coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + mac->coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + mac->coreset0->tci_PresentInDCI = NULL; + mac->coreset0->pdcch_DMRS_ScramblingID = NULL; +} + /** \brief This function is relavant for the UE procedures for control. It loads the search spaces, the BWPs and the CORESETs into the MAC instance and \brief performs assert checks on the relevant RRC configuration. @param NR_UE_MAC_INST_t mac: pointer to local MAC instance @@ -370,7 +595,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ uint8_t coreset_id = 1, ss_id; - NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated; + NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated; 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); @@ -442,65 +667,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ ss_id++; } - // TODO: Merge this code in a single function as fill_default_searchSpaceZero() in rrc_gNB_reconfig.c - // Search space zero - if(mac->search_space_zero == NULL) mac->search_space_zero=calloc(1,sizeof(*mac->search_space_zero)); - if(mac->search_space_zero->controlResourceSetId == NULL) mac->search_space_zero->controlResourceSetId=calloc(1,sizeof(*mac->search_space_zero->controlResourceSetId)); - if(mac->search_space_zero->monitoringSymbolsWithinSlot == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot = calloc(1,sizeof(*mac->search_space_zero->monitoringSymbolsWithinSlot)); - if(mac->search_space_zero->monitoringSymbolsWithinSlot->buf == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot->buf = calloc(1,2); - if(mac->search_space_zero->nrofCandidates == NULL) mac->search_space_zero->nrofCandidates = calloc(1,sizeof(*mac->search_space_zero->nrofCandidates)); - if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType)); - if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common)); - if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); - mac->search_space_zero->searchSpaceId = 0; - *mac->search_space_zero->controlResourceSetId = 0; - mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset)); - mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; - mac->search_space_zero->duration=NULL; - // should be '1100 0000 0000 00'B (LSB first!), first two symbols in slot, adjust if needed - mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0; - mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7); - mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2; - mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2; - - // FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1 - mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; - mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; - mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; - mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; - mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; - - // Coreset0 - if(mac->coreset0 == NULL) mac->coreset0 = calloc(1,sizeof(*mac->coreset0)); - mac->coreset0->controlResourceSetId = 0; - // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, - if(mac->coreset0->frequencyDomainResources.buf == NULL) mac->coreset0->frequencyDomainResources.buf = calloc(1,6); - mac->coreset0->frequencyDomainResources.buf[0] = 0xff; - mac->coreset0->frequencyDomainResources.buf[1] = 0; - mac->coreset0->frequencyDomainResources.buf[2] = 0; - mac->coreset0->frequencyDomainResources.buf[3] = 0; - mac->coreset0->frequencyDomainResources.buf[4] = 0; - mac->coreset0->frequencyDomainResources.buf[5] = 0; - mac->coreset0->frequencyDomainResources.size = 6; - mac->coreset0->frequencyDomainResources.bits_unused = 3; - mac->coreset0->duration = 1; - mac->coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved; - mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved)); - mac->coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; - mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; - mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = NULL; - mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; - if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList)); - NR_TCI_StateId_t *tci[8]; - for (int i=0;i<8;i++) { - tci[i]=calloc(1,sizeof(*tci[i])); - *tci[i] = i; - ASN_SEQUENCE_ADD(&mac->coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); - } - mac->coreset0->tci_StatesPDCCH_ToReleaseList = NULL; - mac->coreset0->tci_PresentInDCI = NULL; - mac->coreset0->pdcch_DMRS_ScramblingID = NULL; + fill_default_coreset_zero(mac); } @@ -509,10 +676,11 @@ int nr_rrc_mac_config_req_ue( int cc_idP, uint8_t gNB_index, NR_MIB_t *mibP, - // NR_ServingCellConfigCommon_t *sccP, + NR_ServingCellConfigCommonSIB_t *sccP, // NR_MAC_CellGroupConfig_t *mac_cell_group_configP, // NR_PhysicalCellGroupConfig_t *phy_cell_group_configP, - NR_CellGroupConfig_t *cell_group_config ){ + NR_CellGroupConfig_t *cell_group_config, + NR_CellGroupConfig_t *scell_group_config){ NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); RA_config_t *ra = &mac->ra; @@ -520,24 +688,58 @@ int nr_rrc_mac_config_req_ue( // TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc. if(mibP != NULL){ + + // if this is the first MIB intialize coreset0 for SA + if (mac->mib == NULL) fill_default_coreset_zero(mac); + mac->mib = mibP; // update by every reception + mac->phy_config.Mod_id = module_id; + mac->phy_config.CC_id = cc_idP; + mac->phy_config.config_req.ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC? + mac->phy_config.config_req.tdd_table.tdd_period_in_slots=5<<get_softmodem_params()->numerology; + mac->phy_config.config_req.ssb_table.ssb_offset_point_a = (N_RB_DL-20)>>1; } - - if(cell_group_config != NULL ){ - mac->scg = cell_group_config; - mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex; + AssertFatal(scell_group_config == NULL || cell_group_config == NULL, + "both scell_group_config and cell_group_config cannot be non-NULL\n"); + + if (sccP != NULL) { + + mac->scc_SIB=sccP; + LOG_I(MAC,"Keeping ServingCellConfigCommonSIB\n"); + config_common_ue(mac,module_id,cc_idP); + int num_slots_ul = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + if (mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols>0) num_slots_ul++; + LOG_I(MAC, "Initializing ul_config_request. num_slots_ul = %d\n", num_slots_ul); + mac->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t)); + // Setup the SSB to Rach Occasions mapping according to the config + build_ssb_to_ro_map(mac);//->scc, mac->phy_config.config_req.cell_config.frame_duplex_type); + mac->if_module->phy_config_request(&mac->phy_config); + mac->common_configuration_complete = 1; + } + if(scell_group_config != NULL ){ + mac->cg = cell_group_config; + mac->servCellIndex = *scell_group_config->spCellConfig->servCellIndex; config_control_ue(mac); - if (cell_group_config->spCellConfig->reconfigurationWithSync) { - ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; - mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon; - config_common_ue(mac,module_id,cc_idP); - mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity; - LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti); + if (scell_group_config->spCellConfig->reconfigurationWithSync) { + if (scell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) { + ra->rach_ConfigDedicated = scell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; + } + mac->scc = scell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon; + mac->physCellId = *mac->scc->physCellId; + config_common_ue(mac,module_id,cc_idP); + mac->crnti = scell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity; + LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti); } // Setup the SSB to Rach Occasions mapping according to the config - build_ssb_to_ro_map(mac->scc, mac->phy_config.config_req.cell_config.frame_duplex_type); - + build_ssb_to_ro_map(mac); + } + else if (cell_group_config != NULL ){ + LOG_I(MAC,"Applying CellGroupConfig from gNodeB\n"); + mac->cg = cell_group_config; + mac->servCellIndex = cell_group_config->spCellConfig->servCellIndex ? *cell_group_config->spCellConfig->servCellIndex : 0; + // config_control_ue(mac); + // config_common_ue(mac,module_id,cc_idP); /* if(mac_cell_group_configP != NULL){ if(mac_cell_group_configP->drx_Config != NULL ){ diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 3e299d291e012f2c7f94efcfda47ac13b2058003..d3a870d95edc9354740532e57af915676460961f 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -234,9 +234,12 @@ typedef struct { typedef enum { RA_UE_IDLE = 0, - WAIT_RAR = 1, - WAIT_CONTENTION_RESOLUTION = 2, - RA_SUCCEEDED = 3 + GENERATE_IDLE = 0, + GENERATE_PREAMBLE = 1, + WAIT_RAR = 2, + WAIT_CONTENTION_RESOLUTION = 3, + RA_SUCCEEDED = 4, + RA_FAILED = 5 } RA_state_t; typedef struct { @@ -257,8 +260,10 @@ typedef struct { uint8_t RA_attempt_number; /// Random-access procedure flag uint8_t RA_active; + /// Random-access preamble index + int ra_PreambleIndex; /// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot - uint8_t generate_nr_prach; + RA_state_t generate_nr_prach; /// Random-access window counter int16_t RA_window_cnt; @@ -289,6 +294,8 @@ typedef struct { uint8_t RA_contention_resolution_timer_active; /// Random-access Contention Resolution Timer count value uint8_t RA_contention_resolution_cnt; + /// Transmitted UE Contention Resolution Identifier + uint8_t cont_res_id[6]; /// BeamfailurerecoveryConfig NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig; @@ -308,17 +315,20 @@ typedef struct { typedef struct { NR_ServingCellConfigCommon_t *scc; - NR_CellGroupConfig_t *scg; + NR_ServingCellConfigCommonSIB_t *scc_SIB; + NR_CellGroupConfig_t *cg; int servCellIndex; NR_CSI_ReportConfig_t *csirc; + long physCellId; //// MAC config + int common_configuration_complete; NR_DRX_Config_t *drx_Config; NR_SchedulingRequestConfig_t *schedulingRequestConfig; NR_BSR_Config_t *bsr_Config; NR_TAG_Config_t *tag_Config; NR_PHR_Config_t *phr_Config; NR_RNTI_Value_t *cs_RNTI; - NR_MIB_t *mib; + NR_MIB_t *mib; NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP]; NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP]; @@ -354,7 +364,8 @@ typedef struct { uint8_t mib_ssb; /// Last NDI of UL HARQ processes uint8_t UL_ndi[NR_MAX_HARQ_PROCESSES]; - + /// first ULTX of UL HARQ processes + int first_ul_tx[NR_MAX_HARQ_PROCESSES]; //// FAPI-like interface message fapi_nr_ul_config_request_t *ul_config_request; fapi_nr_dl_config_request_t dl_config_request; @@ -493,5 +504,8 @@ typedef struct ssb_list_info { uint8_t nb_tx_ssb; } ssb_list_info_t; +void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id); +void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); + /*@}*/ #endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 14d1ea63fb68e9de5f04a7ab87cf1e594071c62b..1814196c38820c5295fdfc7a79c0aa5bad200a9c 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -53,7 +53,8 @@ int8_t nr_ue_decode_mib( uint8_t extra_bits, uint32_t ssb_length, uint32_t ssb_index, - void *pduP, + void *pduP, + uint16_t ssb_start_subcarrier, uint16_t cell_id ); /**\brief decode SIB1 and other SIs pdus in NR_UE, from if_module dl_ind @@ -82,8 +83,10 @@ int nr_rrc_mac_config_req_ue( int cc_idP, uint8_t gNB_index, NR_MIB_t *mibP, - //NR_ServingCellConfigCommon_t *sccP, - NR_CellGroupConfig_t *cell_group_config); + NR_ServingCellConfigCommonSIB_t *sccP, + NR_CellGroupConfig_t *cell_group_config, + NR_CellGroupConfig_t *scell_group_config +); /**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst); @@ -178,7 +181,8 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, 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); + uint8_t time_domain_ind, + bool use_default); uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, @@ -300,7 +304,7 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu, uint8_t *nb_dmrs_re_per_rb, uint16_t *number_dmrs_symbols); -void build_ssb_to_ro_map(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired); +void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac); void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index bbb44ba47afe758cbff0efa3b4dfd13c56b4ea9c..36034325754fe22cc6e829675c608b7e74487c6f 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -39,6 +39,7 @@ #include "PHY/defs_UE.h" #include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "executables/softmodem-common.h" +#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h" static NR_UE_MAC_INST_t *nr_ue_mac_inst; @@ -50,13 +51,18 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) //init mac here 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); - if (IS_SOFTMODEM_NOS1){ - AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); - pdcp_layer_init(); - nr_DRB_preconfiguration(nr_ue_mac_inst->crnti); - } + for (int j=0;j<NB_NR_UE_MAC_INST;j++) + for (int i=0;i<NR_MAX_HARQ_PROCESSES;i++) nr_ue_mac_inst[j].first_ul_tx[i]=1; + + if (rrc_inst && rrc_inst->scell_group_config) { + nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,rrc_inst->scell_group_config); + + // if (IS_SOFTMODEM_NOS1){ + //if (1) { + // AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); + // nr_pdcp_layer_init(); + //nr_DRB_preconfiguration(nr_ue_mac_inst->crnti); + //} // Allocate memory for ul_config_request in the mac instance. This is now a pointer and will // point to a list of structures (one for each UL slot) to store PUSCH scheduling parameters @@ -69,7 +75,11 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) nr_ue_mac_inst->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t)); } } - else LOG_I(MAC,"Running without RRC instance\n"); + else { + LOG_I(MAC,"Running without CellGroupConfig\n"); + nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL); + AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); + } return (nr_ue_mac_inst); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c index 27623fe5bece64e6cfbc07adab1ce7ba5aa3c0f8..7f1011fb28feaed58da6519eb692ae8fab985728 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c @@ -41,10 +41,11 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_format){ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc!=NULL) ? + mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; NR_SubcarrierSpacing_t scs = *nr_rach_ConfigCommon->msg1_SubcarrierSpacing; - int prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present - 1; + int prach_sequence_length = (mac->scc!=NULL)?(mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present - 1) : (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1); uint8_t prachConfigIndex, mu; AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n"); @@ -145,18 +146,11 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_forma int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t mod_id, uint8_t CC_id){ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - NR_ServingCellConfigCommon_t *scc = mac->scc; - int8_t receivedTargerPower, delta_preamble; - long preambleReceivedTargetPower = 0; - - if (prach_resources->RA_TYPE == RA_4STEP){ - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower; - } else if (prach_resources->RA_TYPE == RA_2STEP){ - // msgA-PreambleReceivedTargetPower - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); - } + int8_t receivedTargerPower; + int8_t delta_preamble; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc != NULL) ? mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + long preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower; delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format); receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA; @@ -211,7 +205,8 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu, long nr_get_Pcmax(module_id_t mod_id){ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - uint32_t band = *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + uint32_t band = (mac->scc!=NULL) ? *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] : + *mac->scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR; NR_P_Max_t p_max = 0; uint8_t P_powerclass = 23; uint8_t delta_P_powerclass = 0; @@ -230,17 +225,18 @@ long nr_get_Pcmax(module_id_t mod_id){ delta_MPR_c = 0.5; } - if (mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1){ - if (*mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1->powerBoostPi2BPSK == 1){ + if (mac->cg && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1){ + if (*mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1->powerBoostPi2BPSK == 1){ // TbD: assuming power class 3 capable UE operating in TDD bands n40, n41, n77, n78, and n79 with Pi/2 BPSK modulation delta_P_powerclass = -3; p_max += 3; } } - if (mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max){ + NR_P_Max_t *p_Max = (mac->scc!=NULL) ? mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max : mac->scc_SIB->uplinkConfigCommon->frequencyInfoUL.p_Max; + if (p_Max){ - p_max += *mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max; + p_max += *p_Max; LOG_D(MAC, "In %s maximum UL transmission power p_max is %ld dBm \n", __FUNCTION__, p_max); @@ -262,4 +258,4 @@ long nr_get_Pcmax(module_id_t mod_id){ return P_cmax; -} \ 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 8f234cb5851efc563b23d5c2bc0e159115dc5287..7374b60d197234233c9acfb95e34dbaa9653f218 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -64,6 +64,8 @@ void init_RA(module_id_t mod_id, RA_config_t *ra = &mac->ra; ra->RA_active = 1; + ra->ra_PreambleIndex = -1; + ra->RA_usedGroupA = 1; ra->RA_RAPID_found = 0; ra->preambleTransMax = 0; ra->first_Msg3 = 1; @@ -79,8 +81,8 @@ void init_RA(module_id_t mod_id, if (rach_ConfigDedicated) { if (rach_ConfigDedicated->cfra){ - LOG_I(MAC, "Initialization of 4-step contention-free random access procedure\n"); - prach_resources->RA_TYPE = RA_4STEP; + LOG_I(MAC, "Initialization of 2-step contention-free random access procedure\n"); + prach_resources->RA_TYPE = RA_2STEP; ra->cfra = 1; } else if (rach_ConfigDedicated->ext1){ if (rach_ConfigDedicated->ext1->cfra_TwoStep_r16){ @@ -93,185 +95,176 @@ void init_RA(module_id_t mod_id, } else { LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__); } + } else if (nr_rach_ConfigCommon){ + LOG_I(MAC, "Initialization of 4-step contention-based random access procedure\n"); + prach_resources->RA_TYPE = RA_4STEP; + ra->cfra = 0; } else { LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__); } - if (prach_resources->RA_TYPE == RA_2STEP){ - LOG_E(MAC, "Missing implementation of initialization of 2-step RA specific variables...\n"); - } else if (prach_resources->RA_TYPE == RA_4STEP){ - LOG_D(MAC, "Initialization of 4-step RA specific variables...\n"); - switch (rach_ConfigGeneric->powerRampingStep){ // in dB - case 0: + switch (rach_ConfigGeneric->powerRampingStep){ // in dB + case 0: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 0; break; - case 1: + case 1: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 2; break; - case 2: + case 2: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 4; break; - case 3: + case 3: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 6; break; - } + } - switch (rach_ConfigGeneric->preambleTransMax) { - case 0: + switch (rach_ConfigGeneric->preambleTransMax) { + case 0: ra->preambleTransMax = 3; break; - case 1: + case 1: ra->preambleTransMax = 4; break; - case 2: + case 2: ra->preambleTransMax = 5; break; - case 3: + case 3: ra->preambleTransMax = 6; break; - case 4: + case 4: ra->preambleTransMax = 7; break; - case 5: + case 5: ra->preambleTransMax = 8; break; - case 6: + case 6: ra->preambleTransMax = 10; break; - case 7: + case 7: ra->preambleTransMax = 20; break; - case 8: + case 8: ra->preambleTransMax = 50; break; - case 9: + case 9: ra->preambleTransMax = 100; break; - case 10: + case 10: ra->preambleTransMax = 200; break; - } - if (nr_rach_ConfigCommon->ext1) { - if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){ - LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__); - } - } } - return; - + if (nr_rach_ConfigCommon->ext1) { + if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){ + LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__); + } + } } void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon, fapi_nr_ul_config_prach_pdu *prach_pdu){ // Determine the SSB to RACH mapping ratio // ======================================= - if (prach_resources->RA_TYPE == RA_4STEP){ - NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; - boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB - uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB - int total_preambles_per_ssb; - uint8_t ssb_nb_in_ro; - int numberOfRA_Preambles = 64; - - switch (ssb_perRACH_config){ - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 8; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 4; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 2; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 1; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 2; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 4; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four; - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 8; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight; - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 16; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen; - break; - default: - AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config); - break; - } - if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles) - numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles); + NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; + boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB + uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB + int total_preambles_per_ssb; + uint8_t ssb_nb_in_ro; + int numberOfRA_Preambles = 64; + + switch (ssb_perRACH_config){ + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 8; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 4; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 2; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 1; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 2; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 4; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four; + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 8; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight; + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 16; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen; + break; + default: + AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config); + } - // Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration - if ((true == multiple_ssb_per_ro) && - (ssb_rach_ratio > 1)) { - total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio; + if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles) + numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles); - ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro; - ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro; - } - else { - total_preambles_per_ssb = numberOfRA_Preambles; - ra->starting_preamble_nb = 0; - } + // Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration + if ((true == multiple_ssb_per_ro) && (ssb_rach_ratio > 1)) { + total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio; + + ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro; + ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro; } else { - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); + total_preambles_per_ssb = numberOfRA_Preambles; + ra->starting_preamble_nb = 0; } } -// This routine implements RA premable configuration according to +// This routine implements RA preamble configuration according to // section 5.1 (Random Access procedure) of 3GPP TS 38.321 version 16.2.1 Release 16 void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac, int16_t dl_pathloss){ int messageSizeGroupA = 0; int sizeOfRA_PreamblesGroupA = 0; int messagePowerOffsetGroupB = 0; - int PLThreshold; + int PLThreshold = 0; long deltaPreamble_Msg3 = 0; uint8_t noGroupB = 0; RA_config_t *ra = &mac->ra; - NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric; - - if (prach_resources->RA_TYPE == RA_4STEP){ + NR_RACH_ConfigCommon_t *setup; + if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; - if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){ - deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB - LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3); - } + NR_BWP_UplinkCommon_t *initialUplinkBWP = (mac->scc) ? mac->scc->uplinkConfigCommon->initialUplinkBWP : &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; + if (initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){ + deltaPreamble_Msg3 = (*initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB + LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3); + } - if (!nr_rach_ConfigCommon->groupBconfigured) { - noGroupB = 1; - LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__); - } else { - // RA preambles group B is configured - // - Random Access Preambles group B is configured for 4-step RA type - // - Defining the number of RA preambles in RA Preamble Group A for each SSB - LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__); - sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA; - switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){ + if (!setup->groupBconfigured) { + noGroupB = 1; + LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__); + } else { + // RA preambles group B is configured + // - Random Access Preambles group B is configured for 4-step RA type + // - Defining the number of RA preambles in RA Preamble Group A for each SSB + LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__); + sizeOfRA_PreamblesGroupA = setup->groupBconfigured->numberOfRA_PreamblesGroupA; + switch (setup->groupBconfigured->ra_Msg3SizeGroupA){ /* - Threshold to determine the groups of RA preambles */ case 0: messageSizeGroupA = 56; @@ -304,13 +297,13 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t messageSizeGroupA = 72; break; default: - AssertFatal(1 == 0, "Unknown ra_Msg3SizeGroupA %lu\n", nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA); + AssertFatal(1 == 0, "Unknown ra_Msg3SizeGroupA %lu\n", setup->groupBconfigured->ra_Msg3SizeGroupA); /* todo cases 10 -15*/ } /* Power offset for preamble selection in dB */ messagePowerOffsetGroupB = -9999; - switch (nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB){ + switch (setup->groupBconfigured->messagePowerOffsetGroupB){ case 0: messagePowerOffsetGroupB = -9999; break; @@ -336,45 +329,43 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t messagePowerOffsetGroupB = 18; break; default: - AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB); - } + AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", setup->groupBconfigured->messagePowerOffsetGroupB); + } - PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB; + PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB; - } - } else { - // todo: - // - groupB-ConfiguredTwoStepRA - // - msgA-DeltaPreamble - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); } + /* Msg3 has not been transmitted yet */ if (ra->first_Msg3) { - if (noGroupB) { - // use Group A preamble - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); - ra->RA_usedGroupA = 1; - } else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) { - // Group B is configured and RA preamble Group A is used - // - todo add condition on CCCH_sdu_size for initiation by CCCH - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); - ra->RA_usedGroupA = 1; - } else { - // Group B preamble is configured and used - // the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A - // the remaining belong to RA Preambles Group B - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); - ra->RA_usedGroupA = 0; + if(ra->ra_PreambleIndex < 0 || ra->ra_PreambleIndex > 63) { + if (noGroupB) { + // use Group A preamble + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); + ra->RA_usedGroupA = 1; + } else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) { + // Group B is configured and RA preamble Group A is used + // - todo add condition on CCCH_sdu_size for initiation by CCCH + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); + ra->RA_usedGroupA = 1; + } else { + // Group B preamble is configured and used + // the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A + // the remaining belong to RA Preambles Group B + ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); + ra->RA_usedGroupA = 0; + } } } else { // Msg3 is being retransmitted if (ra->RA_usedGroupA && noGroupB) { - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); } else if (ra->RA_usedGroupA && !noGroupB){ - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); } else { - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); + ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); } } + prach_resources->ra_PreambleIndex = ra->ra_PreambleIndex; } // RA-RNTI computation (associated to PRACH occasion in which the RA Preamble is transmitted) @@ -429,7 +420,10 @@ void nr_get_prach_resources(module_id_t mod_id, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc)? + mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup : + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; LOG_D(PHY, "In %s: getting PRACH resources frame (first_Msg3 %d)\n", __FUNCTION__, ra->first_Msg3); @@ -464,7 +458,9 @@ 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){ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc) ? + mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; RA_config_t *ra = &mac->ra; LOG_D(MAC,"In %s: [UE %d] Frame %d, CB-RA: starting contention resolution timer\n", __FUNCTION__, mod_id, frameP); @@ -472,6 +468,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint // start contention resolution timer ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8; ra->RA_contention_resolution_timer_active = 1; + ra->ra_state = WAIT_CONTENTION_RESOLUTION; } @@ -503,14 +500,16 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; - uint8_t lcid = UL_SCH_LCID_CCCH_MSG3, *payload; + uint8_t lcid = UL_SCH_LCID_CCCH; + uint8_t *payload; uint16_t size_sdu = 0; unsigned short post_padding; - NR_ServingCellConfigCommon_t *scc = mac->scc; - AssertFatal(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup != NULL, "In %s: FATAL! nr_rach_ConfigCommon is NULL...\n", __FUNCTION__); - NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup; + if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__); NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; + //NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = ra->rach_ConfigDedicated; uint8_t sdu_lcids[NB_RB_MAX] = {0}; @@ -520,19 +519,24 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, // Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side if (!prach_resources->init_msg1) { - if (((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150){ + if (/*(((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150) &&*/ + mac->common_configuration_complete > 0){ prach_resources->init_msg1 = 1; } else { + LOG_I(PHY,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n",frame,prach_resources->sync_frame); return 0; } } - if (prach_resources->init_msg1) { + LOG_I(PHY,"frame %d prach_resources->init_msg1 %d, ra->ra_state %d, ra->RA_active %d\n", + frame,prach_resources->init_msg1,ra->ra_state,ra->RA_active); + + if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) { if (ra->RA_active == 0) { /* RA not active - checking if RRC is ready to initiate the RA procedure */ - LOG_D(MAC, "RA not active. Checking for data to transmit from upper layers...\n"); + LOG_I(MAC, "RA not active. Checking for data to transmit from upper layers...\n"); uint8_t TBS_max = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); payload = (uint8_t*) mac->CCCH_pdu.payload; @@ -553,11 +557,16 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, sdu_lengths[0] = size_sdu; - LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n", mod_id, frame, size_sdu); + LOG_I(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n", mod_id, frame, size_sdu); if (size_sdu > 0) { - LOG_D(MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx); + // UE Contention Resolution Identity + // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the + // Random Access Procedure has been successful after reception of Msg4 + memcpy(ra->cont_res_id, mac_sdus, sizeof(uint8_t) * 6); + + LOG_I(MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx); ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); @@ -566,9 +575,9 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, nr_get_RA_window(mac); // Fill in preamble and PRACH resources - if (ra->generate_nr_prach == 1) + if (ra->generate_nr_prach == GENERATE_PREAMBLE) { nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); - + } offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer (uint8_t *) payload, // UL MAC pdu pointer num_sdus, // num sdus @@ -614,10 +623,13 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, } if (ra->RA_window_cnt >= 0 && ra->RA_RAPID_found == 1) { - // Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213) - - nr_ra_succeeded(mod_id, frame, nr_slot_tx); + if(ra->cfra) { + // Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213) + nr_ra_succeeded(mod_id, frame, nr_slot_tx); + } else { + ra->generate_nr_prach = GENERATE_IDLE; + } } else if (ra->RA_window_cnt == 0 && !ra->RA_RAPID_found) { LOG_I(MAC, "[UE %d][%d:%d] RAR reception failed \n", mod_id, frame, nr_slot_tx); @@ -630,15 +642,16 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, // Fill in preamble and PRACH resources ra->RA_window_cnt--; - nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); - + if (ra->generate_nr_prach == GENERATE_PREAMBLE) { + nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); + } } else if (ra->RA_backoff_cnt > 0) { LOG_D(MAC, "[UE %d][%d.%d]: RAR not received yet (RA backoff count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_backoff_cnt); ra->RA_backoff_cnt--; - if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == 1) || ra->RA_backoff_cnt == 0){ + if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == GENERATE_PREAMBLE) || ra->RA_backoff_cnt == 0) { nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); } @@ -650,7 +663,12 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, nr_ue_contention_resolution(mod_id, CC_id, frame, nr_slot_tx, prach_resources); } - return ra->generate_nr_prach; + LOG_I(MAC,"ra->generate_nr_prach %d ra->ra_state %d (GENERATE_IDLE %d)\n",ra->generate_nr_prach,ra->ra_state,GENERATE_IDLE); + if(ra->generate_nr_prach != GENERATE_IDLE) { + return ra->generate_nr_prach; + } else { + return ra->ra_state; + } } @@ -658,17 +676,21 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac){ uint8_t mu, ra_ResponseWindow; RA_config_t *ra = &mac->ra; - NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup; + if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__); NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; - NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; - + long scs = (mac->scc) ? + mac->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing : + mac->scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow; if (setup->msg1_SubcarrierSpacing) mu = *setup->msg1_SubcarrierSpacing; else - mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + mu = scs; ra->RA_window_cnt = ra->RA_offset*nr_slots_per_frame[mu]; // taking into account the 2 frames gap introduced by OAI gNB @@ -744,6 +766,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received.\n", mod_id, frame, slot); ra->RA_window_cnt = -1; + mac->crnti = ra->t_crnti; } else { @@ -751,6 +774,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ ra->RA_contention_resolution_cnt = -1; ra->RA_contention_resolution_timer_active = 0; + mac->crnti = ra->t_crnti; ra->t_crnti = 0; LOG_D(MAC, "In %s: [UE %d][%d.%d] CB-RA: cleared contention resolution timer...\n", __FUNCTION__, mod_id, frame, slot); @@ -759,7 +783,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ LOG_D(MAC, "In %s: [UE %d] clearing RA_active flag...\n", __FUNCTION__, mod_id); ra->RA_active = 0; - ra->generate_nr_prach = 2; + ra->generate_nr_prach = GENERATE_IDLE; ra->ra_state = RA_SUCCEEDED; } @@ -774,8 +798,9 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; - ra->first_Msg3 = 0; - ra->generate_nr_prach = 3; + ra->first_Msg3 = 1; + ra->ra_PreambleIndex = -1; + ra->generate_nr_prach = RA_FAILED; ra->ra_state = RA_UE_IDLE; prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER++; 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 11edc6c20d26ef544dbc7e8bef284505dd88dfcb..a8bf67834b3e1a0de1586fc4b3ce916533746c96 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -47,7 +47,7 @@ #endif #define LOG_DCI_PARM(a...) LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci)" a) -// #define DEBUG_DCI +//#define DEBUG_DCI dci_pdu_rel15_t *def_dci_pdu_rel15; @@ -73,11 +73,22 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t uint8_t coreset_id = 1; int sps = 0; def_dci_pdu_rel15 = calloc(1,2*sizeof(dci_pdu_rel15_t)); - AssertFatal(mac->scc != NULL, "scc is null\n"); + + AssertFatal(mac->scc == NULL || mac->scc_SIB == NULL, "both scc and scc_SIB cannot be non-null\n"); + NR_BWP_Id_t bwp_id = mac->DL_BWP_Id; NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common; - NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; + NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB; + NR_BWP_DownlinkCommon_t *bwp_Common=NULL; + NR_BWP_DownlinkCommon_t *initialDownlinkBWP=NULL; + NR_BWP_UplinkCommon_t *initialUplinkBWP=NULL; + + if (scc!=NULL || scc_SIB != NULL) { + initialDownlinkBWP = scc!=NULL ? scc->downlinkConfigCommon->initialDownlinkBWP : &scc_SIB->downlinkConfigCommon.initialDownlinkBWP; + initialUplinkBWP = scc!=NULL ? scc->uplinkConfigCommon->initialUplinkBWP : &scc_SIB->uplinkConfigCommon->initialUplinkBWP; + + bwp_Common = bwp_id>0 ? mac->DLbwp[bwp_id-1]->bwp_Common : NULL; + } NR_SearchSpace_t *ss; NR_ControlResourceSet_t *coreset; @@ -88,7 +99,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t } else { ss = mac->search_space_zero; coreset = mac->coreset0; - rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + if(rnti_type == NR_RNTI_SI) { + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + } else { + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG_CSET_0; + } } rel15->coreset.duration = coreset->duration; @@ -100,8 +115,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t 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; + rel15->coreset.ShiftIndex = interleaved->shiftIndex != NULL ? *interleaved->shiftIndex : mac->physCellId; } else { rel15->coreset.RegBundleSize = 0; rel15->coreset.InterleaverSize = 0; @@ -115,7 +129,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->coreset.pdcch_dmrs_scrambling_id = *coreset->pdcch_DMRS_ScramblingID; rel15->coreset.scrambling_rnti = mac->crnti; } else { - rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId; + rel15->coreset.pdcch_dmrs_scrambling_id = mac->physCellId; rel15->coreset.scrambling_rnti = 0; } @@ -127,15 +141,23 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t switch(rnti_type) { case NR_RNTI_C: // we use DL BWP dedicated - sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + sps = bwp_Common ? + (bwp_Common->genericParameters.cyclicPrefix ? 12 : 14) : + initialDownlinkBWP->genericParameters.cyclicPrefix ? 12 : 14; // for SPS=14 8 MSBs in positions 13 down to 6 monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); rel15->rnti = mac->crnti; - rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; + if (!bwp_Common) { + rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } + else { + rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; + } for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15+i, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id); + rel15->dci_length_options[i] = nr_dci_size(initialUplinkBWP, mac->cg, def_dci_pdu_rel15+i, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id); } break; case NR_RNTI_RA: @@ -144,21 +166,34 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); rel15->rnti = ra->ra_rnti; rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + if (get_softmodem_params()->sa) { + rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else { // NSA mode is not using the Initial BWP + rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; - rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id); + rel15->dci_length_options[0] = nr_dci_size(initialUplinkBWP, mac->cg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id); break; case NR_RNTI_P: break; case NR_RNTI_CS: break; case NR_RNTI_TC: + // we use the initial DL BWP + sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12; + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = ra->t_crnti; + rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; + rel15->dci_length_options[0] = nr_dci_size(initialUplinkBWP, mac->cg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id); break; case NR_RNTI_SP_CSI: break; case NR_RNTI_SI: // we use DL BWP dedicated - sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + if (bwp_Common) sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + else sps=14; // note: normally this would be found with SSS detection // for SPS=14 8 MSBs in positions 13 down to 6 monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); @@ -169,7 +204,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); + rel15->dci_length_options[i] = nr_dci_size(initialUplinkBWP, mac->cg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); } break; case NR_RNTI_SFI: @@ -211,159 +246,175 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl RA_config_t *ra = &mac->ra; int ss_id; - uint8_t bwp_id = 1, coreset_id = 1; - //NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated; - NR_BWP_Downlink_t *bwp = mac->DLbwp[bwp_id - 1]; - #ifdef DEBUG_DCI - LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti); - #endif - - // loop over all available SS for BWP ID 1, CORESET ID 1 - for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){ - NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; - NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common; - NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; - struct NR_PhysicalCellGroupConfig *phy_cgc = mac->scg->physicalCellGroupConfig; - switch (ss->searchSpaceType->present){ - case NR_SearchSpace__searchSpaceType_PR_common: - // this is for CSSs, we use BWP common and pdcch_ConfigCommon - - // Fetch configuration for searchSpaceZero - // note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero). - if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){ - if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){ - pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); - } - *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0; - LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n"); - } - if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){ - // check available SS IDs - if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ - if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ - switch(ra->ra_state){ - case WAIT_RAR: - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n"); - rel15->num_dci_options = 1; - rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; - config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id); - fill_dci_search_candidates(ss, rel15); - break; - case WAIT_CONTENTION_RESOLUTION: - LOG_E(MAC, "In %s: CB-RA not implemented yet. Should not have fallen in this case.\n", __FUNCTION__); - break; - default: - break; - } - } - } - if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ - if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ - // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG - LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); - } - } - if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ - if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ - // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG - LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); - } - } - if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){ - if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){ - // Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG - LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); - } - } - if (phy_cgc){ - if (phy_cgc->cs_RNTI){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n"); - LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); - } - if (phy_cgc->ext1){ - if (phy_cgc->ext1->mcs_C_RNTI){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n"); - LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); - } - } - } - } // end DCI 00 and 01 - // DCI 2_0 - if (ss->searchSpaceType->choice.common->dci_Format2_0){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n"); - LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); - } - // DCI 2_1 - if (ss->searchSpaceType->choice.common->dci_Format2_1){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n"); - LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); - } - // DCI 2_2 - if (ss->searchSpaceType->choice.common->dci_Format2_2){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n"); - LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); - } - // DCI 2_3 - if (ss->searchSpaceType->choice.common->dci_Format2_3){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n"); - LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); - } - - break; - case NR_SearchSpace__searchSpaceType_PR_ue_Specific: - // this is an USS - if (ss->searchSpaceType->choice.ue_Specific){ - if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){ - // Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI - if ((ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) { - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n"); - rel15->num_dci_options = 2; - rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1; - rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_1; - config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C, ss_id); - fill_dci_search_candidates(ss, rel15); - - #ifdef DEBUG_DCI - LOG_D(MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n", - ss_id, - ss->searchSpaceType->choice.ue_Specific, - ss->searchSpaceType->present, - ss->searchSpaceType->choice.ue_Specific->dci_Formats); - #endif - } - if (phy_cgc){ - if (phy_cgc->cs_RNTI){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n"); - LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); - } - if (phy_cgc->sp_CSI_RNTI){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n"); - LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); - } - if (phy_cgc->ext1){ - if (phy_cgc->ext1->mcs_C_RNTI){ - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n"); - LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); - } - } - } - } + uint8_t bwp_id = (mac->cg) ? 1 : 0, coreset_id = (mac->cg) ? 1 : 0; + //NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated; + NR_BWP_Downlink_t *bwp = (mac->cg) ? mac->DLbwp[bwp_id - 1] : NULL; + + LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti); + + if (mac->cg) { // do this only after we have a Master or Secondary Cell group + // loop over all available SS for BWP ID 1, CORESET ID 1 + if (bwp) { + for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){ + LOG_D(MAC, "[DCI_CONFIG] ss_id %d\n",ss_id); + NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common; + NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; + struct NR_PhysicalCellGroupConfig *phy_cgc = mac->cg->physicalCellGroupConfig; + switch (ss->searchSpaceType->present){ + case NR_SearchSpace__searchSpaceType_PR_common: + // this is for CSSs, we use BWP common and pdcch_ConfigCommon + + // Fetch configuration for searchSpaceZero + // note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero). + if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){ + if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){ + pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); + } + *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0; + LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n"); + } + if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){ + // check available SS IDs + if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ + if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ + switch(ra->ra_state){ + case WAIT_RAR: + LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n"); + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + if (get_softmodem_params()->sa) { + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, -1); + } else { + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id); + } + fill_dci_search_candidates(ss, rel15); + break; + case WAIT_CONTENTION_RESOLUTION: + LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg4)\n"); + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, -1); + fill_dci_search_candidates(ss, rel15); + break; + default: + break; + } + } + } + if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG + LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); + } + } + if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ + if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ + // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG + LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); + } + } + if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){ + if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){ + // Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG + LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); + } + } + if (phy_cgc){ + if (phy_cgc->cs_RNTI){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n"); + LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); + } + if (phy_cgc->ext1){ + if (phy_cgc->ext1->mcs_C_RNTI){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n"); + LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); + } + } + } + } // end DCI 00 and 01 + // DCI 2_0 + if (ss->searchSpaceType->choice.common->dci_Format2_0){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n"); + LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); + } + // DCI 2_1 + if (ss->searchSpaceType->choice.common->dci_Format2_1){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n"); + LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); + } + // DCI 2_2 + if (ss->searchSpaceType->choice.common->dci_Format2_2){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n"); + LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); + } + // DCI 2_3 + if (ss->searchSpaceType->choice.common->dci_Format2_3){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n"); + LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet..."); + } + + break; + case NR_SearchSpace__searchSpaceType_PR_ue_Specific: + // this is an USS + if (ss->searchSpaceType->choice.ue_Specific){ + if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){ + // Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI + if ((ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) { + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n"); + rel15->num_dci_options = 2; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1; + rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_1; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C, ss_id); + fill_dci_search_candidates(ss, rel15); + +#ifdef DEBUG_DCI + LOG_D(MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n", + ss_id, + ss->searchSpaceType->choice.ue_Specific, + ss->searchSpaceType->present, + ss->searchSpaceType->choice.ue_Specific->dci_Formats); +#endif + } + if (phy_cgc){ + if (phy_cgc->cs_RNTI){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n"); + LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); + } + if (phy_cgc->sp_CSI_RNTI){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n"); + LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); + } + if (phy_cgc->ext1){ + if (phy_cgc->ext1->mcs_C_RNTI){ + LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n"); + LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet..."); + } + } + } + } + } + break; + default: + AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type..."); + break; + } } - break; - default: - AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type..."); - break; } } + else { + AssertFatal(1==0,"Handle DCI searching when CellGroup without dedicated BWP\n"); + } // Search space 0, CORESET ID 0 - NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common; - NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; + NR_BWP_DownlinkCommon_t *bwp_Common = bwp ? bwp->bwp_Common : NULL; + NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp?bwp_Common->pdcch_ConfigCommon:NULL; - if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + if (pdcch_ConfigCommon && + pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ NR_SearchSpace_t *ss0 = mac->search_space_zero; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; @@ -377,5 +428,13 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl } } } - + else { // use coreset0/ss0 + NR_SearchSpace_t *ss0 = mac->search_space_zero; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15; + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C , -1); + fill_dci_search_candidates(ss0, rel15); + 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 568d1808de823537412883a32b2067534079e81e..8a75406166fda728578aa4a544170c8572688575 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -63,9 +63,11 @@ #include "common/utils/LOG/vcd_signal_dumper.h" //#define ENABLE_MAC_PAYLOAD_DEBUG 1 -//#define DEBUG_EXTRACT_DCI +#define DEBUG_EXTRACT_DCI //#define DEBUG_RAR +extern uint32_t N_RB_DL; + int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){ RA_config_t *ra = &mac->ra; @@ -73,10 +75,10 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){ if (rnti == ra->ra_rnti) { rnti_type = NR_RNTI_RA; + } else if (rnti == ra->t_crnti && (ra->ra_state == WAIT_RAR || ra->ra_state == WAIT_CONTENTION_RESOLUTION) ) { + rnti_type = NR_RNTI_TC; } else if (rnti == mac->crnti) { rnti_type = NR_RNTI_C; - } else if (rnti == ra->t_crnti) { - rnti_type = NR_RNTI_TC; } else if (rnti == 0xFFFE) { rnti_type = NR_RNTI_P; } else if (rnti == 0xFFFF) { @@ -99,13 +101,16 @@ int8_t nr_ue_decode_mib(module_id_t module_id, uint32_t ssb_length, uint32_t ssb_index, void *pduP, + uint16_t ssb_start_subcarrier, uint16_t cell_id) { - LOG_I(MAC,"[L2][MAC] decode mib\n"); + LOG_D(MAC,"[L2][MAC] decode mib\n"); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + mac->physCellId = cell_id; - nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU + frequency_range_t frequency_range; + nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); //if(mac->mib != NULL){ @@ -120,9 +125,11 @@ int8_t nr_ue_decode_mib(module_id_t module_id, frame = frame << 4; frame = frame | frame_number_4lsb; if(ssb_length == 64){ + frequency_range = FR2; for (int i=0; i<3; i++) ssb_index += (((extra_bits>>(7-i))&0x01)<<(3+i)); }else{ + frequency_range = FR1; if(ssb_subcarrier_offset_msb){ ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; } @@ -141,13 +148,31 @@ int8_t nr_ue_decode_mib(module_id_t module_id, //storing ssb index in the mac structure mac->mib_ssb = ssb_index; - get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index, - mac->phy_config.config_req.ssb_table.ssb_offset_point_a); + if (get_softmodem_params()->sa == 1) { + + // TODO these values shouldn't be taken from SCC in SA + uint8_t scs_ssb = get_softmodem_params()->numerology; + uint32_t band = get_softmodem_params()->band; + uint16_t ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index); + uint16_t ssb_offset_point_a = (ssb_start_subcarrier - ssb_subcarrier_offset)/12; + + get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, + frame, + mac->mib, + nr_slots_per_frame[scs_ssb], + ssb_subcarrier_offset, + ssb_start_symbol, + scs_ssb, + frequency_range, + ssb_index, + ssb_offset_point_a); + + + mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; + mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; + mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; + } - ssb_index = mac->type0_PDCCH_CSS_config.ssb_index; // TODO: ssb_index should obtain from L1 in case Lssb != 64 - mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; - mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; - mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS @@ -161,7 +186,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, uint8_t *pduP, uint32_t pdu_len) { LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); - nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); + nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); return 0; } @@ -203,10 +228,10 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p return -1; } - LOG_D(MAC,"riv = %i\n", riv); - LOG_D(MAC,"n_RB_DLBWP = %i\n", n_RB_DLBWP); - LOG_D(MAC,"number_rbs = %i\n", dlsch_config_pdu->number_rbs); - LOG_D(MAC,"start_rb = %i\n", dlsch_config_pdu->start_rb); + LOG_D(MAC,"DLSCH riv = %i\n", riv); + LOG_D(MAC,"DLSCH n_RB_DLBWP = %i\n", n_RB_DLBWP); + LOG_D(MAC,"DLSCH number_rbs = %i\n", dlsch_config_pdu->number_rbs); + LOG_D(MAC,"DLSCH start_rb = %i\n", dlsch_config_pdu->start_rb); } if(pusch_config_pdu != NULL){ @@ -229,7 +254,10 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p LOG_W(MAC, "Frequency domain assignment values are invalid! #RBs: %d, Start RB: %d, n_RB_ULBWP: %d \n",pusch_config_pdu->rb_size, pusch_config_pdu->rb_start, n_RB_ULBWP); return -1; } - + LOG_D(MAC,"ULSCH riv = %i\n", riv); + LOG_D(MAC,"ULSCH n_RB_DLBWP = %i\n", n_RB_ULBWP); + LOG_D(MAC,"ULSCH number_rbs = %i\n", pusch_config_pdu->rb_size); + LOG_D(MAC,"ULSCH start_rb = %i\n", pusch_config_pdu->rb_start); } return 0; } @@ -237,85 +265,16 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, 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 + uint8_t time_domain_ind, + bool use_default ){ - int dmrs_typeA_pos = mac->scc->dmrs_TypeA_Position; + int dmrs_typeA_pos = (mac->scc != NULL) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position; + // uint8_t k_offset=0; uint8_t sliv_S=0; uint8_t sliv_L=0; - uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?12:11}, // row index 1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?7:6}, // row index 4 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?5:4}, // row index 5 - {0,(dmrs_typeA_pos == 0)?9:10,(dmrs_typeA_pos == 0)?4:4}, // row index 6 - {0,(dmrs_typeA_pos == 0)?4:6, (dmrs_typeA_pos == 0)?4:4}, // row index 7 - {0,5,7}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,12,2}, // row index 11 - {0,1,13}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,7}, // row index 15 - {0,8,4} // row index 16 - }; - /*uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?6:5}, // row index 1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?7:6}, // row index 4 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?5:4}, // row index 5 - {0,(dmrs_typeA_pos == 0)?6:8, (dmrs_typeA_pos == 0)?4:2}, // row index 6 - {0,(dmrs_typeA_pos == 0)?4:6, (dmrs_typeA_pos == 0)?4:4}, // row index 7 - {0,5,6}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,10,2}, // row index 11 - {0,1,11}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,6}, // row index 15 - {0,8,4} // row index 16 - };*/ - /*uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {1,2,2}, // row index 6 - {1,4,2}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14 - {1,2,4}, // row index 15 - {0,0,0} // row index 16 - };*/ - /*uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {0,0,0}, // row index 6 - {0,0,0}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14 - {0,0,6}, // row index 15 - {0,2,6} // row index 16 - };*/ uint8_t mu_pusch = 1; + // definition table j Table 6.1.2.1.1-4 uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1; uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1 @@ -360,11 +319,13 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, */ if(dlsch_config_pdu != NULL){ NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL; - if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) + if (mac->DLbwp[0] && mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; - else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) + else if (mac->DLbwp[0] && mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - if (pdsch_TimeDomainAllocationList) { + else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup) + pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + if (pdsch_TimeDomainAllocationList && use_default==false) { if (time_domain_ind >= pdsch_TimeDomainAllocationList->list.count) { LOG_E(MAC, "time_domain_ind %d >= pdsch->TimeDomainAllocationList->list.count %d\n", @@ -387,8 +348,15 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, } else {// Default configuration from tables // k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; - sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][1]; - sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][2]; + + if(dmrs_typeA_pos == 0) { + sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][1]; + sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][2]; + } else { + sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][1]; + sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][2]; + } + // k_offset = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0]; // sliv_S = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1]; // sliv_L = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2]; @@ -406,14 +374,23 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, */ if(pusch_config_pdu != NULL){ NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; - if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { + if (mac->ULbwp[0] && + mac->ULbwp[0]->bwp_Dedicated && + mac->ULbwp[0]->bwp_Dedicated->pusch_Config && + mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup && + mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; } - else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { + else if (mac->ULbwp[0] && + mac->ULbwp[0]->bwp_Common && + mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon && + mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup && + mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } + else pusch_TimeDomainAllocationList = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; - if (pusch_TimeDomainAllocationList) { + if (pusch_TimeDomainAllocationList && use_default==false) { if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) { LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n", time_domain_ind, pusch_TimeDomainAllocationList->list.count); @@ -422,6 +399,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, return -1; } + LOG_D(NR_MAC,"Filling Time-Domain Allocation from pusch_TimeDomainAllocationList\n"); int startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[time_domain_ind]->startSymbolAndLength; int S,L; SLIV2SL(startSymbolAndLength,&S,&L); @@ -429,15 +407,19 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, pusch_config_pdu->nr_of_symbols=L; } else { + LOG_D(NR_MAC,"Filling Time-Domain Allocation from tables\n"); // k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; - sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][1]; - sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][2]; + sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][1]; + sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][2]; // 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]; pusch_config_pdu->nr_of_symbols = sliv_L; pusch_config_pdu->start_symbol_index = sliv_S; } + LOG_D(NR_MAC,"start_symbol = %i\n", pusch_config_pdu->start_symbol_index); + LOG_D(NR_MAC,"number_symbols = %i\n", pusch_config_pdu->nr_of_symbols); + } return 0; } @@ -448,9 +430,10 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits); - - uint32_t dci_format = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15); - return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci->rnti, dci_format)); + int8_t ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15); + if ((ret&1) == 1) return -1; + else if (ret == 2) dci->dci_format = NR_UL_DCI_FORMAT_0_0; + return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci->rnti, dci->dci_format)); } int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, uint16_t rnti, uint8_t dci_format){ @@ -465,11 +448,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; uint8_t is_Msg3 = 0; - //const uint16_t n_RB_DLBWP = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP; //make sure this has been set - AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n"); - AssertFatal(mac->ULbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n"); - - const uint16_t n_RB_DLBWP = (ra->ra_state == WAIT_RAR) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + uint16_t n_RB_DLBWP; + if (mac->DLbwp[0]) n_RB_DLBWP = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + else if (mac->scc_SIB) n_RB_DLBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE); + else n_RB_DLBWP = mac->type0_PDCCH_CSS_config.num_rbs; LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP); @@ -496,6 +478,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // - SUL_IND_0_0 // Schedule PUSCH + ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, dci->time_domain_assignment.val); if (ret != -1){ @@ -508,6 +491,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr return -1; } + AssertFatal(ul_config->number_pdus<FAPI_NR_UL_CONFIG_LIST_NUM, "ul_config->number_pdus %d out of bounds\n",ul_config->number_pdus); nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu; fill_ul_config(ul_config, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH); @@ -515,10 +499,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // Config PUSCH PDU ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format); - if (ret != -1 && ra->RA_active && mac->crnti){ - nr_ra_succeeded(module_id, frame, slot); - } - } break; @@ -578,12 +558,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // Config PUSCH PDU ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format); - if (ret != -1 && ra->RA_active && mac->crnti){ - nr_ra_succeeded(module_id, frame, slot); - } - } - break; } @@ -641,7 +616,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - NR_PDSCH_Config_t *pdsch_config=mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup; + NR_PDSCH_Config_t *pdsch_config= (mac->DLbwp[0]) ? mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup : NULL; uint16_t BWPSize = 0; if(rnti == SI_RNTI) { @@ -649,7 +624,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' + if (pdsch_config) pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' BWPSize = dlsch_config_pdu_1_0->BWPSize; } else { if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){ @@ -657,9 +632,33 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } else { dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; } - dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + if( (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti) || (rnti == ra->t_crnti) ) { + if (mac->scc == NULL) { + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } + else { + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } + if (get_softmodem_params()->sa) { + + } else { // NSA mode is not using the Initial BWP + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup; + } + } else if (mac->DLbwp[0]) { + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup; + } else if (mac->scc_SIB) { + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing; + pdsch_config = NULL; + + } BWPSize = n_RB_DLBWP; } @@ -670,15 +669,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val,rnti==SI_RNTI) < 0) { LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } /* dmrs symbol positions*/ dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config, - mac->scc->dmrs_TypeA_Position, - dlsch_config_pdu_1_0->start_symbol+dlsch_config_pdu_1_0->number_symbols); - dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + mac->mib->dmrs_TypeA_Position, + dlsch_config_pdu_1_0->number_symbols, + dlsch_config_pdu_1_0->start_symbol); + dlsch_config_pdu_1_0->dmrsConfigType = (mac->DLbwp[0] != NULL) ? (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ if (dlsch_config_pdu_1_0->number_symbols == 2) dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; @@ -687,7 +687,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* VRB_TO_PRB_MAPPING */ dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; /* MCS TABLE INDEX */ - dlsch_config_pdu_1_0->mcs_table = (pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0; + dlsch_config_pdu_1_0->mcs_table = (pdsch_config) ? ((pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0) : 0; /* MCS */ dlsch_config_pdu_1_0->mcs = dci->mcs; // Basic sanity check for MCS value to check for a false or erroneous DCI @@ -727,21 +727,43 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->pucch_resource_id = dci->pucch_resource_indicator; // Sanity check for pucch_resource_indicator value received to check for false DCI. valid = 0; - pucch_res_set_cnt = mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count; - for (int id = 0; id < pucch_res_set_cnt; id++) { - if (dlsch_config_pdu_1_0->pucch_resource_id < mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { - valid = 1; - break; + if (mac->ULbwp[0] && + mac->ULbwp[0]->bwp_Dedicated && + mac->ULbwp[0]->bwp_Dedicated->pucch_Config && + mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup&& + mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList) { + pucch_res_set_cnt = mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count; + for (int id = 0; id < pucch_res_set_cnt; id++) { + if (dlsch_config_pdu_1_0->pucch_resource_id < mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { + valid = 1; + break; + } } } + else if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList){ + pucch_res_set_cnt = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.count; + for (int id = 0; id < pucch_res_set_cnt; id++) { + if (dlsch_config_pdu_1_0->pucch_resource_id < mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { + valid = 1; + break; + } + } + } else valid=1; if (!valid) { - LOG_W(MAC, "[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n", frame, slot, dlsch_config_pdu_1_0->pucch_resource_id); - return -1; - } + LOG_W(MAC, "[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n", frame, slot, dlsch_config_pdu_1_0->pucch_resource_id); + return -1; + } /* 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; - + dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = 1+dci->pdsch_to_harq_feedback_timing_indicator.val; + 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); @@ -770,6 +792,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type); dl_config->number_pdus = dl_config->number_pdus + 1; + break; } @@ -835,14 +858,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val,false) < 0) { LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } /* dmrs symbol positions*/ dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config, mac->scc->dmrs_TypeA_Position, - dlsch_config_pdu_1_1->number_symbols); + dlsch_config_pdu_1_1->number_symbols, + dlsch_config_pdu_1_1->start_symbol); dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; /* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214, using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */ @@ -1020,6 +1044,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr &dlsch_config_pdu_1_1->PTRSReOffset, dlsch_config_pdu_1_1->number_symbols); if(valid_ptrs_setup==true) { dlsch_config_pdu_1_1->pduBitmap |= 0x1; + LOG_D(MAC, "DL PTRS values: PTRS time den: %d, PTRS freq den: %d\n", dlsch_config_pdu_1_1->PTRSTimeDensity, dlsch_config_pdu_1_1->PTRSFreqDensity); } } @@ -1129,55 +1154,27 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ } uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, - uint8_t dci_format, - uint8_t dci_size, - uint16_t rnti, - uint64_t *dci_pdu, - dci_pdu_rel15_t *dci_pdu_rel15) { + uint8_t dci_format, + uint8_t dci_size, + uint16_t rnti, + uint64_t *dci_pdu, + dci_pdu_rel15_t *dci_pdu_rel15) { int rnti_type = get_rnti_type(mac, rnti); - - AssertFatal(mac->DLbwp[0] != NULL, "DLbwp[0] shouldn't be null here!\n"); - AssertFatal(mac->ULbwp[0] != NULL, "ULbwp[0] shouldn't be null here!\n"); - int N_RB = get_n_rb(mac, rnti_type); - int N_RB_UL = (mac->scg != NULL) ? - NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : - NRRIV2BW(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + int N_RB=0,N_RB_UL=0; int pos=0; int fsize=0; - - if (rnti_type == NR_RNTI_C) { - // First find out the DCI format from the first bit (UE performed blind decoding) - pos++; - dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; -#ifdef DEBUG_EXTRACT_DCI - LOG_D(MAC,"Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,N_RB,dci_size-pos,*dci_pdu); -#endif - - if (dci_format == NR_UL_DCI_FORMAT_0_0 || dci_format == NR_DL_DCI_FORMAT_1_0) { - if (dci_pdu_rel15->format_indicator == 0) - dci_format = NR_UL_DCI_FORMAT_0_0; - else - dci_format = NR_DL_DCI_FORMAT_1_0; - } - else if (dci_format == NR_UL_DCI_FORMAT_0_1 || dci_format == NR_DL_DCI_FORMAT_1_1) { - // In case the sizes of formats 0_1 and 1_1 happen to be the same - if (dci_pdu_rel15->format_indicator == 0) - dci_format = NR_UL_DCI_FORMAT_0_1; - else - dci_format = NR_DL_DCI_FORMAT_1_1; - } - } -#ifdef DEBUG_EXTRACT_DCI - LOG_D(MAC, "DCI format is %d\n", dci_format); -#endif - + LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d\n",*dci_pdu,dci_size); switch(dci_format) { case NR_DL_DCI_FORMAT_1_0: switch(rnti_type) { case NR_RNTI_RA: + // check BWP id + if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + // Freq domain assignment fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); pos=fsize; @@ -1213,7 +1210,21 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; case NR_RNTI_C: - + + //Identifier for DCI formats + pos++; + dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; + if (dci_pdu_rel15->format_indicator == 0) + //switch to DCI_0_0 + return 2+nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, dci_pdu, dci_pdu_rel15); +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,N_RB,dci_size-pos,*dci_pdu); +#endif + + // check BWP id + if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + // Freq domain assignment (275rb >> fsize = 16) fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); pos+=fsize; @@ -1323,7 +1334,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, } //end else break; - + case NR_RNTI_P: /* // Short Messages Indicator â€E2 bits @@ -1353,110 +1364,184 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; case NR_RNTI_SI: - - // Freq domain assignment 0-16 bit - fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); - pos+=fsize; - dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1); - - // Time domain assignment 4 bit - pos+=4; - dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf; - - // VRB to PRB mapping 1 bit - pos++; - dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&0x1; - - // MCS 5bit //bit over 32, so dci_pdu ++ - pos+=5; - dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f; - - // Redundancy version 2 bit - pos+=2; - dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3; - - // System information indicator 1 bit - pos++; - dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1; - - LOG_D(MAC,"N_RB = %i\n", N_RB); - LOG_D(MAC,"dci_size = %i\n", dci_size); - LOG_D(MAC,"fsize = %i\n", fsize); - LOG_D(MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); - LOG_D(MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); - LOG_D(MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); - LOG_D(MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); - LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); - LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); - + N_RB = mac->type0_PDCCH_CSS_config.num_rbs; + // Freq domain assignment 0-16 bit + fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); + pos+=fsize; + dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1); + + // Time domain assignment 4 bit + pos+=4; + dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf; + + // VRB to PRB mapping 1 bit + pos++; + dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&0x1; + + // MCS 5bit //bit over 32, so dci_pdu ++ + pos+=5; + dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f; + + // Redundancy version 2 bit + pos+=2; + dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3; + + // System information indicator 1 bit + pos++; + dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1; + + LOG_D(MAC,"N_RB = %i\n", N_RB); + LOG_D(MAC,"dci_size = %i\n", dci_size); + LOG_D(MAC,"fsize = %i\n", fsize); + LOG_D(MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); + break; case NR_RNTI_TC: - // indicating a DL DCI format 1bit + + // check BWP id + if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + + // indicating a DL DCI format - 1 bit pos++; dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; - // Freq domain assignment 0-16 bit + + if (dci_pdu_rel15->format_indicator == 0) + return 1; // discard dci, format indicator not corresponding to dci_format + + // Freq domain assignment 0-16 bit fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); pos+=fsize; dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1); - // Time domain assignment 4 bit + + // Time domain assignment - 4 bits pos+=4; dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf; - // VRB to PRB mapping 1 bit + + // VRB to PRB mapping - 1 bit + pos++; dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&1; + // MCS 5bit //bit over 32, so dci_pdu ++ pos+=5; dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f; - // New data indicator 1bit + + // New data indicator - 1 bit + pos++; dci_pdu_rel15->ndi = (*dci_pdu>>(dci_size-pos))&1; - // Redundancy version 2bit + + // Redundancy version - 2 bits pos+=2; dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3; - // HARQ process number 4bit + + // HARQ process number - 4 bits pos+=4; dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf; - // Downlink assignment index â€E2 bits + + // Downlink assignment index - 2 bits pos+=2; dci_pdu_rel15->dai[0].val = (*dci_pdu>>(dci_size-pos))&3; - // TPC command for scheduled PUCCH â€E2 bits + + // TPC command for scheduled PUCCH - 2 bits pos+=2; dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3; - // PDSCH-to-HARQ_feedback timing indicator â€E3 bits + + // PUCCH resource indicator - 3 bits + pos+=3; + dci_pdu_rel15->pucch_resource_indicator = (*dci_pdu>>(dci_size-pos))&7; + + // PDSCH-to-HARQ_feedback timing indicator - 3 bits pos+=3; dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = (*dci_pdu>>(dci_size-pos))&7; - + + LOG_D(NR_MAC,"N_RB = %i\n", N_RB); + LOG_D(NR_MAC,"dci_size = %i\n", dci_size); + LOG_D(NR_MAC,"fsize = %i\n", fsize); + LOG_D(NR_MAC,"dci_pdu_rel15->format_indicator = %i\n", dci_pdu_rel15->format_indicator); + LOG_D(NR_MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(NR_MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(NR_MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(NR_MAC,"dci_pdu_rel15->harq_pid = %i\n", dci_pdu_rel15->harq_pid); + LOG_D(NR_MAC,"dci_pdu_rel15->dai[0].val = %i\n", dci_pdu_rel15->dai[0].val); + LOG_D(NR_MAC,"dci_pdu_rel15->tpc = %i\n", dci_pdu_rel15->tpc); + LOG_D(NR_MAC,"dci_pdu_rel15->pucch_resource_indicator = %i\n", dci_pdu_rel15->pucch_resource_indicator); + LOG_D(NR_MAC,"dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = %i\n", dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val); + break; } break; case NR_UL_DCI_FORMAT_0_0: + if (mac->ULbwp[0]) N_RB_UL=NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + else N_RB_UL=NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + switch(rnti_type) { case NR_RNTI_C: + //Identifier for DCI formats + pos++; + dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"Format indicator %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,dci_size-pos,*dci_pdu); +#endif + if (dci_pdu_rel15->format_indicator == 1) + return 1; // discard dci, format indicator not corresponding to dci_format fsize = (int)ceil( log2( (N_RB_UL*(N_RB_UL+1))>>1 ) ); pos+=fsize; dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1); +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"Freq domain assignment %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_domain_assignment.val,fsize,dci_size-pos,*dci_pdu); +#endif // Time domain assignment 4bit pos+=4; dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"time-domain assignment %d (4 bits)=> %d (0x%lx)\n",dci_pdu_rel15->time_domain_assignment.val,dci_size-pos,*dci_pdu); +#endif // Frequency hopping flag â€E1 bit pos++; dci_pdu_rel15->frequency_hopping_flag.val= (*dci_pdu>>(dci_size-pos))&1; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"frequency_hopping %d (1 bit)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_hopping_flag.val,dci_size-pos,*dci_pdu); +#endif // MCS 5 bit pos+=5; dci_pdu_rel15->mcs= (*dci_pdu>>(dci_size-pos))&0x1f; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"mcs %d (5 bits)=> %d (0x%lx)\n",dci_pdu_rel15->mcs,dci_size-pos,*dci_pdu); +#endif // New data indicator 1bit pos++; dci_pdu_rel15->ndi= (*dci_pdu>>(dci_size-pos))&1; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"NDI %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->ndi,1,dci_size-pos,*dci_pdu); +#endif // Redundancy version 2bit pos+=2; dci_pdu_rel15->rv= (*dci_pdu>>(dci_size-pos))&3; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"RV %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->rv,2,dci_size-pos,*dci_pdu); +#endif // HARQ process number 4bit pos+=4; dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"HARQ_PID %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->harq_pid,4,dci_size-pos,*dci_pdu); +#endif // TPC command for scheduled PUSCH â€E2 bits pos+=2; dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3; +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"TPC %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->tpc,2,dci_size-pos,*dci_pdu); +#endif // UL/SUL indicator â€E1 bit /* commented for now (RK): need to get this from BWP descriptor if (cfg->pucch_config.pucch_GroupHopping.value) @@ -1508,6 +1593,11 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, switch(rnti_type) { case NR_RNTI_C: + //Identifier for DCI formats + pos++; + dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; + if (dci_pdu_rel15->format_indicator == 0) + return 1; // discard dci, format indicator not corresponding to dci_format // Carrier indicator pos+=dci_pdu_rel15->carrier_indicator.nbits; dci_pdu_rel15->carrier_indicator.val = (*dci_pdu>>(dci_size-pos))&((1<<dci_pdu_rel15->carrier_indicator.nbits)-1); @@ -1593,6 +1683,11 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, switch(rnti_type) { case NR_RNTI_C: + //Identifier for DCI formats + pos++; + dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; + if (dci_pdu_rel15->format_indicator == 1) + return 1; // discard dci, format indicator not corresponding to dci_format // Carrier indicator pos+=dci_pdu_rel15->carrier_indicator.nbits; dci_pdu_rel15->carrier_indicator.val = (*dci_pdu>>(dci_size-pos))&((1<<dci_pdu_rel15->carrier_indicator.nbits)-1); @@ -1701,7 +1796,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; } - return dci_format; + return 0; } /////////////////////////////////// @@ -1746,7 +1841,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, frame_t frameP = dl_info->frame; int slot = dl_info->slot; uint8_t *pduP = (dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu; - uint16_t pdu_len = (dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu_length; + int16_t pdu_len = (int16_t)(dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu_length; uint8_t gNB_index = dl_info->gNB_index; uint8_t CC_id = dl_info->cc_id; uint8_t done = 0; @@ -1757,32 +1852,54 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, return; } - LOG_D(MAC, "In %s [%d.%d]: processing PDU %d of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, dl_info->rx_ind->number_pdus); + LOG_D(MAC, "In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus); while (!done && pdu_len > 0){ mac_ce_len = 0x0000; mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct mac_sdu_len = 0x0000; rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; - //#ifdef DEBUG_HEADER_PARSING - LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID, pdu_len); - //#endif LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); switch(rx_lcid){ // MAC CE case DL_SCH_LCID_CCCH: - // MSG4 RRC Connection Setup 38.331 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; + // MSG4 RRC Setup 38.331 + // variable length + if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ + mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8) + | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff); + mac_subheader_len = 3; + } else { + mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L; mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } + } + // Check if it is a valid CCCH message, we get all 00's messages very often + int i = 0; + for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + if(pduP[i] != 0) { + break; + } + } + if (i == (mac_subheader_len+mac_sdu_len)) { + LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len); + done = 1; break; + } + + if ( mac_sdu_len > 0 ) { + LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_sdu_len); + for (int i = 0; i < mac_subheader_len; i++) { + LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]); + } + for (int i = 0; i < mac_sdu_len; i++) { + LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]); + } + nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_sdu_len); + } + break; case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: @@ -1889,17 +2006,34 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, break; case DL_SCH_LCID_CON_RES_ID: - // Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16 - // WIP todo: handle CCCH_pdu - mac_ce_len = 6; - - LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution msg: %x.%x.%x.%x.%x.%x, Terminating RA procedure\n", module_idP, frameP, pduP[0], pduP[1], pduP[2], pduP[3], pduP[4], pduP[5]); + // Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16 + // MAC Header: 1 byte (R/R/LCID) + // MAC SDU: 6 bytes (UE Contention Resolution Identity) + mac_ce_len = 6; + + if(ra->ra_state == WAIT_CONTENTION_RESOLUTION) { + LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure\n", + module_idP, frameP, pduP[1], pduP[2], pduP[3], pduP[4], pduP[5], pduP[6]); + + bool ra_success = true; + for(int i = 0; i<mac_ce_len; i++) { + if(ra->cont_res_id[i] != pduP[i+1]) { + ra_success = false; + break; + } + } - if (ra->RA_active == 1) { + if ( (ra->RA_active == 1) && ra_success) { nr_ra_succeeded(module_idP, frameP, slot); + } else if (!ra_success){ + // TODO: Handle failure of RA procedure @ MAC layer + // nr_ra_failed(module_idP, CC_id, prach_resources, frameP, slot); // prach_resources is a PHY structure + ra->ra_state = RA_UE_IDLE; + ra->RA_active = 0; } + } - break; + break; case DL_SCH_LCID_PADDING: done = 1; // end of MAC PDU, can ignore the rest. @@ -1937,8 +2071,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, LOG_T(MAC, "\n"); #endif - if (IS_SOFTMODEM_NOS1){ - if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DTCH) { +// if (IS_SOFTMODEM_NOS1){ + if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DCCH) { mac_rlc_data_ind(module_idP, mac->crnti, @@ -1954,14 +2088,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, } else { LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (gNB %d)\n", module_idP, frameP, rx_lcid, gNB_index); } - } +// } break; } pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); if (pdu_len < 0) - LOG_E(MAC, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", pdu_len); + LOG_E(MAC, "[UE %d][%d.%d] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", module_idP, frameP, slot, pdu_len); } } @@ -2017,8 +2151,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, last_size = 3; } } else { // UL CCCH SDU - mac_pdu_ptr->R = 0; - mac_pdu_ptr->LCID = sdu_lcids[i]; + ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; + ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = sdu_lcids[i]; + last_size = 1; } mac_pdu_ptr += last_size; @@ -2194,27 +2329,32 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer uint8_t preamble_index = get_ra_PreambleIndex(mod_id, cc_id, gNB_id); //prach_resources->ra_PreambleIndex; - LOG_D(MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); + LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); while (1) { n_subheaders++; if (rarh->T == 1) { n_subPDUs++; - LOG_D(MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mod_id); + LOG_I(NR_MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mod_id); } else { - n_subPDUs++; ra->RA_backoff_indicator = table_7_2_1[((NR_RA_HEADER_BI *)rarh)->BI]; ra->RA_BI_found = 1; - LOG_D(MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d\n", mod_id, ra->RA_backoff_indicator); + LOG_I(NR_MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d ms\n", mod_id, ra->RA_backoff_indicator); + if ( ((NR_RA_HEADER_BI *)rarh)->E == 1) { + rarh += sizeof(NR_RA_HEADER_BI); + continue; + } else { + break; + } } if (rarh->RAPID == preamble_index) { - LOG_I(MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID); + LOG_I(NR_MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID); rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR)); ra->RA_RAPID_found = 1; break; } if (rarh->E == 0) { - LOG_W(PHY,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match the intended RAPID...\n", mod_id, preamble_index); + LOG_W(NR_MAC,"[UE %d][RAPROC][%d.%d] Received RAR preamble (%d) doesn't match the intended RAPID (%d)\n", mod_id, frame, slot, rarh->RAPID, preamble_index); break; } else { rarh += sizeof(NR_MAC_RAR) + 1; @@ -2290,21 +2430,37 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t rnti = mac->crnti; } - #ifdef DEBUG_RAR - LOG_D(MAC, "In %s:[%d.%d]: [UE %d] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n", - __FUNCTION__, - frame, - slot, - mod_id, - rar_grant.Msg3_t_alloc, - rar_grant.Msg3_f_alloc, - ul_time_alignment->ta_command, - rar_grant.mcs, - rar_grant.freq_hopping, - tpc_command, - csi_req, - ra->t_crnti); - #endif +#ifdef DEBUG_RAR + LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E); + LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T); + LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID); + + LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R); + LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1); + + LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2); + LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1); + + LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2); + LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3); + LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4); + + LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1); + LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2); + + LOG_I(NR_MAC, "In %s:[%d.%d]: [UE %d] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d t_crnti %x \n", + __FUNCTION__, + frame, + slot, + mod_id, + rar_grant.Msg3_t_alloc, + rar_grant.Msg3_f_alloc, + ul_time_alignment->ta_command, + rar_grant.mcs, + rar_grant.freq_hopping, + tpc_command, + ra->t_crnti); +#endif // Schedule Msg3 ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, rar_grant.Msg3_t_alloc); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 194df8101f0922b56dc9383f4ab51888c5c91a45..1ca5956ee5510f939a03c1f71b026720ea40c5d0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -61,7 +61,7 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in ul_config->sfn = frame_tx; ul_config->number_pdus++; - LOG_D(MAC, "In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n", __FUNCTION__, ul_config->sfn, ul_config->slot, ul_config->number_pdus); + LOG_D(NR_MAC, "In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n", __FUNCTION__, ul_config->sfn, ul_config->slot, ul_config->number_pdus); } @@ -93,24 +93,36 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { long k2 = -1; // Get K2 from RRC configuration - NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup; + NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0] ? mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup : NULL; NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; - if (pusch_config->pusch_TimeDomainAllocationList) { + if (pusch_config && pusch_config->pusch_TimeDomainAllocationList) { pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup; } - else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { + else if (mac->ULbwp[0] && + mac->ULbwp[0]->bwp_Common&& + mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon&& + mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup && + mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } + else if (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) + pusch_TimeDomainAllocationList=mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + else AssertFatal(1==0,"need to fall back to default PUSCH time-domain allocations\n"); + if (pusch_TimeDomainAllocationList) { if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) { - LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n", + LOG_E(NR_MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n", time_domain_ind, pusch_TimeDomainAllocationList->list.count); return -1; } k2 = *pusch_TimeDomainAllocationList->list.array[time_domain_ind]->k2; } - - LOG_D(MAC, "get_k2(): k2 is %ld\n", k2); + + AssertFatal(k2 >= DURATION_RX_TO_TX, + "Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d)\n", + k2,DURATION_RX_TO_TX); + + LOG_D(NR_MAC, "get_k2(): k2 is %ld\n", k2); return k2; } @@ -120,22 +132,26 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { */ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot) { + NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon; + //Check if request to access ul_config is for a UL slot - if (is_nr_UL_slot(mac->scc, slot, mac->frame_type) == 0) { - LOG_W(MAC, "Slot %d is not a UL slot. %s called for wrong slot!!!\n", slot, __FUNCTION__); + if (is_nr_UL_slot(tdd_config, slot, mac->frame_type) == 0) { + LOG_W(NR_MAC, "Slot %d is not a UL slot. %s called for wrong slot!!!\n", slot, __FUNCTION__); return NULL; } // Calculate the index of the UL slot in mac->ul_config_request list. This is // based on the TDD pattern (slot configuration period) and number of UL+mixed // slots in the period. TS 38.213 Sec 11.1 - int mu = mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; - NR_TDD_UL_DL_Pattern_t *tdd_pattern = &mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1; + int mu = mac->ULbwp[0] ? + mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing : + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing; + NR_TDD_UL_DL_Pattern_t *tdd_pattern = &tdd_config->pattern1; const int num_slots_per_tdd = nr_slots_per_frame[mu] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity); const int num_slots_ul = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0); - int index = (slot + num_slots_ul - num_slots_per_tdd) % num_slots_per_tdd; + int index = slot % num_slots_ul; - LOG_D(MAC, "In %s slots per tdd %d, num_slots_ul %d, index %d\n", __FUNCTION__, + LOG_D(NR_MAC, "In %s slots per tdd %d, num_slots_ul %d, index %d\n", __FUNCTION__, num_slots_per_tdd, num_slots_ul, index); @@ -469,7 +485,6 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, uint16_t number_dmrs_symbols = 0; int N_PRB_oh = 0; - NR_ServingCellConfigCommon_t *scc = mac->scc; int rnti_type = get_rnti_type(mac, rnti); // Common configuration @@ -477,30 +492,51 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; pusch_config_pdu->nrOfLayers = 1; pusch_config_pdu->rnti = rnti; + NR_BWP_UplinkCommon_t *initialUplinkBWP; + if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP; + else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; if (rar_grant) { // Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0 - NR_BWP_Uplink_t *ubwp = mac->ULbwp[0]; - NR_BWP_UplinkDedicated_t *ibwp = mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; - NR_PUSCH_Config_t *pusch_Config = ibwp->pusch_Config->choice.setup; - int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength; - - // active BWP start - int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - - // initial BWP start - int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + NR_BWP_UplinkDedicated_t *ibwp; + int scs,abwp_start,abwp_size,startSymbolAndLength; + NR_PUSCH_Config_t *pusch_Config=NULL; + if (mac->cg && ubwp && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP + ) { + ibwp = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; + pusch_Config = ibwp->pusch_Config->choice.setup; + startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength; + + // active BWP start + abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + scs = ubwp->bwp_Common->genericParameters.subcarrierSpacing; + } + else { + startSymbolAndLength = initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength; + + // active BWP start + abwp_start = NRRIV2PRBOFFSET(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + abwp_size = NRRIV2BW(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + scs = initialUplinkBWP->genericParameters.subcarrierSpacing; + } + int ibwp_start = NRRIV2PRBOFFSET(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + int ibwp_size = NRRIV2BW(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - // BWP start selection according to 8.3 of TS 38.213 - pusch_config_pdu->bwp_size = ibwp_size; - if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size)) + // BWP start selection according to 8.3 of TS 38.213 + if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size)) { pusch_config_pdu->bwp_start = abwp_start; - else + pusch_config_pdu->bwp_size = abwp_size; + } else { pusch_config_pdu->bwp_start = ibwp_start; + pusch_config_pdu->bwp_size = ibwp_size; + } //// Resource assignment from RAR // Frequency domain allocation according to 8.3 of TS 38.213 @@ -514,7 +550,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, return -1; // virtual resource block to physical resource mapping for Msg3 PUSCH (6.3.1.7 in 38.211) - pusch_config_pdu->rb_start += ibwp_start - abwp_start; + //pusch_config_pdu->rb_start += ibwp_start - abwp_start; // Time domain allocation SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); @@ -522,7 +558,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->nr_of_symbols = NrOfSymbols; #ifdef DEBUG_MSG3 - LOG_D(MAC, "In %s BWP assignment (BWP (start %d, size %d) \n", __FUNCTION__, pusch_config_pdu->bwp_start, pusch_config_pdu->bwp_size); + LOG_D(NR_MAC, "In %s BWP assignment (BWP (start %d, size %d) \n", __FUNCTION__, pusch_config_pdu->bwp_start, pusch_config_pdu->bwp_size); #endif // MCS @@ -539,17 +575,17 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->scid = 0; // Transform precoding according to 6.1.3 UE procedure for applying transform precoding on PUSCH in 38.214 - pusch_config_pdu->transform_precoding = get_transformPrecoding(scc, pusch_Config, NULL, NULL, NR_RNTI_RA, 0); // TBR fix rnti and take out + pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, NULL, NR_RNTI_TC, 0); // TBR fix rnti and take out // Resource allocation in frequency domain according to 6.1.2.2 in TS 38.214 - pusch_config_pdu->resource_alloc = pusch_Config->resourceAllocation; + pusch_config_pdu->resource_alloc = (mac->cg) ? pusch_Config->resourceAllocation : 1; //// Completing PUSCH PDU pusch_config_pdu->mcs_table = 0; pusch_config_pdu->cyclic_prefix = 0; - pusch_config_pdu->data_scrambling_id = *scc->physCellId; - pusch_config_pdu->ul_dmrs_scrambling_id = *scc->physCellId; - pusch_config_pdu->subcarrier_spacing = ubwp->bwp_Common->genericParameters.subcarrierSpacing; + pusch_config_pdu->data_scrambling_id = mac->physCellId; + pusch_config_pdu->ul_dmrs_scrambling_id = mac->physCellId; + pusch_config_pdu->subcarrier_spacing = scs; pusch_config_pdu->vrb_to_prb_mapping = 0; pusch_config_pdu->uplink_frequency_shift_7p5khz = 0; //Optional Data only included if indicated in pduBitmap @@ -561,29 +597,32 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, } else if (dci) { int target_ss; - uint8_t ptrs_time_density; - uint8_t ptrs_freq_density; - nfapi_nr_ue_ptrs_ports_t ptrs_ports_list; - uint16_t n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - fapi_nr_pusch_config_dedicated_t *pusch_config_dedicated = &mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated; - NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup; + bool valid_ptrs_setup = 0; + uint16_t n_RB_ULBWP; + if (mac->ULbwp[0] && + mac->ULbwp[0]->bwp_Common) { + n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } + else { + pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + n_RB_ULBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } + + pusch_config_pdu->bwp_size = n_RB_ULBWP; - // These should come from RRC config!!! - 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; + fapi_nr_pusch_config_dedicated_t *pusch_config_dedicated = &mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated; + NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0] ? mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup : NULL; // Basic sanity check for MCS value to check for a false or erroneous DCI if (dci->mcs > 28) { - LOG_W(MAC, "MCS value %d out of bounds! Possibly due to false DCI. Ignoring DCI!\n", dci->mcs); + LOG_W(NR_MAC, "MCS value %d out of bounds! Possibly due to false DCI. Ignoring DCI!\n", dci->mcs); return -1; } /* Transform precoding */ if (rnti_type != NR_RNTI_CS || (rnti_type == NR_RNTI_CS && dci->ndi == 1)) { - pusch_config_pdu->transform_precoding = get_transformPrecoding(scc, pusch_Config, NULL, dci_format, rnti_type, 0); + pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, dci_format, rnti_type, 0); } /*DCI format-related configuration*/ @@ -595,7 +634,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, /* BANDWIDTH_PART_IND */ if (dci->bwp_indicator.val != 1) { - LOG_W(MAC, "bwp_indicator != 1! Possibly due to false DCI. Ignoring DCI!\n"); + LOG_W(NR_MAC, "bwp_indicator != 1! Possibly due to false DCI. Ignoring DCI!\n"); return -1; } config_bwp_ue(mac, &dci->bwp_indicator.val, dci_format); @@ -605,7 +644,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, } else { - LOG_E(MAC, "In %s: UL grant from DCI format %d is not handled...\n", __FUNCTION__, *dci_format); + LOG_E(NR_MAC, "In %s: UL grant from DCI format %d is not handled...\n", __FUNCTION__, *dci_format); return -1; } @@ -638,7 +677,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, else AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n"); - LOG_D(MAC,"TRANSFORM PRECODING IS ENABLED. CDM groups: %d, U: %d \n", pusch_config_pdu->num_dmrs_cdm_grps_no_data, + LOG_D(NR_MAC,"TRANSFORM PRECODING IS ENABLED. CDM groups: %d, U: %d \n", pusch_config_pdu->num_dmrs_cdm_grps_no_data, pusch_config_pdu->dfts_ofdm.low_papr_group_number); } @@ -650,7 +689,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val,false) < 0) { return -1; } @@ -664,9 +703,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, /* MCS TABLE */ if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) { - pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config->mcs_Table, 0, *dci_format, rnti_type, target_ss, false); + pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_Table : NULL, 0, *dci_format, rnti_type, target_ss, false); } else { - pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config->mcs_TableTransformPrecoder, 1, *dci_format, rnti_type, target_ss, false); + pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_TableTransformPrecoder : NULL, 1, *dci_format, rnti_type, target_ss, false); } /* NDI */ @@ -690,36 +729,50 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->absolute_delta_PUSCH = 4; } - ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table); - ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_config_pdu->rb_size); - // PTRS ports configuration - // TbD: ptrs_dmrs_port and ptrs_port_index are not initialised! - ptrs_ports_list.ptrs_re_offset = 0; - /* DMRS */ - l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); - if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) + l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, typeB, + (*dci_format == NR_UL_DCI_FORMAT_0_1) ? pusch_dmrs_pos0 : pusch_dmrs_pos2, pusch_len1); + if ((mac->ULbwp[0] && pusch_config_pdu->transform_precoding == transform_precoder_disabled)) pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1; - + else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || mac->ULbwp[0] && pusch_config_pdu->transform_precoding == transform_precoder_enabled) + pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; + // Num PRB Overhead from PUSCH-ServingCellConfig - if (mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead == NULL) { - N_PRB_oh = 0; - } else { - N_PRB_oh = *mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead; - } + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead) + N_PRB_oh = *mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead; - /* PTRS */ - pusch_config_pdu->pusch_ptrs.ptrs_time_density = ptrs_time_density; - pusch_config_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density; - pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list; + else N_PRB_oh = 0; - if (1 << pusch_config_pdu->pusch_ptrs.ptrs_time_density >= pusch_config_pdu->nr_of_symbols) { - pusch_config_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS + /* PTRS */ + if (mac->ULbwp[0] && + mac->ULbwp[0]->bwp_Dedicated && + mac->ULbwp[0]->bwp_Dedicated->pusch_Config && + mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup && + mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB && + mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) { + nfapi_nr_ue_ptrs_ports_t ptrs_ports_list; + pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list; + valid_ptrs_setup = set_ul_ptrs_values(mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup, + pusch_config_pdu->rb_size, pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table, + &pusch_config_pdu->pusch_ptrs.ptrs_freq_density,&pusch_config_pdu->pusch_ptrs.ptrs_time_density, + &pusch_config_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset,&pusch_config_pdu->pusch_ptrs.num_ptrs_ports, + &pusch_config_pdu->pusch_ptrs.ul_ptrs_power, pusch_config_pdu->nr_of_symbols); + if(valid_ptrs_setup==true) { + pusch_config_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; + } + LOG_D(NR_MAC, "UL PTRS values: PTRS time den: %d, PTRS freq den: %d\n", pusch_config_pdu->pusch_ptrs.ptrs_time_density, pusch_config_pdu->pusch_ptrs.ptrs_freq_density); + } } } - LOG_D(MAC, "In %s: received UL grant (rb_start %d, rb_size %d, start_symbol_index %d, nr_of_symbols %d) for RNTI type %s \n", + LOG_D(NR_MAC, "In %s: received UL grant (rb_start %d, rb_size %d, start_symbol_index %d, nr_of_symbols %d) for RNTI type %s \n", __FUNCTION__, pusch_config_pdu->rb_start, pusch_config_pdu->rb_size, @@ -732,7 +785,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table); if (pusch_config_pdu->target_code_rate == 0 || pusch_config_pdu->qam_mod_order == 0) { - LOG_W(MAC, "In %s: Invalid code rate or Mod order, likely due to unexpected UL DCI. Ignoring DCI! \n", __FUNCTION__); + LOG_W(NR_MAC, "In %s: Invalid code rate or Mod order, likely due to unexpected UL DCI. Ignoring DCI! \n", __FUNCTION__); return -1; } @@ -769,14 +822,20 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in slot_t rx_slot = dl_info->slot; NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig) + AssertFatal(1==0,"1 > %d.%d csi_MeasConfig is not null\n",rx_frame,rx_slot); + 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) { - + LOG_D(NR_MAC,"nr_ue_scheduler(): mac->cg %p\n",mac->cg); + if (mac->cg == NULL) { if(dl_info->ssb_index != -1){ if(mac->type0_pdcch_ss_mux_pattern == 1){ @@ -817,17 +876,39 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in 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", + LOG_I(NR_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; - - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id); - if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) - mac->if_module->scheduled_response(&scheduled_response); + NR_SearchSpace_t *ss0 = mac->search_space_zero; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + + + if( mac->scc == NULL && mac->scc_SIB == NULL && (rx_frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (rx_slot == mac->type0_PDCCH_CSS_config.n_0) ){ + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, -1); + fill_dci_search_candidates(ss0, rel15); + dl_config->number_pdus = 1; + LOG_D(NR_MAC,"Calling fill_scheduled_response, type0_pdcch, num_pdus %d\n",dl_config->number_pdus); + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id); + if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) + mac->if_module->scheduled_response(&scheduled_response); + } + // this is for Msg2/Msg4 + if (mac->ra.ra_state >= WAIT_RAR) { + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , -1); + fill_dci_search_candidates(ss0, rel15); + dl_config->number_pdus = 1; + LOG_D(NR_MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus); + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id); + if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) + mac->if_module->scheduled_response(&scheduled_response); + } } - } else { // we have an scg + } else { // we have a Master or Secondary CellGroupConfig dcireq.module_id = mod_id; dcireq.gNB_index = gNB_index; @@ -873,9 +954,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in // Schedule ULSCH only if the current frame and slot match those in ul_config_req // AND if a UL grant (UL DCI or Msg3) has been received (as indicated by num_pdus) - if ((ul_info->slot_tx == ul_config->slot && ul_info->frame_tx == ul_config->sfn) && ul_config->number_pdus > 0){ + if (ul_config && (ul_info->slot_tx == ul_config->slot && ul_info->frame_tx == ul_config->sfn) && ul_config->number_pdus > 0){ - LOG_D(MAC, "In %s:[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n", __FUNCTION__, frame_tx, slot_tx, ul_config->number_pdus, ul_config->sfn, ul_config->slot); + LOG_D(NR_MAC, "In %s:[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n", __FUNCTION__, frame_tx, slot_tx, ul_config->number_pdus, ul_config->sfn, ul_config->slot); uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES]; uint8_t data_existing = 0; @@ -889,15 +970,24 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in if (ulcfg_pdu->pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) { uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size; - - if (ra->ra_state == WAIT_RAR){ + LOG_D(NR_MAC,"harq_id %d, NDI %d NDI_DCI %d, TBS_bytes %d (ra_state %d\n", + ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id, + mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id], + ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator, + TBS_bytes, + ra->ra_state ); + if (ra->ra_state == WAIT_RAR && !ra->cfra){ memcpy(ulsch_input_buffer, mac->ulsch_pdu.payload, TBS_bytes); LOG_D(NR_MAC,"[RAPROC] Msg3 to be transmitted:\n"); for (int k = 0; k < TBS_bytes; k++) { LOG_D(NR_MAC,"(%i): 0x%x\n",k,mac->ulsch_pdu.payload[k]); } + LOG_D(NR_MAC,"Flipping NDI for harq_id %d (Msg3)\n",ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator); + mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator; + mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0; } else { - if (IS_SOFTMODEM_NOS1 && (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator)){ + if (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator|| + mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id]==1){ // Getting IP traffic to be transmitted data_existing = nr_ue_get_sdu(mod_id, cc_id, @@ -909,9 +999,12 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in &access_mode); } + LOG_D(NR_MAC,"Flipping NDI for harq_id %d\n",ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator); mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator; + mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0; + //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity - if (!IS_SOFTMODEM_NOS1 || !data_existing) { + if (!data_existing) { //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid //and block this traffic from being forwarded to the upper layers at the gNB LOG_D(PHY, "In %s: Random data to be transmitted: TBS_bytes %d \n", __FUNCTION__, TBS_bytes); @@ -945,6 +1038,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in tx_req.tx_request_body[0].pdu = ulsch_input_buffer; if (ra->ra_state != RA_SUCCEEDED && !ra->cfra){ + LOG_D(NR_MAC,"[RAPROC] RA-Msg3 transmitted\n"); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index); } @@ -980,11 +1074,16 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, int delta = 0; NR_BWP_Uplink_t *ubwp = mac->ULbwp[0]; // Get the numerology to calculate the Tx frame and slot - int mu = ubwp->bwp_Common->genericParameters.subcarrierSpacing; - struct NR_PUSCH_TimeDomainResourceAllocationList *pusch_TimeDomainAllocationList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + int mu = ubwp ? + ubwp->bwp_Common->genericParameters.subcarrierSpacing : + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing; + + NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ubwp ? + ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; // k2 as per 3GPP TS 38.214 version 15.9.0 Release 15 ch 6.1.2.1.1 // PUSCH time domain resource allocation is higher layer configured from uschTimeDomainAllocationList in either pusch-ConfigCommon - uint8_t k2; + int k2; if (is_Msg3) { k2 = *pusch_TimeDomainAllocationList->list.array[tda_id]->k2; @@ -1004,6 +1103,10 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, break; } + AssertFatal((k2+delta) >= DURATION_RX_TO_TX, + "Slot offset (%d) for Msg3 cannot be less than DURATION_RX_TO_TX (%d)\n", + k2+delta,DURATION_RX_TO_TX); + *slot_tx = (current_slot + k2 + delta) % nr_slots_per_frame[mu]; if (current_slot + k2 + delta > nr_slots_per_frame[mu]){ *frame_tx = (current_frame + 1) % 1024; @@ -1025,14 +1128,14 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, } - LOG_D(MAC, "In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta); + LOG_D(NR_MAC, "In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta); return 0; } // Build the list of all the valid RACH occasions in the maximum association pattern period according to the PRACH config -static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { +static void build_ro_list(NR_UE_MAC_INST_t *mac) { int x,y; // PRACH Configuration Index table variables used to compute the valid frame numbers int y2; // PRACH Configuration Index table additional variable used to compute the valid frame numbers @@ -1049,8 +1152,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { uint8_t format2 = 0xff; int nb_fdm; - uint8_t config_index, mu; - uint32_t pointa; + uint8_t config_index, mu=get_softmodem_params()->numerology; int msg1_FDM; uint8_t prach_conf_period_idx; @@ -1058,18 +1160,13 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { uint8_t prach_conf_period_frame_idx; int64_t *prach_config_info_p; - NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + NR_RACH_ConfigCommon_t *setup = (mac->scc) ? + mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; config_index = rach_ConfigGeneric->prach_ConfigurationIndex; - if (setup->msg1_SubcarrierSpacing) - mu = *setup->msg1_SubcarrierSpacing; - else - mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - - pointa = frequencyInfoDL->absoluteFrequencyPointA; msg1_FDM = rach_ConfigGeneric->msg1_FDM; switch (msg1_FDM){ @@ -1087,12 +1184,15 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { // ============================== // WIP: For now assume no rejected PRACH occasions because of conflict with SSB or TDD_UL_DL_ConfigurationCommon schedule + int unpaired = mac->phy_config.config_req.cell_config.frame_duplex_type; // Identify the proper PRACH Configuration Index table according to the operating frequency - LOG_D(MAC,"Pointa %u, mu = %u, PRACH config index = %u, unpaired = %u\n", pointa, mu, config_index, unpaired); - - prach_config_info_p = get_prach_config_info(pointa, config_index, unpaired); + LOG_D(NR_MAC,"mu = %u, PRACH config index = %u, unpaired = %u\n", mu, config_index, unpaired); + int fr2_flag=0; + if (downlink_frequency[0][0] > 6e9) fr2_flag = 1; + + prach_config_info_p = get_prach_config_info(fr2_flag, config_index, unpaired); - if (pointa > 2016666) { //FR2 + if (fr2_flag > 0) { //FR2 x = prach_config_info_p[2]; y = prach_config_info_p[3]; @@ -1123,6 +1223,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { prach_conf_start_symbol = prach_config_info_p[5]; N_t_slot = prach_config_info_p[7]; N_dur = prach_config_info_p[8]; + LOG_D(NR_MAC,"N_t_slot %d, N_dur %d\n",N_t_slot,N_dur); if (prach_config_info_p[1] != -1) format2 = (uint8_t) prach_config_info_p[1]; format = ((uint8_t) prach_config_info_p[0]) | (format2<<8); @@ -1138,7 +1239,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { prach_assoc_pattern.nb_of_prach_conf_period_in_max_period = MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD / x; nb_of_frames_per_prach_conf_period = x; - LOG_D(MAC,"nb_of_prach_conf_period_in_max_period %d\n", prach_assoc_pattern.nb_of_prach_conf_period_in_max_period); + LOG_D(NR_MAC,"nb_of_prach_conf_period_in_max_period %d\n", prach_assoc_pattern.nb_of_prach_conf_period_in_max_period); // Fill in the PRACH occasions table for every slot in every frame in every PRACH configuration periods in the maximum association pattern period // ---------------------------------------------------------------------------------------------------------------------------------------------- @@ -1150,14 +1251,14 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_frame = nb_of_frames_per_prach_conf_period; prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_slot = nr_slots_per_frame[mu]; - LOG_D(MAC,"PRACH Conf Period Idx %d\n", prach_conf_period_idx); + LOG_D(NR_MAC,"PRACH Conf Period Idx %d\n", prach_conf_period_idx); // For every frames in a PRACH configuration period // ------------------------------------------------ for (prach_conf_period_frame_idx=0; prach_conf_period_frame_idx<nb_of_frames_per_prach_conf_period; prach_conf_period_frame_idx++) { frame = (prach_conf_period_idx * nb_of_frames_per_prach_conf_period) + prach_conf_period_frame_idx; - LOG_D(MAC,"PRACH Conf Period Frame Idx %d - Frame %d\n", prach_conf_period_frame_idx, frame); + LOG_D(NR_MAC,"PRACH Conf Period Frame Idx %d - Frame %d\n", prach_conf_period_frame_idx, frame); // Is it a valid frame for this PRACH configuration index? (n_sfn mod x = y) if ( (frame%x)==y || (frame%x)==y2 ) { @@ -1184,7 +1285,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { for (n_prach_occ_in_time=0; n_prach_occ_in_time<N_t_slot; n_prach_occ_in_time++) { uint8_t start_symbol = prach_conf_start_symbol + n_prach_occ_in_time * N_dur; - LOG_D(MAC,"PRACH Occ in time %d\n", n_prach_occ_in_time); + LOG_D(NR_MAC,"PRACH Occ in time %d\n", n_prach_occ_in_time); for (n_prach_occ_in_freq=0; n_prach_occ_in_freq<nb_fdm; n_prach_occ_in_freq++) { prach_occasion_info_t *prach_occasion_p = &prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].prach_occasion_slot_map[prach_conf_period_frame_idx][slot].prach_occasion[n_prach_occ_in_time][n_prach_occ_in_freq]; @@ -1196,7 +1297,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { prach_occasion_p->format = format; prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_prach_occasion++; - LOG_D(MAC,"Adding a PRACH occasion: frame %u, slot-symbol %d-%d, occ_in_time-occ_in-freq %d-%d, nb ROs in conf period %d, for this slot: RO# in time %d, RO# in freq %d\n", + LOG_D(NR_MAC,"Adding a PRACH occasion: frame %u, slot-symbol %d-%d, occ_in_time-occ_in-freq %d-%d, nb ROs in conf period %d, for this slot: RO# in time %d, RO# in freq %d\n", frame, slot, start_symbol, n_prach_occ_in_time, n_prach_occ_in_freq, prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_prach_occasion, prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].prach_occasion_slot_map[prach_conf_period_frame_idx][slot].nb_of_prach_occasion_in_time, prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].prach_occasion_slot_map[prach_conf_period_frame_idx][slot].nb_of_prach_occasion_in_freq); @@ -1210,7 +1311,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) { } // Build the list of all the valid/transmitted SSBs according to the config -static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) { +static void build_ssb_list(NR_UE_MAC_INST_t *mac) { // Create the list of transmitted SSBs // =================================== @@ -1218,51 +1319,53 @@ static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) { uint64_t ssb_positionsInBurst; uint8_t ssb_idx = 0; - switch (scc->ssb_PositionsInBurst->present) { + if (mac->scc) { + NR_ServingCellConfigCommon_t *scc = mac->scc; + switch (scc->ssb_PositionsInBurst->present) { case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap: ssb_bitmap = &scc->ssb_PositionsInBurst->choice.shortBitmap; - + ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap); - LOG_D(MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst); - + LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst); + for (uint8_t bit_nb=3; bit_nb<=3; bit_nb--) { // If SSB is transmitted if ((ssb_positionsInBurst>>bit_nb) & 0x01) { ssb_list.nb_tx_ssb++; ssb_list.tx_ssb[ssb_idx].transmitted = true; - LOG_D(MAC,"SSB idx %d transmitted\n", ssb_idx); + LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); } ssb_idx++; } break; case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap: ssb_bitmap = &scc->ssb_PositionsInBurst->choice.mediumBitmap; - + ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap); - LOG_D(MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst); - + LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst); + for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) { // If SSB is transmitted if ((ssb_positionsInBurst>>bit_nb) & 0x01) { ssb_list.nb_tx_ssb++; ssb_list.tx_ssb[ssb_idx].transmitted = true; - LOG_D(MAC,"SSB idx %d transmitted\n", ssb_idx); + LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); } ssb_idx++; } break; case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap: ssb_bitmap = &scc->ssb_PositionsInBurst->choice.longBitmap; - + ssb_positionsInBurst = BIT_STRING_to_uint64(ssb_bitmap); - LOG_D(MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst); - + LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst); + for (uint8_t bit_nb=63; bit_nb<=63; bit_nb--) { // If SSB is transmitted if ((ssb_positionsInBurst>>bit_nb) & 0x01) { ssb_list.nb_tx_ssb++; ssb_list.tx_ssb[ssb_idx].transmitted = true; - LOG_D(MAC,"SSB idx %d transmitted\n", ssb_idx); + LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); } ssb_idx++; } @@ -1270,16 +1373,36 @@ static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) { default: AssertFatal(false,"ssb_PositionsInBurst not present\n"); break; + } + } else { // This is configuration from SIB1 + + AssertFatal(mac->scc_SIB->ssb_PositionsInBurst.groupPresence == NULL, "Handle case for >8 SSBs\n"); + ssb_bitmap = &mac->scc_SIB->ssb_PositionsInBurst.inOneGroup; + + ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap); + LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst); + + for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) { + // If SSB is transmitted + if ((ssb_positionsInBurst>>bit_nb) & 0x01) { + ssb_list.nb_tx_ssb++; + ssb_list.tx_ssb[ssb_idx].transmitted = true; + LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); + } + ssb_idx++; + } } } // Map the transmitted SSBs to the ROs and create the association pattern according to the config -static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { +static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) { // Map SSBs to PRACH occasions // =========================== // WIP: Assumption: No PRACH occasion is rejected because of a conflict with SSBs or TDD_UL_DL_ConfigurationCommon schedule - NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup = (mac->scc) ? + mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB @@ -1326,14 +1449,14 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config); break; } - LOG_D(MAC,"SSB rach ratio %d, Multiple SSB per RO %d\n", ssb_rach_ratio, multiple_ssb_per_ro); + LOG_D(NR_MAC,"SSB rach ratio %d, Multiple SSB per RO %d\n", ssb_rach_ratio, multiple_ssb_per_ro); // Evaluate the number of PRACH configuration periods required to map all the SSBs and set the association period // ============================================================================================================== // WIP: Assumption for now is that all the PRACH configuration periods within a maximum association pattern period have the same number of PRACH occasions // (No PRACH occasions are conflicting with SSBs nor TDD_UL_DL_ConfigurationCommon schedule) // There is only one possible association period which can contain up to 16 PRACH configuration periods - LOG_D(MAC,"Evaluate the number of PRACH configuration periods required to map all the SSBs and set the association period\n"); + LOG_D(NR_MAC,"Evaluate the number of PRACH configuration periods required to map all the SSBs and set the association period\n"); if (true == multiple_ssb_per_ro) { required_nb_of_prach_occasion = ((ssb_list.nb_tx_ssb-1) + ssb_rach_ratio) / ssb_rach_ratio; } @@ -1341,6 +1464,7 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { required_nb_of_prach_occasion = ssb_list.nb_tx_ssb * ssb_rach_ratio; } + AssertFatal(prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion>0,"prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion shouldn't be 0 (ssb_list.nb_tx_ssb %d, ssb_rach_ratio %d\n",ssb_list.nb_tx_ssb,ssb_rach_ratio); required_nb_of_prach_conf_period = ((required_nb_of_prach_occasion-1) + prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion) / prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion; if (required_nb_of_prach_conf_period == 1) { @@ -1366,7 +1490,7 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { prach_assoc_pattern.prach_association_period_list[0].nb_of_frame = prach_assoc_pattern.prach_association_period_list[0].nb_of_prach_conf_period * prach_assoc_pattern.prach_conf_period_list[0].nb_of_frame; prach_assoc_pattern.nb_of_frame = prach_assoc_pattern.prach_association_period_list[0].nb_of_frame; - LOG_D(MAC,"Assoc period %d, Nb of frames in assoc period %d\n", + LOG_D(NR_MAC,"Assoc period %d, Nb of frames in assoc period %d\n", prach_assoc_pattern.prach_association_period_list[0].nb_of_prach_conf_period, prach_assoc_pattern.prach_association_period_list[0].nb_of_frame); @@ -1378,7 +1502,7 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { prach_conf_period_t *prach_conf_period_p; // Map all the association periods within the association pattern period - LOG_D(MAC,"Proceed to the SSB to RO mapping\n"); + LOG_D(NR_MAC,"Proceed to the SSB to RO mapping\n"); for (association_period_idx=0; association_period_idx<prach_assoc_pattern.nb_of_assoc_period; association_period_idx++) { uint8_t n_prach_conf=0; // PRACH Configuration period index within the association period uint8_t frame=0; @@ -1426,8 +1550,8 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { ssb_list.tx_ssb[ssb_idx].nb_mapped_ro++; AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > ssb_list.tx_ssb[ssb_idx].nb_mapped_ro,"Too many mapped ROs (%d) to a single SSB\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); - LOG_D(MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq); - LOG_D(MAC,"Nb mapped ROs for this ssb idx: in the association period only %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); + LOG_D(NR_MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq); + LOG_D(NR_MAC,"Nb mapped ROs for this ssb idx: in the association period only %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); // If all the required SSBs are mapped to this RO, exit the loop of SSBs if (ro_p->nb_mapped_ssb == ssb_rach_ratio) { @@ -1474,6 +1598,9 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { for (ssb_idx=0; ssb_idx<MAX_NB_SSB; ssb_idx++) { uint8_t nb_mapped_ro_in_association_period=0; // Reset the nb of mapped ROs for the new SSB index + LOG_D(NR_MAC,"Checking ssb_idx %d => %d\n", + ssb_idx,ssb_list.tx_ssb[ssb_idx].transmitted); + // Map only the transmitted ssb_idx if (true == ssb_list.tx_ssb[ssb_idx].transmitted) { @@ -1498,8 +1625,8 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) { AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > ssb_list.tx_ssb[ssb_idx].nb_mapped_ro,"Too many mapped ROs (%d) to a single SSB\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); nb_mapped_ro_in_association_period++; - LOG_D(MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq); - LOG_D(MAC,"Nb mapped ROs for this ssb idx: in the association period only %u / total %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, nb_mapped_ro_in_association_period); + LOG_D(NR_MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq); + LOG_D(NR_MAC,"Nb mapped ROs for this ssb idx: in the association period only %u / total %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, nb_mapped_ro_in_association_period); // Exit the loop if this SSB has been mapped to all the required ROs // WIP: Assuming that ssb_rach_ratio equals the maximum nb of times a given ssb_idx is mapped within an association period: @@ -1562,7 +1689,10 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx, // - exact slot number // - frame offset ssb_info_p = &ssb_list.tx_ssb[ssb_idx]; + LOG_D(NR_MAC,"checking for prach : ssb_info_p->nb_mapped_ro %d\n",ssb_info_p->nb_mapped_ro); for (uint8_t n_mapped_ro=0; n_mapped_ro<ssb_info_p->nb_mapped_ro; n_mapped_ro++) { + LOG_D(NR_MAC,"%d: mapped_ro[%d]->slot %d, prach_assoc_pattern.nb_of_frame %d\n", + slot,ssb_info_p->mapped_ro[n_mapped_ro]->frame,ssb_info_p->mapped_ro[n_mapped_ro]->slot,prach_assoc_pattern.nb_of_frame); if ((slot == ssb_info_p->mapped_ro[n_mapped_ro]->slot) && (ssb_info_p->mapped_ro[n_mapped_ro]->frame == (frame % prach_assoc_pattern.nb_of_frame))) { @@ -1622,24 +1752,24 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx, } // Build the SSB to RO mapping upon RRC configuration update -void build_ssb_to_ro_map(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired){ +void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) { // Clear all the lists and maps memset(&prach_assoc_pattern, 0, sizeof(prach_association_pattern_t)); memset(&ssb_list, 0, sizeof(ssb_list_info_t)); // Build the list of all the valid RACH occasions in the maximum association pattern period according to the PRACH config - LOG_D(MAC,"Build RO list\n"); - build_ro_list(scc, unpaired); + LOG_D(NR_MAC,"Build RO list\n"); + build_ro_list(mac); // Build the list of all the valid/transmitted SSBs according to the config - LOG_D(MAC,"Build SSB list\n"); - build_ssb_list(scc); + LOG_D(NR_MAC,"Build SSB list\n"); + build_ssb_list(mac); // Map the transmitted SSBs to the ROs and create the association pattern according to the config - LOG_D(MAC,"Map SSB to RO\n"); - map_ssb_to_ro(scc); - LOG_D(MAC,"Map SSB to RO done\n"); + LOG_D(NR_MAC,"Map SSB to RO\n"); + map_ssb_to_ro(mac); + LOG_D(NR_MAC,"Map SSB to RO done\n"); } // This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x @@ -1663,13 +1793,18 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s nr_scheduled_response_t scheduled_response; NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB; + NR_RACH_ConfigCommon_t *setup; + if (scc!=NULL) setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + else setup = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; ra->RA_offset = 2; // to compensate the rx frame offset at the gNB - ra->generate_nr_prach = 0; // Reset flag for PRACH generation + ra->generate_nr_prach = GENERATE_IDLE; // Reset flag for PRACH generation + NR_TDD_UL_DL_ConfigCommon_t *tdd_config = scc==NULL ? scc_SIB->tdd_UL_DL_ConfigurationCommon : scc->tdd_UL_DL_ConfigurationCommon; + - if (is_nr_UL_slot(scc, slotP, mac->frame_type)) { + if (is_nr_UL_slot(tdd_config, slotP, mac->frame_type)) { // WIP Need to get the proper selected ssb_idx // Initial beam selection functionality is not available yet @@ -1684,7 +1819,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) { AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n"); - ra->generate_nr_prach = 1; + ra->generate_nr_prach = GENERATE_PREAMBLE; format = prach_occasion_info_p->format; format0 = format & 0xff; // single PRACH format @@ -1699,7 +1834,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ncs = get_NCS(rach_ConfigGeneric->zeroCorrelationZoneConfig, format0, setup->restrictedSetConfig); - prach_config_pdu->phys_cell_id = *scc->physCellId; + prach_config_pdu->phys_cell_id = mac->physCellId; prach_config_pdu->num_prach_ocas = 1; prach_config_pdu->prach_slot = prach_occasion_info_p->slot; prach_config_pdu->prach_start_symbol = prach_occasion_info_p->start_symbol; @@ -1710,7 +1845,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s prach_config_pdu->restricted_set = prach_config->restricted_set_config; prach_config_pdu->freq_msg1 = prach_config->num_prach_fd_occasions_list[prach_occasion_info_p->fdm].k1; - LOG_D(MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra); + LOG_D(NR_MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra); // Search which SSB is mapped in the RO (among all the SSBs mapped to this RO) for (prach_config_pdu->ssb_nb_in_ro=0; prach_config_pdu->ssb_nb_in_ro<prach_occasion_info_p->nb_mapped_ssb; prach_config_pdu->ssb_nb_in_ro++) { @@ -1796,7 +1931,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, rlc_buffer_occupancy_t lcid_buffer_occupancy_old = 0, lcid_buffer_occupancy_new = 0; - LOG_D(MAC, + LOG_D(NR_MAC, "[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n", module_idP, frameP, subframe, buflen); AssertFatal(CC_id == 0, @@ -1814,7 +1949,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, buflen_remain = buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); - LOG_D(MAC, + LOG_I(NR_MAC, "[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to " "send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d module_idP, frameP, lcid, lcid_buffer_occupancy_new, @@ -1887,15 +2022,15 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ulsch_buffer[j] = 0; } -#if defined(ENABLE_MAC_PAYLOAD_DEBUG) - LOG_I(MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset); + //#if defined(ENABLE_MAC_PAYLOAD_DEBUG) + LOG_I(NR_MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset); for (int i = 0; i < buflen ; i++) { //harq_process_ul_ue->a[i] = (unsigned char) rand(); //printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); printf("%02x ",(unsigned char)ulsch_buffer[i]); } printf("\n"); -#endif + //#endif return 1; } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 1640ba25a68627aa20af66176feb71725bec98f7..64c18d969ce149d71f7d4546d8e80b0ae2eff1b5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -54,7 +54,7 @@ extern RAN_CONTEXT_t RC; extern void mac_top_init_gNB(void); extern uint8_t nfapi_mode; -void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { +void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0]; RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc; @@ -67,7 +67,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; //temporary cfg->num_tlv++; - LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value); + LOG_I(NR_MAC,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value); cfg->carrier_config.dl_frequency.value = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, @@ -95,7 +95,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]); cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; //temporary cfg->num_tlv++; - LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.uplink_bandwidth.value); + LOG_I(NR_MAC,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.uplink_bandwidth.value); int UL_pointA; if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL) @@ -208,8 +208,12 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); -//k1= msg1_FrequencyStart + 12 (no. of FDM)(RB for PRACH occasion); + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + if (get_softmodem_params()->sa) { + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + } else { + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + } cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; cfg->num_tlv++; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; @@ -240,6 +244,9 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; cfg->num_tlv++; + cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset; + cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; + cfg->num_tlv++; switch (scc->ssb_PositionsInBurst->present) { case 1 : @@ -264,20 +271,34 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->ssb_table.ssb_mask_list[0].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; cfg->ssb_table.ssb_mask_list[1].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; - cfg->num_tlv++; + cfg->num_tlv+=2; cfg->carrier_config.num_tx_ant.value = pdsch_AntennaPorts; AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 13, "pdsch_AntennaPorts in 1...12\n"); cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG; + int num_ssb=0; for (int i=0;i<32;i++) { - num_ssb += (cfg->ssb_table.ssb_mask_list[0].ssb_mask.value>>i)&1; - num_ssb += (cfg->ssb_table.ssb_mask_list[1].ssb_mask.value>>i)&1; + cfg->ssb_table.ssb_beam_id_list[i].beam_id.tl.tag = NFAPI_NR_CONFIG_BEAM_ID_TAG; + if ((cfg->ssb_table.ssb_mask_list[0].ssb_mask.value>>(31-i))&1) { + cfg->ssb_table.ssb_beam_id_list[i].beam_id.value = num_ssb; + num_ssb++; + } + cfg->num_tlv++; + } + for (int i=0;i<32;i++) { + cfg->ssb_table.ssb_beam_id_list[32+i].beam_id.tl.tag = NFAPI_NR_CONFIG_BEAM_ID_TAG; + if ((cfg->ssb_table.ssb_mask_list[1].ssb_mask.value>>(31-i))&1) { + cfg->ssb_table.ssb_beam_id_list[32+i].beam_id.value = num_ssb; + num_ssb++; + } + cfg->num_tlv++; } - cfg->carrier_config.num_rx_ant.value = cfg->carrier_config.num_tx_ant.value; + cfg->carrier_config.num_rx_ant.value = pusch_AntennaPorts; + AssertFatal(pusch_AntennaPorts > 0 && pusch_AntennaPorts < 13, "pusch_AntennaPorts in 1...12\n"); cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG; - LOG_I(MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value); + LOG_I(NR_MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value); AssertFatal(cfg->carrier_config.num_tx_ant.value > 0,"carrier_config.num_tx_ant.value %d !\n",cfg->carrier_config.num_tx_ant.value ); cfg->num_tlv++; cfg->num_tlv++; @@ -294,34 +315,33 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->tdd_table.tdd_period.value = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; } if(cfg->cell_config.frame_duplex_type.value == TDD){ - LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value); - int return_tdd = set_tdd_config_nr(cfg, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols); - - if (return_tdd != 0) - LOG_E(MAC,"TDD configuration can not be done\n"); - else - LOG_I(MAC,"TDD has been properly configurated\n"); + LOG_I(NR_MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value); + int periods_per_frame = set_tdd_config_nr(cfg, + scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols); + + if (periods_per_frame < 0) + LOG_E(NR_MAC,"TDD configuration can not be done\n"); + else { + LOG_I(NR_MAC,"TDD has been properly configurated\n"); + RC.nrmac[Mod_idP]->tdd_beam_association = (int16_t *)malloc16(periods_per_frame*sizeof(int16_t)); + } } } - - extern uint16_t sl_ahead; -int rrc_mac_config_req_gNB(module_id_t Mod_idP, - int ssb_SubcarrierOffset, +int rrc_mac_config_req_gNB(module_id_t Mod_idP, + int ssb_SubcarrierOffset, int pdsch_AntennaPorts, - int pusch_tgt_snrx10, - int pucch_tgt_snrx10, + int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc, int add_ue, uint32_t rnti, - NR_CellGroupConfig_t *secondaryCellGroup){ + NR_CellGroupConfig_t *CellGroup){ if (scc != NULL ) { AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present); @@ -358,12 +378,14 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, i); } - LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n"); + LOG_I(NR_MAC,"Configuring common parameters from NR ServingCellConfig\n"); config_common(Mod_idP, - pdsch_AntennaPorts, + ssb_SubcarrierOffset, + pdsch_AntennaPorts, + pusch_AntennaPorts, scc); - LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req); + LOG_E(NR_MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req); // if in nFAPI mode if ( (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){ @@ -373,32 +395,36 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, printf("Waiting for PHY_config_req\n"); } } - - RC.nrmac[Mod_idP]->pusch_target_snrx10 = pusch_tgt_snrx10; - RC.nrmac[Mod_idP]->pucch_target_snrx10 = pucch_tgt_snrx10; + RC.nrmac[Mod_idP]->ssb_SubcarrierOffset = ssb_SubcarrierOffset; + NR_PHY_Config_t phycfg; phycfg.Mod_id = Mod_idP; phycfg.CC_id = 0; phycfg.cfg = &RC.nrmac[Mod_idP]->config[0]; - phycfg.cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset; - phycfg.cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; - phycfg.cfg->num_tlv++; - if (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req) RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req(&phycfg); find_SSB_and_RO_available(Mod_idP); + if (get_softmodem_params()->sa > 0) { + NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[0]; + for (int n=0;n<NR_NB_RA_PROC_MAX;n++ ) { + cc->ra[n].cfra = false; + cc->ra[n].rnti = 0; + cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; + cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t)); + for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) + cc->ra[n].preambles.preamble_list[i] = i; + } + } } - if (secondaryCellGroup) { - - RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup; + if (CellGroup) { NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { - const int UE_id = add_new_nr_ue(Mod_idP, rnti, secondaryCellGroup); - LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti); + const int UE_id = add_new_nr_ue(Mod_idP, rnti, CellGroup); + LOG_I(PHY,"Added new UE_id %d/%x with initial CellGroup\n",UE_id,rnti); } else if (add_ue == 1 && !get_softmodem_params()->phy_test) { const int CC_id = 0; NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[CC_id]; @@ -408,16 +434,17 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if((cc->ra[ra_index].state == RA_IDLE) && (!cc->ra[ra_index].cfra)) break; } if (ra_index == NR_NB_RA_PROC_MAX) { - LOG_E(MAC, "%s() %s:%d RA processes are not available for CFRA RNTI :%x\n", __FUNCTION__, __FILE__, __LINE__, rnti); + LOG_E(NR_MAC, "%s() %s:%d RA processes are not available for CFRA RNTI :%x\n", __FUNCTION__, __FILE__, __LINE__, rnti); return -1; } NR_RA_t *ra = &cc->ra[ra_index]; - ra->secondaryCellGroup = secondaryCellGroup; - if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) { - if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) { + ra->CellGroup = CellGroup; + if (CellGroup->spCellConfig && CellGroup->spCellConfig->reconfigurationWithSync && + CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) { + if (CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) { ra->cfra = true; ra->rnti = rnti; - struct NR_CFRA *cfra = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra; + struct NR_CFRA *cfra = CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra; uint8_t num_preamble = cfra->resources.choice.ssb->ssb_ResourceList.list.count; ra->preambles.num_preambles = num_preamble; ra->preambles.preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t)); @@ -432,12 +459,19 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } } } + } else { + ra->cfra = false; + ra->rnti = 0; + ra->preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; + ra->preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t)); + for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) + ra->preambles.preamble_list[i] = i; } - LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti); - } else { // secondaryCellGroup has been updated + LOG_I(NR_MAC,"Added new RA process for UE RNTI %04x with initial CellGroup\n", rnti); + } else { // CellGroup has been updated const int UE_id = find_nr_UE_id(Mod_idP,rnti); - UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; - LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti); + UE_info->CellGroup[UE_id] = CellGroup; + LOG_I(NR_MAC,"Modified UE_id %d/%x with CellGroup\n",UE_id,rnti); } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 3c300c5f9dcb278b2383be5154bb837ba87c665a..658b526ceff2fd6cff21fff9d191f596837f0bd6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -53,6 +53,7 @@ #include "executables/softmodem-common.h" #include "nfapi/oai_integration/vendor_ext.h" +#include "executables/nr-softmodem.h" uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; @@ -66,11 +67,15 @@ void dump_mac_stats(gNB_MAC_INST *gNB) int num = 1; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { LOG_I(MAC, "UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs); - const NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; - LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d\n", + NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; + const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; + LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n", UE_id, stats->dlsch_rounds[0], stats->dlsch_rounds[1], - stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors); + stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors, + avg_rsrp, stats->num_rsrp_meas); + stats->num_rsrp_meas = 0; + stats->cumul_rsrp = 0 ; LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d\n", UE_id, @@ -87,6 +92,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB) LOG_I(MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); } } + print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); } void clear_nr_nfapi_information(gNB_MAC_INST * gNB, @@ -297,6 +303,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { + if (slot>64) return false; //quickfix for FR2 where there are more than 64 slots (bitmap to be removed) return (bitmap >> slot) & 0x01; } @@ -353,6 +360,12 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, AssertFatal(1==0,"Undefined tdd period %ld\n", scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); } + if (slot==0 && (*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]>=257)) { + // re-initialization of tdd_beam_association at beginning of frame (only for FR2) + for (int i=0; i<nb_periods_per_frame; i++) + gNB->tdd_beam_association[i] = -1; + } + int num_slots_per_tdd = (nr_slots_per_frame[*scc->ssbSubcarrierSpacing])/nb_periods_per_frame; const int nr_ulmix_slots = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0); @@ -381,7 +394,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, else ulsch_in_slot_bitmap = BIT( 8) | BIT(18); - memset(RC.nrmac[module_idP]->cce_list[bwp_id][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0 + memset(RC.nrmac[module_idP]->cce_list[0][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0 memset(RC.nrmac[module_idP]->cce_list[bwp_id][1],0,MAX_NUM_CCE*sizeof(int)); // coresetid 1 NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) @@ -406,7 +419,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // This schedules MIB - schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); + schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing],nb_periods_per_frame); // This schedules SIB1 if ( get_softmodem_params()->sa == 1 ) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 64867c5be5fb2bb4342b6dc3ab692849cd4937f7..1fec37edfe87ebbf3c07a934cef2de55d5efb983 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -65,7 +65,7 @@ int16_t ssb_index_from_prach(module_id_t module_idP, uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t fdm = cfg->prach_config.num_prach_fd_occasions.value; - uint8_t total_RApreambles = 64; + uint8_t total_RApreambles = MAX_NUM_NR_PRACH_PREAMBLES; if( scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) total_RApreambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; @@ -130,7 +130,7 @@ int16_t ssb_index_from_prach(module_id_t module_idP, } } - LOG_D(MAC, "Frame %d, Slot %d: Prach Occasion id = %d ssb per RO = %f number of active SSB %u index = %d fdm %u symbol index %u freq_index %u total_RApreambles %u\n", + LOG_D(NR_MAC, "Frame %d, Slot %d: Prach Occasion id = %d ssb per RO = %f number of active SSB %u index = %d fdm %u symbol index %u freq_index %u total_RApreambles %u\n", frameP, slotP, prach_occasion_id, num_ssb_per_RO, num_active_ssb, index, fdm, start_symbol_index, freq_index, total_RApreambles); return index; @@ -227,7 +227,7 @@ void find_SSB_and_RO_available(module_id_t module_idP) { cc->total_prach_occasions = total_RA_occasions - unused_RA_occasion; cc->num_active_ssb = num_active_ssb; - LOG_I(MAC, + LOG_I(NR_MAC, "Total available RO %d, num of active SSB %d: unused RO = %d association_period %u N_RA_sfn %u total_prach_occasions_per_config_period %u\n", cc->total_prach_occasions, cc->num_active_ssb, @@ -245,7 +245,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[0][slotP]; nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; - if (is_nr_UL_slot(scc, slotP, cc->frame_type)) { + if (is_nr_UL_slot(scc->tdd_UL_DL_ConfigurationCommon, slotP, cc->frame_type)) { uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot; @@ -313,7 +313,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP format0, scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig); - LOG_D(MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n", + LOG_D(NR_MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n", frameP, slotP, prach_occasion_id, prach_pdu->num_ra, prach_pdu->prach_start_symbol, @@ -385,7 +385,9 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint16_t *msg2_frame, uint16_t *msg2_slot, NR_ServingCellConfigCommon_t *scc, uint16_t monitoring_slot_period, - uint16_t monitoring_offset,uint8_t index,uint8_t num_active_ssb){ + uint16_t monitoring_offset,uint8_t beam_index, + uint8_t num_active_ssb, + int16_t *tdd_beam_association){ // preferentially we schedule the msg2 in the mixed slot or in the last dl slot // if they are allowed by search space configuration @@ -402,18 +404,6 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, if ((scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols > 0) || (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols > 0)) tdd_period_slot++; - // computing start of next period - uint8_t 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); - - // we can't schedule msg2 before sl_ahead since prach - int eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu]; - if ((eff_slot-rach_slot)<=sl_ahead) { - *msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu]; - *msg2_frame = (*msg2_slot>(rach_slot))? rach_frame : (rach_frame +1); - } - switch(response_window){ case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl1: slot_window = 1; @@ -448,6 +438,31 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame[mu]; uint8_t frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1); + // computing start of next period + + int FR = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] >= 257 ? nr_FR2 : nr_FR1; + + uint8_t 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))%1024; + + // we can't schedule msg2 before sl_ahead since prach + int eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu]; + if ((eff_slot-rach_slot)<=sl_ahead) { + *msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu]; + *msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024; + } + if (FR==nr_FR2) { + int num_tdd_period = *msg2_slot/tdd_period_slot; + while((tdd_beam_association[num_tdd_period]!=-1)&&(tdd_beam_association[num_tdd_period]!=beam_index)) { + *msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu]; + *msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024; + num_tdd_period = *msg2_slot/tdd_period_slot; + } + if(tdd_beam_association[num_tdd_period] == -1) + tdd_beam_association[num_tdd_period] = beam_index; + } + // 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>frame_limit)) || ((*msg2_frame*nr_slots_per_frame[mu]+*msg2_slot-monitoring_offset)%monitoring_slot_period !=0)) { @@ -476,18 +491,18 @@ void nr_initiate_ra_proc(module_id_t module_idP, NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - uint8_t total_RApreambles = 64; - uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; + uint8_t total_RApreambles = MAX_NUM_NR_PRACH_PREAMBLES; + uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; int pr_found; if( scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) - total_RApreambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; - + total_RApreambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; + if(num_ssb_per_RO > 3) { /*num of ssb per RO >= 1*/ num_ssb_per_RO -= 3; total_RApreambles = total_RApreambles/num_ssb_per_RO ; } - + for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &cc->ra[i]; pr_found = 0; @@ -499,13 +514,12 @@ void nr_initiate_ra_proc(module_id_t module_idP, break; } } - if (pr_found == 0) { - continue; + continue; } - + uint16_t ra_rnti; - + // ra_rnti from 5.1.3 in 38.321 // FK: in case of long PRACH the phone seems to expect the subframe number instead of the slot number here. if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present @@ -513,49 +527,54 @@ void nr_initiate_ra_proc(module_id_t module_idP, ra_rnti = 1 + symbol + (9 /*slotP*/ * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8); else ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8); - // This should be handled differently when we use the initialBWP for RA - ra->bwp_id = 1; - NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ->list.array[ra->bwp_id - 1]; - + ra->bwp_id = 0; + NR_BWP_Downlink_t *bwp=NULL; + if (ra->CellGroup && ra->CellGroup->spCellConfig && ra->CellGroup->spCellConfig->spCellConfigDedicated && + ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) { + bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; + ra->bwp_id = 1; + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1); - - LOG_I(MAC, - "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n", - module_idP, - CC_id, - frameP, - slotP, - preamble_index); - + + LOG_D(NR_MAC, + "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n", + module_idP, + CC_id, + frameP, + slotP, + preamble_index); + uint8_t beam_index = ssb_index_from_prach(module_idP, frameP, slotP, preamble_index, freq_index, symbol); - + // the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries if (ra->cfra) { // if the preamble received correspond to one of the listed if (!(preamble_index == ra->preambles.preamble_list[beam_index])) { LOG_E( - MAC, + NR_MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n", module_idP, preamble_index); continue; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc } } - int loop = 0; - LOG_D(MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP); + LOG_D(NR_MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP); ra->state = Msg2; ra->timing_offset = timing_offset; ra->preamble_slot = slotP; - struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = bwp ? + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList: + scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n"); + // 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) + if (ss->searchSpaceId == (bwp ? + *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace : + *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace)) ra->ra_ss = ss; } @@ -570,13 +589,17 @@ void nr_initiate_ra_proc(module_id_t module_idP, monitoring_slot_period, monitoring_offset, beam_index, - cc->num_active_ssb); + cc->num_active_ssb, + nr_mac->tdd_beam_association); ra->Msg2_frame = msg2_frame; ra->Msg2_slot = msg2_slot; - LOG_I(MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); - if (!ra->cfra) { + LOG_D(NR_MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); + + int loop = 0; + // This condition allows for the usage of a preconfigured rnti for the first UE + if (!ra->cfra || ra->rnti == 0) { do { ra->rnti = (taus() % 65518) + 1; loop++; @@ -584,15 +607,16 @@ void nr_initiate_ra_proc(module_id_t module_idP, && !((find_nr_UE_id(module_idP, ra->rnti) == -1) && (find_nr_RA_id(module_idP, CC_id, ra->rnti) == -1) && ra->rnti >= 1 && ra->rnti <= 65519)); if (loop == 100) { - LOG_E(MAC, "%s:%d:%s: [RAPROC] initialisation random access aborted\n", __FILE__, __LINE__, __FUNCTION__); + LOG_E(NR_MAC, "%s:%d:%s: [RAPROC] initialisation random access aborted\n", __FILE__, __LINE__, __FUNCTION__); abort(); } } + ra->RA_rnti = ra_rnti; ra->preamble_index = preamble_index; ra->beam_id = beam_index; - LOG_I(MAC, + LOG_D(NR_MAC, "[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB " "index %u\n", module_idP, @@ -606,38 +630,38 @@ void nr_initiate_ra_proc(module_id_t module_idP, return; } } - LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: CC_id %d Frame %d initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, preamble_index); + LOG_E(NR_MAC, "[gNB %d][RAPROC] FAILURE: CC_id %d Frame %d initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, preamble_index); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0); } void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) -{ - gNB_MAC_INST *mac = RC.nrmac[module_idP]; - - start_meas(&mac->schedule_ra); - for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; - for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { - NR_RA_t *ra = &cc->ra[i]; - LOG_D(MAC, "RA[state:%d]\n", ra->state); - switch (ra->state) { - case Msg2: - nr_generate_Msg2(module_idP, CC_id, frameP, slotP, ra); - break; - case Msg4: - // generate_Msg4(module_idP, CC_id, frameP, slotP); - break; - case WAIT_Msg4_ACK: - // check_Msg4_retransmission(module_idP, CC_id, frameP, slotP); - break; - default: - break; + { + gNB_MAC_INST *mac = RC.nrmac[module_idP]; + + start_meas(&mac->schedule_ra); + for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; + for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { + NR_RA_t *ra = &cc->ra[i]; + LOG_D(NR_MAC, "RA[state:%d]\n", ra->state); + switch (ra->state) { + case Msg2: + nr_generate_Msg2(module_idP, CC_id, frameP, slotP, ra); + break; + case Msg4: + nr_generate_Msg4(module_idP, CC_id, frameP, slotP, ra); + break; + case WAIT_Msg4_ACK: + nr_check_Msg4_Ack(module_idP, CC_id, frameP, slotP, ra); + break; + default: + break; + } } } + stop_meas(&mac->schedule_ra); } - stop_meas(&mac->schedule_ra); -} void nr_get_Msg3alloc(module_id_t module_id, int CC_id, @@ -645,42 +669,64 @@ void nr_get_Msg3alloc(module_id_t module_id, NR_BWP_Uplink_t *ubwp, sub_frame_t current_slot, frame_t current_frame, - NR_RA_t *ra) { + NR_RA_t *ra, + int16_t *tdd_beam_association) { - // msg3 is schedulend in mixed slot in the following TDD period + // msg3 is schedulend in mixed slot in the following TDD period - uint16_t msg3_nb_rb = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // sdu has 6 or 8 bytes + uint16_t msg3_nb_rb = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // sdu has 6 or 8 bytes - int mu = ubwp->bwp_Common->genericParameters.subcarrierSpacing; - int StartSymbolIndex, NrOfSymbols, startSymbolAndLength, temp_slot; - ra->Msg3_tda_id = 16; // initialization to a value above limit + int mu = ubwp ? + ubwp->bwp_Common->genericParameters.subcarrierSpacing : + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + int StartSymbolIndex, NrOfSymbols, startSymbolAndLength, temp_slot; + ra->Msg3_tda_id = 16; // initialization to a value above limit - for (int i=0; i<ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.count; i++) { - startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); - // we want to transmit in the uplink symbols of mixed slot - if (NrOfSymbols == scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols) { - ra->Msg3_tda_id = i; - break; + NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList= ubwp ? + ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: + scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + + for (int i=0; i<pusch_TimeDomainAllocationList->list.count; i++) { + startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); + // we want to transmit in the uplink symbols of mixed slot + if (NrOfSymbols == scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols) { + ra->Msg3_tda_id = i; + break; + } } - } - AssertFatal(ra->Msg3_tda_id<16,"Unable to find Msg3 time domain allocation in list\n"); + AssertFatal(ra->Msg3_tda_id<16,"Unable to find Msg3 time domain allocation in list\n"); - uint8_t k2 = *ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2; + uint8_t k2 = *pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2; - temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 - ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; - if (nr_slots_per_frame[mu]>temp_slot) - ra->Msg3_frame = current_frame; - else - ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame[mu]); + temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 + ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; + if (nr_slots_per_frame[mu]>temp_slot) + ra->Msg3_frame = current_frame; + else + ra->Msg3_frame = (current_frame + (temp_slot/nr_slots_per_frame[mu]))%1024; + + // beam association for FR2 + if (*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] >= 257) { + uint8_t tdd_period_slot = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + if ((scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols > 0) || (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols > 0)) + tdd_period_slot++; + int num_tdd_period = ra->Msg3_slot/tdd_period_slot; + if((tdd_beam_association[num_tdd_period]!=-1)&&(tdd_beam_association[num_tdd_period]!=ra->beam_id)) + AssertFatal(1==0,"Cannot schedule MSG3\n"); + else + tdd_beam_association[num_tdd_period] = ra->beam_id; + } - LOG_I(MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex); + LOG_D(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex); uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * MAX_BWP_SIZE]; - const uint16_t bwpSize = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const uint16_t bwpSize = NRRIV2BW(ubwp ? + ubwp->bwp_Common->genericParameters.locationAndBandwidth : + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, + MAX_BWP_SIZE); - /* search msg3_nb_rb free RBs */ + /* search msg3_nb_rb free RBs */ int rbSize = 0; int rbStart = 0; while (rbSize < msg3_nb_rb) { @@ -705,7 +751,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; if (ra->state == RA_IDLE) { - LOG_W(MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti); + LOG_W(NR_MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti); return; } @@ -720,7 +766,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t vrb_map_UL[i + ra->msg3_first_rb] = 1; } - LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); + LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[CC_id][ra->Msg3_slot]; AssertFatal(future_ul_tti_req->SFN == ra->Msg3_frame @@ -735,40 +781,51 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu; memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t)); future_ul_tti_req->n_pdus += 1; + int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + int abwp_size = ibwp_size; + int abwp_start = ibwp_start; + int scs = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + int fh = 0; + int startSymbolAndLength = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength; + + if (ra->CellGroup) { + AssertFatal(ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, + "downlinkBWP_ToAddModList has %d BWP!\n", ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); + NR_BWP_Uplink_t *ubwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; + + + startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength; + abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + scs = ubwp->bwp_Common->genericParameters.subcarrierSpacing; + fh = ubwp->bwp_Dedicated->pusch_Config->choice.setup->frequencyHopping ? 1 : 0; - AssertFatal(ra->secondaryCellGroup, - "no secondaryCellGroup for RNTI %04x\n", - ra->crnti); - AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, - "downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); - NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - LOG_D(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", - frameP, - slotP, - ra->Msg3_frame, - ra->Msg3_slot, - ra->msg3_nb_rb, - ra->msg3_first_rb, - ra->msg3_round, - ra->rnti); - - int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength; + } + + LOG_D(NR_MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", + frameP, + slotP, + ra->Msg3_frame, + ra->Msg3_slot, + ra->msg3_nb_rb, + ra->msg3_first_rb, + ra->msg3_round, + ra->rnti); + int start_symbol_index,nr_of_symbols; SLIV2SL(startSymbolAndLength, &start_symbol_index, &nr_of_symbols); pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; pusch_pdu->rnti = ra->rnti; pusch_pdu->handle = 0; - int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size)) pusch_pdu->bwp_start = abwp_start; else pusch_pdu->bwp_start = ibwp_start; pusch_pdu->bwp_size = ibwp_size; - pusch_pdu->subcarrier_spacing = ubwp->bwp_Common->genericParameters.subcarrierSpacing; + pusch_pdu->subcarrier_spacing = scs; pusch_pdu->cyclic_prefix = 0; pusch_pdu->mcs_index = 0; pusch_pdu->mcs_table = 0; @@ -787,16 +844,15 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t pusch_pdu->dmrs_ports = 1; // 6.2.2 in 38.214 only port 0 to be used pusch_pdu->num_dmrs_cdm_grps_no_data = 2; // no data in dmrs symbols as in 6.2.2 in 38.214 pusch_pdu->resource_alloc = 1; //type 1 - pusch_pdu->rb_start = ra->msg3_first_rb + ibwp_start - abwp_start; // as for 6.3.1.7 in 38.211 + //pusch_pdu->rb_start = ra->msg3_first_rb + ibwp_start - abwp_start; // as for 6.3.1.7 in 38.211 + pusch_pdu->rb_start = ra->msg3_first_rb; if (ra->msg3_nb_rb > pusch_pdu->bwp_size) AssertFatal(1==0,"MSG3 allocated number of RBs exceed the BWP size\n"); else pusch_pdu->rb_size = ra->msg3_nb_rb; pusch_pdu->vrb_to_prb_mapping = 0; - if (ubwp->bwp_Dedicated->pusch_Config->choice.setup->frequencyHopping == NULL) - pusch_pdu->frequency_hopping = 0; - else - pusch_pdu->frequency_hopping = 1; + + pusch_pdu->frequency_hopping = fh; //pusch_pdu->tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE] pusch_pdu->uplink_frequency_shift_7p5khz = 0; //Resource Allocation in time domain @@ -822,85 +878,89 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra) { - int mcsIndex; - int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment = 0; - gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; - NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; - NR_SearchSpace_t *ss = ra->ra_ss; - // This code from this point on will not work on initialBWP or CORESET0 - AssertFatal(ra->bwp_id > 0, "cannot work on initialBWP for now\n"); + gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; + NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; - AssertFatal(ra->secondaryCellGroup, "no secondaryCellGroup for RNTI %04x\n", ra->crnti); - AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, - "downlinkBWP_ToAddModList has %d BWP!\n", - ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); + if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) { - uint16_t RA_rnti = ra->RA_rnti; - long locationAndBandwidth; + uint8_t time_domain_assignment = 3; + uint8_t mcsIndex = 0; + int rbStart = 0; + int rbSize = 8; - // check if UE is doing RA on CORESET0 , InitialBWP or configured BWP from SCD - // get the BW of the PDCCH for PDCCH size and RAR PDSCH size - NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - int dci10_bw = 0; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_SearchSpace_t *ss = ra->ra_ss; - if (ra->coreset0_configured == 1) { - AssertFatal(1==0,"This is a standalone condition\n"); - } - else { // on configured BWP or initial LDBWP, bandwidth parameters in DCI correspond size of initialBWP - locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; - dci10_bw = NRRIV2BW(locationAndBandwidth, MAX_BWP_SIZE); - } + long BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) { + NR_BWP_Downlink_t *bwp = NULL; + NR_ControlResourceSet_t *coreset = NULL; + NR_BWP_t *genericParameters = NULL; + NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList=NULL; + long BWPStart = 0; + + if (ra->CellGroup && + ra->CellGroup->spCellConfig && + ra->CellGroup->spCellConfig->spCellConfigDedicated && + ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList && + ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]) { + bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + genericParameters = &bwp->bwp_Common->genericParameters; + pdsch_TimeDomainAllocationList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } + else { + genericParameters= &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + pdsch_TimeDomainAllocationList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } + BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + ss = ra->ra_ss; + coreset = get_coreset(scc,bwp, ss, NR_SearchSpace__searchSpaceType_PR_common); + if (coreset == NULL) coreset = nr_mac->sched_ctrlCommon->coreset; uint16_t *vrb_map = cc[CC_id].vrb_map; - int rbStart = 0, rbSize = 6; - for (int i = 0; (i < rbSize) && (rbStart <= (dci10_bw - rbSize)); i++) { + for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) { if (vrb_map[rbStart + i]) { rbStart += i; i = 0; } } - if (rbStart > (dci10_bw - rbSize)) { - LOG_E(MAC, "%s(): cannot find free vrb_map for RA RNTI %04x!\n", __func__, ra->RA_rnti); + + if (rbStart > (BWPSize - rbSize)) { + LOG_E(NR_MAC, "%s(): cannot find free vrb_map for RA RNTI %04x!\n", __func__, ra->RA_rnti); return; } + // Checking if the DCI allocation is feasible in current subframe nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body; - // Checking if the DCI allocation is feasible in current subframe: we might - // need to need up to two (PDCCH + PDSCH) messages, so check that we can - // always allocate both (this might be an overestimation, since the PDCCH - // message might already exist) if (dl_req->nPDUs > NFAPI_NR_MAX_DL_TTI_PDUS - 2) { - LOG_I(MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, RA_rnti); + LOG_I(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->RA_rnti); return; } - uint8_t nr_of_candidates, aggregation_level; + uint8_t aggregation_level; + uint8_t nr_of_candidates; find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss); - NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0 /* common */); - int CCEIndex = allocate_nr_CCEs(nr_mac, - bwp, - coreset, - aggregation_level, - 0, // Y - 0, // m - nr_of_candidates); - + int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates); if (CCEIndex < 0) { - LOG_E(MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti); + LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti); return; } - /* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not - * exist, create it. This is especially important if we have multiple RAs, - * and the DLSCH has to reuse them, so we need to mark them */ - const int bwpid = bwp->bwp_Id; + // Calculate number of symbols + int startSymbolIndex, nrOfSymbols; + const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); + + LOG_D(MAC,"Msg2 startSymbolIndex.nrOfSymbols %d.%d\n",startSymbolIndex,nrOfSymbols); + + // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially + // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them + const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; if (!pdcch_pdu_rel15) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -909,7 +969,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); - nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; + nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; } nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -919,81 +979,411 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs+=1; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); - - NR_BWP_Uplink_t *ubwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + LOG_I(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d\n", + module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state); - LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d\n", dci10_bw); + // SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control + // information to data and is reset every slot. + const int pduindex = nr_mac->pdu_index[CC_id]++; - // Qm>2 not allowed for RAR - if (get_softmodem_params()->do_ra) - mcsIndex = 9; - else - mcsIndex = 0; + uint8_t mcsTableIdx = 0; + if (bwp && + bwp->bwp_Dedicated && + bwp->bwp_Dedicated->pdsch_Config && + bwp->bwp_Dedicated->pdsch_Config->choice.setup && + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table) { + if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) + mcsTableIdx = 1; + else + mcsTableIdx = 2; + } + else mcsTableIdx = 0; + + int dmrsConfigType=0; + if (bwp && + bwp->bwp_Dedicated && + bwp->bwp_Dedicated->pdsch_Config && + bwp->bwp_Dedicated->pdsch_Config->choice.setup && + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA && + 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) + dmrsConfigType = 1; pdsch_pdu_rel15->pduBitmap = 0; - pdsch_pdu_rel15->rnti = RA_rnti; - /* SCF222: PDU index incremented for each PDSCH PDU sent in TX control - * message. This is used to associate control information to data and is - * reset every slot. */ - const int pduindex = nr_mac->pdu_index[CC_id]++; + pdsch_pdu_rel15->rnti = ra->RA_rnti; pdsch_pdu_rel15->pduIndex = pduindex; - - - pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + pdsch_pdu_rel15->BWPSize = BWPSize; + pdsch_pdu_rel15->BWPStart = BWPStart; + pdsch_pdu_rel15->SubcarrierSpacing = genericParameters->subcarrierSpacing; pdsch_pdu_rel15->CyclicPrefix = 0; pdsch_pdu_rel15->NrOfCodewords = 1; - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,0); + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx); pdsch_pdu_rel15->qamModOrder[0] = 2; pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; - if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) - pdsch_pdu_rel15->mcsTable[0] = 0; - else{ - if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) - pdsch_pdu_rel15->mcsTable[0] = 1; - else - pdsch_pdu_rel15->mcsTable[0] = 2; - } + pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; pdsch_pdu_rel15->rvIndex[0] = 0; pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; pdsch_pdu_rel15->refPoint = 0; - pdsch_pdu_rel15->dmrsConfigType = 0; + pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; - pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = nrOfSymbols <=2 ? 1 : 2; pdsch_pdu_rel15->dmrsPorts = 1; pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->rbStart = rbStart; pdsch_pdu_rel15->rbSize = rbSize; - pdsch_pdu_rel15->VRBtoPRBMapping = 0; // non interleaved - - for (int i=0; i<bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) { - startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &StartSymbolIndex_tmp, &NrOfSymbols_tmp); - if (NrOfSymbols_tmp < NrOfSymbols) { - NrOfSymbols = NrOfSymbols_tmp; - StartSymbolIndex = StartSymbolIndex_tmp; - time_domain_assignment = i; // this is short PDSCH added to the config to fit mixed slot + pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols; + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, + nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, + nrOfSymbols, + startSymbolIndex); + + int x_Overhead = 0; + uint8_t tb_scaling = 0; + nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling); + + // Fill PDCCH DL DCI PDU + nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; + pdcch_pdu_rel15->numDlDci++; + dci_pdu->RNTI = ra->RA_rnti; + dci_pdu->ScramblingId = *scc->physCellId; + dci_pdu->ScramblingRNTI = 0; + dci_pdu->AggregationLevel = aggregation_level; + dci_pdu->CceIndex = CCEIndex; + dci_pdu->beta_PDCCH_1_0 = 0; + dci_pdu->powerControlOffsetSS = 1; + + dci_pdu_rel15_t dci_payload; + dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->BWPSize); + LOG_D(MAC,"Msg2 rbSize.rbStart.BWPsize %d.%d.%d\n",pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->BWPSize); + + dci_payload.time_domain_assignment.val = time_domain_assignment; + dci_payload.vrb_to_prb_mapping.val = 0; + dci_payload.mcs = pdsch_pdu_rel15->mcsIndex[0]; + dci_payload.tb_scaling = tb_scaling; + + LOG_D(NR_MAC, + "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n", + dci_payload.frequency_domain_assignment.val, + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->BWPSize, + dci_payload.time_domain_assignment.val, + dci_payload.vrb_to_prb_mapping.val, + dci_payload.mcs, + dci_payload.tb_scaling); + + LOG_D(NR_MAC, + "[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", + pdcch_pdu_rel15->dci_pdu[0].RNTI, + NR_RNTI_RA, + NR_DL_DCI_FORMAT_1_0, + (unsigned long long)pdcch_pdu_rel15->FreqDomainResource, + pdcch_pdu_rel15->StartSymbolIndex, + pdcch_pdu_rel15->DurationSymbols); + + fill_dci_pdu_rel15(scc, + ra->CellGroup, + &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], + &dci_payload, + NR_DL_DCI_FORMAT_1_0, + NR_RNTI_RA, + pdsch_pdu_rel15->BWPSize, + bwpid); + + // DL TX request + nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; + + // Program UL processing for Msg3 + NR_BWP_Uplink_t *ubwp = ra->CellGroup ? + ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1] : + NULL; + nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra, nr_mac->tdd_beam_association); + nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); + + if(ra->cfra) { + LOG_I(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); + } + + T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->RA_rnti), T_INT(frameP), + T_INT(slotP), T_INT(0), T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length)); + + tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0]; + tx_req->PDU_index = pduindex; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = tx_req->PDU_length + 2; + nr_mac->TX_req[CC_id].SFN = frameP; + nr_mac->TX_req[CC_id].Number_of_PDUs++; + nr_mac->TX_req[CC_id].Slot = slotP; + + // Mark the corresponding RBs as used + for (int rb = 0; rb < rbSize; rb++) { + vrb_map[rb + rbStart] = 1; + } + + ra->state = WAIT_Msg3; + LOG_I(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); + } +} + +void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra) { + + gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; + NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + + if (ra->Msg4_frame == frameP && ra->Msg4_slot == slotP ) { + + uint8_t time_domain_assignment = 0; + uint8_t mcsIndex = 0; + + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_SearchSpace_t *ss = ra->ra_ss; + + NR_BWP_Downlink_t *bwp = ra->CellGroup ? ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1] : NULL; + NR_ControlResourceSet_t *coreset = get_coreset(scc,ra->CellGroup ? ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1] : NULL, ss, NR_SearchSpace__searchSpaceType_PR_common); + + if (coreset == NULL) coreset = nr_mac->sched_ctrlCommon->coreset; + + int UE_id = find_nr_UE_id(module_idP, ra->rnti); + NR_UE_info_t *UE_info = &nr_mac->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + NR_BWP_t *genericParameters = bwp ? & bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + long BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + long BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + + // HARQ management + int8_t current_harq_pid = sched_ctrl->dl_harq_pid; + if (current_harq_pid < 0) { + current_harq_pid = sched_ctrl->available_dl_harq.head; + remove_front_nr_list(&sched_ctrl->available_dl_harq); + sched_ctrl->dl_harq_pid = current_harq_pid; + } else { + if (sched_ctrl->harq_processes[current_harq_pid].round == 0) + remove_nr_list(&sched_ctrl->available_dl_harq, current_harq_pid); + else + remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid); + } + NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid]; + DevAssert(!harq->is_waiting); + add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid); + harq->is_waiting = true; + ra->harq_pid = current_harq_pid; + + // get CCEindex, needed also for PUCCH and then later for PDCCH + uint8_t aggregation_level; + uint8_t nr_of_candidates; + find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss); + int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates); + if (CCEIndex < 0) { + LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti); + return; + } + + int n_rb=0; + for (int i=0;i<6;i++) + for (int j=0;j<8;j++) { + n_rb+=((coreset->frequencyDomainResources.buf[i]>>j)&1); } + n_rb*=6; + const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE; + const int delta_PRI=0; + int r_pucch = ((CCEIndex<<1)/N_cce)+(delta_PRI<<1); + + nr_acknack_scheduling(module_idP, UE_id, frameP, slotP,r_pucch); + harq->feedback_slot = sched_ctrl->sched_pucch->ul_slot; + + // Bytes to be transmitted + uint8_t *buf = (uint8_t *) harq->tb; + uint16_t mac_pdu_length = nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id); + LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length); + uint16_t mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, &buf[mac_pdu_length+2]); + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0; + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->F = 0; + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->LCID = DL_SCH_LCID_CCCH; + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length; + mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT); + + LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n", + mac_sdu_length, + (int)sizeof(NR_MAC_SUBHEADER_SHORT), + mac_pdu_length); + // Calculate number of symbols + int startSymbolIndex, nrOfSymbols; + + NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList; + if (bwp && + bwp->bwp_Common && + bwp->bwp_Common->pdsch_ConfigCommon && + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup && + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + else + pdsch_TimeDomainAllocationList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + + const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); + + uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, + scc->dmrs_TypeA_Position, + nrOfSymbols, + startSymbolIndex); + + uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos); + + long dmrsConfigType = bwp ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1):0; + uint8_t N_PRB_DMRS = 0; + AssertFatal(nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 1 || + nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 2, + "nr_mac->schedCtrlCommon->numDmrsCdmGrpsNoData %d is not possible", + nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData); + if (dmrsConfigType==NFAPI_NR_DMRS_TYPE1) { + N_PRB_DMRS = nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + } + else { + N_PRB_DMRS = nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; } - AssertFatal(StartSymbolIndex >= 0, "StartSymbolIndex is negative\n"); + uint8_t mcsTableIdx = 0; + if (bwp && + bwp->bwp_Dedicated && + bwp->bwp_Dedicated->pdsch_Config && + bwp->bwp_Dedicated->pdsch_Config->choice.setup && + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table) { + if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) + mcsTableIdx = 1; + else + mcsTableIdx = 2; + } + else mcsTableIdx = 0; - pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; - pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; - pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, NrOfSymbols); + int rbStart = 0; + int rbSize = 0; + uint8_t tb_scaling = 0; + uint16_t *vrb_map = cc[CC_id].vrb_map; + do { + rbSize++; + LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT); + harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx), + nr_get_code_rate_dl(mcsIndex, mcsTableIdx), + rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3; + } while (rbStart + rbSize < BWPSize && !vrb_map[rbStart + rbSize] && harq->tb_size < mac_pdu_length); + + for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) { + if (vrb_map[rbStart + i]) { + rbStart += i; + i = 0; + } + } + + if (rbStart > (BWPSize - rbSize)) { + LOG_E(NR_MAC, "%s(): cannot find free vrb_map for RNTI %04x!\n", __func__, ra->rnti); + return; + } + + // Checking if the DCI allocation is feasible in current subframe + nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body; + if (dl_req->nPDUs > NFAPI_NR_MAX_DL_TTI_PDUS - 2) { + LOG_I(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->rnti); + return; + } + + + // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially + // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them + const int bwpid = bwp ? bwp->bwp_Id : 0; + const int coresetid = coreset->controlResourceSetId; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; + if (!pdcch_pdu_rel15) { + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; + dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); + dl_req->nPDUs += 1; + pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; + nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); + nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; + } + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + dl_req->nPDUs+=1; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + LOG_I(NR_MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg4 DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); + + int bwp_Id=0; + if (ra->CellGroup && + ra->CellGroup->spCellConfig && + ra->CellGroup->spCellConfig->spCellConfigDedicated && + ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList){ + bwp_Id = *ra->CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id; + AssertFatal(ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count <= 1, + "downlinkBWP_ToAddModList has %d BWP!\n", + ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); + } + LOG_I(NR_MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg4 DCI for BWP %d, state %d\n", module_idP, CC_id, frameP, slotP, bwp_Id,ra->state); + + // SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control + // information to data and is reset every slot. + const int pduindex = nr_mac->pdu_index[CC_id]++; + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = ra->rnti; + pdsch_pdu_rel15->pduIndex = pduindex; + pdsch_pdu_rel15->BWPSize = BWPSize; + pdsch_pdu_rel15->BWPStart = BWPStart; + pdsch_pdu_rel15->SubcarrierSpacing = genericParameters->subcarrierSpacing; + pdsch_pdu_rel15->CyclicPrefix = 0; + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx); + pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; + pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; + pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[harq->round]; + pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 0; + pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType; + pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = nrOfSymbols <=2 ? 1 : 2; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = rbStart; + pdsch_pdu_rel15->rbSize = rbSize; + pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols; + pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos; + + + int x_Overhead = 0; + nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling); + + pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=1; + pdsch_pdu_rel15->precodingAndBeamforming.prg_size=275; + pdsch_pdu_rel15->precodingAndBeamforming.dig_bf_interfaces=1; + pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].pm_idx = 0; + pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = ra->beam_id; /* Fill PDCCH DL DCI PDU */ nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; pdcch_pdu_rel15->numDlDci++; - dci_pdu->RNTI = RA_rnti; - /* TODO: remove next line */ - AssertFatal(ss->searchSpaceType->present != NR_SearchSpace__searchSpaceType_PR_ue_Specific, - "shouldn't the RA SS be common?\n"); + dci_pdu->RNTI = ra->rnti; dci_pdu->ScramblingId = *scc->physCellId; dci_pdu->ScramblingRNTI = 0; dci_pdu->AggregationLevel = aggregation_level; @@ -1003,81 +1393,129 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dci_pdu_rel15_t dci_payload; dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, - pdsch_pdu_rel15->rbStart,dci10_bw); + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->BWPSize); + + dci_payload.format_indicator = 1; dci_payload.time_domain_assignment.val = time_domain_assignment; dci_payload.vrb_to_prb_mapping.val = 0; dci_payload.mcs = pdsch_pdu_rel15->mcsIndex[0]; - dci_payload.tb_scaling = 0; - - LOG_I(MAC, - "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n", + dci_payload.tb_scaling = tb_scaling; + dci_payload.rv = pdsch_pdu_rel15->rvIndex[0]; + dci_payload.harq_pid = current_harq_pid; + dci_payload.ndi = harq->ndi; + dci_payload.dai[0].val = (sched_ctrl->sched_pucch->dai_c-1)&3; + dci_payload.tpc = sched_ctrl->tpc1; // TPC for PUCCH: table 7.2.1-1 in 38.213 + dci_payload.pucch_resource_indicator = delta_PRI; // This is delta_PRI from 9.2.1 in 38.213 + dci_payload.pdsch_to_harq_feedback_timing_indicator.val = sched_ctrl->sched_pucch->timing_indicator; + + LOG_D(NR_MAC, + "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d pucchres %d harqtiming %d\n", dci_payload.frequency_domain_assignment.val, pdsch_pdu_rel15->rbStart, pdsch_pdu_rel15->rbSize, - dci10_bw, + pdsch_pdu_rel15->BWPSize, dci_payload.time_domain_assignment.val, dci_payload.vrb_to_prb_mapping.val, dci_payload.mcs, - dci_payload.tb_scaling); - - LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RA_RNTI %x\n", frameP, slotP, RA_rnti); + dci_payload.tb_scaling, + dci_payload.pucch_resource_indicator, + dci_payload.pdsch_to_harq_feedback_timing_indicator.val); - const int dci_format = NR_DL_DCI_FORMAT_1_0; - const int rnti_type = NR_RNTI_RA; - - LOG_I(MAC, - "[RAPROC] DCI params: rnti %d, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", + LOG_D(NR_MAC, + "[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", pdcch_pdu_rel15->dci_pdu[0].RNTI, - rnti_type, - dci_format, + NR_RNTI_TC, + NR_DL_DCI_FORMAT_1_0, (unsigned long long)pdcch_pdu_rel15->FreqDomainResource, pdcch_pdu_rel15->StartSymbolIndex, pdcch_pdu_rel15->DurationSymbols); fill_dci_pdu_rel15(scc, - ra->secondaryCellGroup, - dci_pdu, + ra->CellGroup, + &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], &dci_payload, - dci_format, - rnti_type, - dci10_bw, - ra->bwp_id); + NR_DL_DCI_FORMAT_1_0, + NR_RNTI_TC, + pdsch_pdu_rel15->BWPSize, + bwp_Id); + + // Add padding header and zero rest out if there is space left + if (mac_pdu_length < harq->tb_size) { + NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) &buf[mac_pdu_length]; + padding->R = 0; + padding->LCID = DL_SCH_LCID_PADDING; + for(int k = mac_pdu_length+1; k<harq->tb_size; k++) { + buf[k] = 0; + } + } // DL TX request nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; - tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0]; + memcpy(tx_req->TLVs[0].value.direct, harq->tb, sizeof(uint8_t) * harq->tb_size); + tx_req->PDU_length = harq->tb_size; tx_req->PDU_index = pduindex; tx_req->num_TLV = 1; - tx_req->TLVs[0].length = 8; + tx_req->TLVs[0].length = harq->tb_size + 2; nr_mac->TX_req[CC_id].SFN = frameP; nr_mac->TX_req[CC_id].Number_of_PDUs++; nr_mac->TX_req[CC_id].Slot = slotP; - // Program UL processing for Msg3 - nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra); - LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); - nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); - ra->state = WAIT_Msg3; - LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); + // Mark the corresponding RBs as used + for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++) { + vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1; + } + + LOG_D(NR_MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); + LOG_D(NR_MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); + LOG_D(NR_MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); + LOG_D(NR_MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); + LOG_D(NR_MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); + LOG_D(NR_MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); + for(int n=0;n<6;n++) LOG_D(NR_MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + LOG_D(NR_MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); + LOG_D(NR_MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); + LOG_D(NR_MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); + LOG_D(NR_MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); + LOG_D(NR_MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); + LOG_D(NR_MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); + LOG_D(NR_MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); + + ra->state = WAIT_Msg4_ACK; + LOG_I(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); + } +} - x_Overhead = 0; - nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_payload.tb_scaling); +void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t slot, NR_RA_t *ra) { - T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), - T_INT(RA_rnti), T_INT(frameP), T_INT(slotP), T_INT(0) /* harq pid, meaningful? */, - T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length)); + int UE_id = find_nr_UE_id(module_id, ra->rnti); + const int current_harq_pid = ra->harq_pid; - /* mark the corresponding RBs as used */ - for (int rb = 0; rb < rbSize; rb++) - vrb_map[rb + rbStart] = 1; + NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid]; + + LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid); + + if (harq->is_waiting == 0) + { + if (harq->round == 0) + { + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); + nr_clear_ra_proc(module_id, CC_id, frame, ra); + UE_info->active[UE_id] = true; + UE_info->Msg4_ACKed[UE_id] = true; + } + else + { + ra->state = Msg4; + } } + } -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){ - - NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[0]; - LOG_D(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti); - ra->state = IDLE; +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra){ + LOG_D(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti); + ra->state = RA_IDLE; ra->timing_offset = 0; ra->RRC_timer = 20; ra->rnti = 0; @@ -1120,9 +1558,10 @@ void nr_fill_rar(uint8_t Mod_idP, uint8_t * dlsch_buffer, nfapi_nr_pusch_pdu_t *pusch_pdu){ - LOG_I(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset); - NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; - NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); + LOG_I(NR_MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset); + NR_RA_HEADER_BI *rarbi = (NR_RA_HEADER_BI *) dlsch_buffer; + NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) (dlsch_buffer + 1); + NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 2); unsigned char csi_req = 0, tpc_command; //uint8_t N_UL_Hop; uint8_t valid_bits; @@ -1131,6 +1570,16 @@ void nr_fill_rar(uint8_t Mod_idP, tpc_command = 3; // this is 0 dB + /// E/T/R/R/BI subheader /// + // E = 1, MAC PDU includes another MAC sub-PDU (RAPID) + // T = 0, Back-off indicator subheader + // R = 2, Reserved + // BI = 0, 5ms + rarbi->E = 1; + rarbi->T = 0; + rarbi->R = 0; + rarbi->BI = 0; + /// E/T/RAPID subheader /// // E = 0, one only RAR, first and last // T = 1, RAPID @@ -1177,4 +1626,50 @@ void nr_fill_rar(uint8_t Mod_idP, rar->UL_GRANT_3 = (uint8_t) (ul_grant >> 8) & 0xff; rar->UL_GRANT_4 = (uint8_t) ul_grant & 0xff; +#ifdef DEBUG_RAR + //LOG_I(NR_MAC, "rarbi->E = 0x%x\n", rarbi->E); + //LOG_I(NR_MAC, "rarbi->T = 0x%x\n", rarbi->T); + //LOG_I(NR_MAC, "rarbi->R = 0x%x\n", rarbi->R); + //LOG_I(NR_MAC, "rarbi->BI = 0x%x\n", rarbi->BI); + + LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E); + LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T); + LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID); + + LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R); + LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1); + + LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2); + LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1); + + LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2); + LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3); + LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4); + + LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1); + LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2); +#endif + + int mcs = (unsigned char) (rar->UL_GRANT_4 >> 4); + // time alloc + int Msg3_t_alloc = (unsigned char) (rar->UL_GRANT_3 & 0x07); + // frequency alloc + int Msg3_f_alloc = (uint16_t) ((rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12)); + // frequency hopping + int freq_hopping = (unsigned char) (rar->UL_GRANT_1 >> 2); + // TA command + int ta_command = rar->TA2 + (rar->TA1 << 5); + // TC-RNTI + int t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8); + + LOG_I(NR_MAC, "In %s: Transmitted RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n", + __FUNCTION__, + Msg3_t_alloc, + Msg3_f_alloc, + ta_command, + mcs, + freq_hopping, + tpc_command, + csi_req, + t_crnti); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 3f69cfbe7431b082bb3bcd2658ab753582d02509..a132fef0b0961146ae785a4f50dab161713c2913 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -53,26 +53,12 @@ #include "executables/softmodem-common.h" extern RAN_CONTEXT_t RC; -extern uint8_t SSB_Table[38]; -void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, uint8_t slots_per_frame){ - gNB_MAC_INST *gNB = RC.nrmac[module_idP]; - NR_COMMON_channels_t *cc; - - nfapi_nr_dl_tti_request_t *dl_tti_request; - nfapi_nr_dl_tti_request_body_t *dl_req; - nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu; +uint16_t get_ssboffset_pointa(NR_ServingCellConfigCommon_t *scc,const long band) { - int mib_sdu_length; - int CC_id; - - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - cc = &gNB->common_channels[CC_id]; - const long band = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - const uint32_t ssb_offset0 = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - int ratio; - switch (*cc->ServingCellConfigCommon->ssbSubcarrierSpacing) { + int ratio; + switch (*scc->ssbSubcarrierSpacing) { case NR_SubcarrierSpacing_kHz15: AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n", @@ -105,116 +91,199 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, break; default: AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n", - *cc->ServingCellConfigCommon->ssbSubcarrierSpacing); - } + *scc->ssbSubcarrierSpacing); + } + + const uint32_t ssb_offset0 = *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + + return (ssb_offset0/(ratio*12) - 10); // absoluteFrequencySSB is the center of SSB + +} - // scheduling MIB every 8 frames, PHY repeats it in between + +void schedule_ssb(frame_t frame, sub_frame_t slot, + NR_ServingCellConfigCommon_t *scc, + nfapi_nr_dl_tti_request_body_t *dl_req, + int i_ssb, uint8_t scoffset, uint16_t offset_pointa, uint32_t payload) { + + uint8_t beam_index = 0; + nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_config_pdu->PDUType = NFAPI_NR_DL_TTI_SSB_PDU_TYPE; + dl_config_pdu->PDUSize =2 + sizeof(nfapi_nr_dl_tti_ssb_pdu_rel15_t); + + AssertFatal(scc->physCellId!=NULL,"ServingCellConfigCommon->physCellId is null\n"); + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *scc->physCellId; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.BetaPss = 0; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i_ssb; + AssertFatal(scc->downlinkConfigCommon!=NULL,"scc->downlinkConfigCommonL is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count==1,"Frequency Band list does not have 1 element (%d)\n", + scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count); + AssertFatal(scc->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n"); + + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = scoffset; //kSSB + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = offset_pointa; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = payload; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.num_prgs=1; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prg_size=275; //1 PRG of max size for analogue beamforming + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.dig_bf_interfaces=1; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prgs_list[0].pm_idx = 0; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = beam_index; + dl_req->nPDUs++; + + LOG_D(MAC,"Scheduling ssb %d at frame %d and slot %d\n",i_ssb,frame,slot); + +} + +void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, uint8_t slots_per_frame, int nb_periods_per_frame){ + + gNB_MAC_INST *gNB = RC.nrmac[module_idP]; + NR_COMMON_channels_t *cc; + nfapi_nr_dl_tti_request_t *dl_tti_request; + nfapi_nr_dl_tti_request_body_t *dl_req; + NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib; + uint8_t num_tdd_period,num_ssb; + int mib_sdu_length; + int CC_id; + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + cc = &gNB->common_channels[CC_id]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + dl_tti_request = &gNB->DL_req[CC_id]; + dl_req = &dl_tti_request->dl_tti_request_body; + + // get MIB every 8 frames if((slotP == 0) && (frameP & 7) == 0) { - dl_tti_request = &gNB->DL_req[CC_id]; - dl_req = &dl_tti_request->dl_tti_request_body; - - mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]); - - LOG_D(MAC, "Frame %d, slot %d: BCH PDU length %d\n", frameP, slotP, mib_sdu_length); - - if (mib_sdu_length > 0) { - LOG_D(MAC, - "Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n", - frameP, - slotP, - dl_req->nPDUs, - mib_sdu_length); - - if ((frameP & 1023) < 80){ - LOG_D(MAC, - "[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n", - module_idP, - frameP, - CC_id, - mib_sdu_length); - } - - dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); - dl_config_pdu->PDUType = NFAPI_NR_DL_TTI_SSB_PDU_TYPE; - dl_config_pdu->PDUSize =2 + sizeof(nfapi_nr_dl_tti_ssb_pdu_rel15_t); - - AssertFatal(cc->ServingCellConfigCommon->physCellId!=NULL,"cc->ServingCellConfigCommon->physCellId is null\n"); - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *cc->ServingCellConfigCommon->physCellId; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.BetaPss = 0; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0; - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon!=NULL,"scc->downlinkConfigCommonL is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count==1,"Frequency Band list does not have 1 element (%d)\n",cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count); - AssertFatal(cc->ServingCellConfigCommon->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n"); - - const nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value; //kSSB - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12) - 10; // absoluteFrequencySSB is the center of SSB - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1); - dl_req->nPDUs++; - } - // Get type0_PDCCH_CSS_config parameters - NR_DL_FRAME_PARMS *frame_parms = &RC.gNB[module_idP]->frame_parms; - NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib; - uint8_t gNB_xtra_byte = 0; - for (int i = 0; i < 8; i++) { - gNB_xtra_byte |= ((RC.gNB[module_idP]->pbch.pbch_a >> (31 - i)) & 1) << (7 - i); - } - get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, - frame_parms->ssb_index, frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB); + mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 0, 1, &cc->MIB_pdu.payload[0]); + LOG_D(MAC, + "[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n", + module_idP, + frameP, + CC_id, + mib_sdu_length); } - // checking if there is any SSB in slot - const int abs_slot = (slots_per_frame * frameP) + slotP; - const int slot_per_period = (slots_per_frame>>1)<<(*cc->ServingCellConfigCommon->ssb_periodicityServingCell); - int eff_120_slot; - const BIT_STRING_t *shortBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.shortBitmap; - const BIT_STRING_t *mediumBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap; - const BIT_STRING_t *longBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.longBitmap; - uint8_t buf = 0; - switch (cc->ServingCellConfigCommon->ssb_PositionsInBurst->present) { - case 1: - // presence of ssbs possible in the first 2 slots of ssb period - if ((abs_slot % slot_per_period) < 2 && - (((shortBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0) - fill_ssb_vrb_map(cc, (ssb_offset0 / (ratio * 12) - 10), CC_id); - break; - case 2: - // presence of ssbs possible in the first 4 slots of ssb period - if ((abs_slot % slot_per_period) < 4 && - (((mediumBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0) - fill_ssb_vrb_map(cc, (ssb_offset0 / (ratio * 12) - 10), CC_id); - break; - case 3: - AssertFatal(*cc->ServingCellConfigCommon->ssbSubcarrierSpacing == - NR_SubcarrierSpacing_kHz120, - "240kHZ subcarrier spacing currently not supported for SSBs\n"); - if ((abs_slot % slot_per_period) < 8) { - eff_120_slot = slotP; - buf = longBitmap->buf[0]; - } else if ((abs_slot % slot_per_period) < 17) { - eff_120_slot = slotP - 9; - buf = longBitmap->buf[1]; - } else if ((abs_slot % slot_per_period) < 26) { - eff_120_slot = slotP - 18; - buf = longBitmap->buf[2]; - } else if ((abs_slot % slot_per_period) < 35) { - eff_120_slot = slotP - 27; - buf = longBitmap->buf[3]; - } - if (((buf >> (6 - (eff_120_slot << 1))) & 3) != 0) - fill_ssb_vrb_map(cc, ssb_offset0 / (ratio * 12) - 10, CC_id); - break; - default: - AssertFatal(0, - "SSB bitmap size value %d undefined (allowed values 1,2,3)\n", - cc->ServingCellConfigCommon->ssb_PositionsInBurst->present); + int8_t ssb_period = *scc->ssb_periodicityServingCell; + uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated + + if (ssb_period > 1) // 0 is every half frame + ssb_frame_periodicity = 1 << (ssb_period -1); + + if (!(frameP%ssb_frame_periodicity) && + ((slotP<(slots_per_frame>>1)) || (ssb_period == 0))) { + // schedule SSB only for given frames according to SSB periodicity + // and in first half frame unless periodicity of 5ms + int rel_slot; + if (ssb_period == 0) // scheduling every half frame + rel_slot = slotP%(slots_per_frame>>1); + else + rel_slot = slotP; + + NR_SubcarrierSpacing_t scs = *scc->ssbSubcarrierSpacing; + const long band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + uint16_t offset_pointa = get_ssboffset_pointa(scc,band); + uint8_t ssbSubcarrierOffset = gNB->ssb_SubcarrierOffset; + + const BIT_STRING_t *shortBitmap = &scc->ssb_PositionsInBurst->choice.shortBitmap; + const BIT_STRING_t *mediumBitmap = &scc->ssb_PositionsInBurst->choice.mediumBitmap; + const BIT_STRING_t *longBitmap = &scc->ssb_PositionsInBurst->choice.longBitmap; + + uint16_t ssb_start_symbol; + + switch (scc->ssb_PositionsInBurst->present) { + case 1: + // short bitmap (<3GHz) max 4 SSBs + for (int i_ssb=0; i_ssb<4; i_ssb++) { + if ((shortBitmap->buf[0]>>(7-i_ssb))&0x01) { + ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb); + // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters + if ((ssb_start_symbol/14) == rel_slot){ + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id); + if (get_softmodem_params()->sa == 1) { + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], + frameP, + mib, + slots_per_frame, + ssbSubcarrierOffset, + ssb_start_symbol, + scs, + FR1, + i_ssb, + offset_pointa); + gNB->type0_PDCCH_CSS_config[i_ssb].active = true; + } + } + } + } + break; + case 2: + // medium bitmap (<6GHz) max 8 SSBs + for (int i_ssb=0; i_ssb<8; i_ssb++) { + if ((mediumBitmap->buf[0]>>(7-i_ssb))&0x01) { + ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb); + // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters + if ((ssb_start_symbol/14) == rel_slot){ + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id); + if (get_softmodem_params()->sa == 1) { + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], + frameP, + mib, + slots_per_frame, + ssbSubcarrierOffset, + ssb_start_symbol, + scs, + FR1, + i_ssb, + offset_pointa); + gNB->type0_PDCCH_CSS_config[i_ssb].active = true; + } + } + } + } + break; + case 3: + // long bitmap FR2 max 64 SSBs + num_ssb = 0; + for (int i_ssb=0; i_ssb<63; i_ssb++) { + if ((longBitmap->buf[i_ssb/8]>>(7-i_ssb))&0x01) { + ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb); + // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters + if ((ssb_start_symbol/14) == rel_slot){ + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id); + num_tdd_period = rel_slot/(slots_per_frame/nb_periods_per_frame); + gNB->tdd_beam_association[num_tdd_period]=i_ssb; + num_ssb++; + AssertFatal(num_ssb<2,"beamforming currently not supported for more than one SSB per slot\n"); + if (get_softmodem_params()->sa == 1) { + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], + frameP, + mib, + slots_per_frame, + ssbSubcarrierOffset, + ssb_start_symbol, + scs, + FR2, + i_ssb, + offset_pointa); + gNB->type0_PDCCH_CSS_config[i_ssb].active = true; + } + } + } + } + break; + default: + AssertFatal(0,"SSB bitmap size value %d undefined (allowed values 1,2,3)\n", + scc->ssb_PositionsInBurst->present); + } } } } @@ -224,14 +293,22 @@ void schedule_nr_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframe //---------------------------------------- } -void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) { +void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart, int CC_id) { + + AssertFatal(*cc->ServingCellConfigCommon->ssbSubcarrierSpacing != + NR_SubcarrierSpacing_kHz240, + "240kHZ subcarrier won't work with current VRB map because a single SSB might be across 2 slots\n"); + uint16_t *vrb_map = cc[CC_id].vrb_map; + for (int rb = 0; rb < 20; rb++) - vrb_map[rbStart + rb] = 1; + vrb_map[rbStart + rb] = 15<<symStart; + } void schedule_control_sib1(module_id_t module_id, int CC_id, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, int time_domain_allocation, uint8_t mcsTableIdx, uint8_t mcs, @@ -243,16 +320,15 @@ void schedule_control_sib1(module_id_t module_id, uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; if (gNB_mac->sched_ctrlCommon == NULL){ + LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n"); gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); - gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); } - gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; @@ -272,14 +348,18 @@ void schedule_control_sib1(module_id_t module_id, AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n"); - const uint16_t bwpSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; - int rbStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; + int rbStart = type0_PDCCH_CSS_config->cset_start_rb; - // Calculate number of symbols - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + int startSymbolIndex = 0; + int nrOfSymbols = 0; + if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; + } else { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; + } if (nrOfSymbols == 2) { gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1; @@ -289,9 +369,10 @@ void schedule_control_sib1(module_id_t module_id, // Calculate number of PRB_DMRS uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); + uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex); uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); + LOG_D(MAC,"dlDmrsSymbPos %x\n",dlDmrsSymbPos); int rbSize = 0; uint32_t TBS = 0; do { @@ -304,12 +385,12 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->rbStart = 0; - LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); LOG_D(MAC,"TBS = %i\n", TBS); - + LOG_D(MAC,"dmrs_length %d\n",dmrs_length); + LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { vrb_map[rb + rbStart] = 1; @@ -318,6 +399,7 @@ void schedule_control_sib1(module_id_t module_id, void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, uint32_t TBS, int StartSymbolIndex, int NrOfSymbols) { @@ -325,7 +407,6 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; NR_COMMON_channels_t *cc = gNB_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - NR_CellGroupConfig_t *secondaryCellGroup = gNB_mac->secondaryCellGroupCommon; NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -340,6 +421,10 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, scc, bwp); + // TODO: This assignment should be done in function nr_configure_pdcch() + pdcch_pdu_rel15->BWPSize = gNB_mac->type0_PDCCH_CSS_config->num_rbs; + pdcch_pdu_rel15->BWPStart = gNB_mac->type0_PDCCH_CSS_config->cset_start_rb; + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; @@ -353,8 +438,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->rnti = SI_RNTI; pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; - pdsch_pdu_rel15->BWPSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; - pdsch_pdu_rel15->BWPStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + pdsch_pdu_rel15->BWPSize = type0_PDCCH_CSS_config->num_rbs; + pdsch_pdu_rel15->BWPStart = type0_PDCCH_CSS_config->cset_start_rb; pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; if (bwp->bwp_Common->genericParameters.cyclicPrefix) { @@ -373,7 +458,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; pdsch_pdu_rel15->refPoint = 1; - pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + pdsch_pdu_rel15->dmrsConfigType = 0; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; @@ -388,7 +473,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; - pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->StartSymbolIndex+pdsch_pdu_rel15->NrOfSymbols); + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols, pdsch_pdu_rel15->StartSymbolIndex); LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); @@ -411,7 +496,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, // frequency domain assignment dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0( - pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, gNB_mac->type0_PDCCH_CSS_config.num_rbs); + pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, type0_PDCCH_CSS_config->num_rbs); dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; dci_payload.mcs = gNB_mac->sched_ctrlCommon->mcs; @@ -429,7 +514,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, int rnti_type = NR_RNTI_SI; fill_dci_pdu_rel15(scc, - secondaryCellGroup, + NULL, &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], &dci_payload, dci_format, @@ -456,8 +541,6 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { - LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); - // TODO: Get these values from RRC const int CC_id = 0; int time_domain_allocation = 0; @@ -466,52 +549,82 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) uint8_t candidate_idx = 0; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; + NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; - if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) && (gNB_mac->type0_PDCCH_CSS_config.num_rbs > 0) ) { - - LOG_D(MAC,"> SIB1 transmission\n"); - - // Get SIB1 - uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8]; - uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); - LOG_D(MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); - LOG_D(MAC,"SIB1: \n"); - for (int i=0;i<sib1_sdu_length;i++) LOG_D(MAC,"byte %d : %x\n",i,((uint8_t*)sib1_payload)[i]); - - // Configure sched_ctrlCommon for SIB1 - schedule_control_sib1(module_idP, CC_id, time_domain_allocation, mcsTableIdx, mcs, candidate_idx, sib1_sdu_length); + int L_max; + switch (scc->ssb_PositionsInBurst->present) { + case 1: + L_max = 4; + break; + case 2: + L_max = 8; + break; + case 3: + L_max = 64; + break; + default: + AssertFatal(0,"SSB bitmap size value %d undefined (allowed values 1,2,3)\n", + scc->ssb_PositionsInBurst->present); + } - // Calculate number of symbols - int startSymbolIndex, nrOfSymbols; - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + for (int i=0; i<L_max; i++) { - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); - uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = &gNB_mac->type0_PDCCH_CSS_config[i]; - const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3; + if((frameP%2 == type0_PDCCH_CSS_config->sfn_c) && + (slotP == type0_PDCCH_CSS_config->n_0) && + (type0_PDCCH_CSS_config->num_rbs > 0) && + (type0_PDCCH_CSS_config->active == true)) { - nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; - nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); + LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index); - const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; - nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; + // Get SIB1 + uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8]; + uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, SI_RNTI, 1, sib1_payload); + LOG_D(NR_MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); + LOG_D(NR_MAC,"SIB1: \n"); + for (int k=0;k<sib1_sdu_length;k++) LOG_D(NR_MAC,"byte %d : %x\n",k,((uint8_t*)sib1_payload)[k]); - // Data to be transmitted - bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); - memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); + // Configure sched_ctrlCommon for SIB1 + schedule_control_sib1(module_idP, CC_id, type0_PDCCH_CSS_config, time_domain_allocation, mcsTableIdx, mcs, candidate_idx, sib1_sdu_length); - tx_req->PDU_length = TBS; - tx_req->PDU_index = gNB_mac->pdu_index[0]++; - tx_req->num_TLV = 1; - tx_req->TLVs[0].length = TBS + 2; - gNB_mac->TX_req[CC_id].Number_of_PDUs++; - gNB_mac->TX_req[CC_id].SFN = frameP; - gNB_mac->TX_req[CC_id].Slot = slotP; + int startSymbolIndex = 0; + int nrOfSymbols = 0; + if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; + } else { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; + } + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex); + uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); + const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3; + + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols); + + const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; + nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; + + // Data to be transmitted + bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); + memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); + + tx_req->PDU_length = TBS; + tx_req->PDU_index = gNB_mac->pdu_index[0]++; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = TBS + 2; + gNB_mac->TX_req[CC_id].Number_of_PDUs++; + gNB_mac->TX_req[CC_id].SFN = frameP; + gNB_mac->TX_req[CC_id].Slot = slotP; + + type0_PDCCH_CSS_config->active = false; + } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index ebec6b0cfe2621f1addfb6224f2d6ce332ed51b3..b6a924fb170fd5436e7716353e9cd2ad8a5c5c13 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -55,7 +55,7 @@ #define HALFWORD 16 #define WORD 32 //#define SIZE_OF_POINTER sizeof (void *) - +static int loop_dcch_dtch = DL_SCH_LCID_DTCH; // Compute and write all MAC CEs and subheaders, and return number of written // bytes int nr_write_ce_dlsch_pdu(module_id_t module_idP, @@ -100,7 +100,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, ((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); + LOG_D(NR_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); @@ -119,7 +119,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, // 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, // 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", + LOG_T(NR_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]); // Copying bytes (6 octects) to CEs pointer @@ -144,7 +144,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, 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); + LOG_D(NR_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); @@ -255,7 +255,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, ((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, + LOG_D(NR_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; @@ -302,22 +302,24 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, return offset; } -int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda) { +void getStartNrOfSymbols(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *scc,int tda, int *startSymbol, int *nrOfSymbols) { struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = - bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + bwp? + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList: + scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - return nrOfSymbols; + SLIV2SL(startSymbolAndLength, startSymbol, nrOfSymbols); } nfapi_nr_dmrs_type_e getDmrsConfigType(NR_BWP_Downlink_t *bwp) { - return bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + return bwp? + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1: + 0; } uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData) { @@ -341,7 +343,15 @@ void nr_store_dlsch_buffer(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; sched_ctrl->num_total_bytes = 0; - const int lcid = DL_SCH_LCID_DTCH; + if (loop_dcch_dtch == DL_SCH_LCID_DCCH1) + loop_dcch_dtch = DL_SCH_LCID_DTCH; + else if (loop_dcch_dtch == DL_SCH_LCID_DTCH) + loop_dcch_dtch = DL_SCH_LCID_DCCH; + else if (loop_dcch_dtch == DL_SCH_LCID_DCCH) + loop_dcch_dtch = DL_SCH_LCID_DCCH1; + + const int lcid = loop_dcch_dtch; + // const int lcid = DL_SCH_LCID_DTCH; const uint16_t rnti = UE_info->rnti[UE_id]; sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, rnti, @@ -354,7 +364,17 @@ void nr_store_dlsch_buffer(module_id_t module_id, 0, 0); sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - LOG_D(MAC, + LOG_D(NR_MAC, + "%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n", + frame, + slot, + lcid, + sched_ctrl->num_total_bytes); + if (sched_ctrl->num_total_bytes == 0 + && !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */ + return; + + LOG_I(NR_MAC, "[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n", __func__, frame, @@ -372,8 +392,12 @@ bool allocate_retransmission(module_id_t module_id, int current_harq_pid){ NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id]; NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid]; - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + NR_BWP_t *genericParameters = sched_ctrl->active_bwp ? + &sched_ctrl->active_bwp->bwp_Common->genericParameters : + &RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + + const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); sched_ctrl->time_domain_allocation = retInfo->time_domain_allocation; @@ -384,7 +408,7 @@ bool allocate_retransmission(module_id_t module_id, rbSize = 0; while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; if (rbStart >= bwpSize) { - LOG_D(MAC, + LOG_D(NR_MAC, "cannot allocate retransmission for UE %d/RNTI %04x: no resources\n", UE_id, RC.nrmac[module_id]->UE_info.rnti[UE_id]); @@ -420,7 +444,9 @@ void pf_dl(module_id_t module_id, uint8_t *rballoc_mask, int max_num_ue) { - NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + gNB_MAC_INST *mac = RC.nrmac[module_id]; + NR_UE_info_t *UE_info = &mac->UE_info; + NR_ServingCellConfigCommon_t *scc=mac->common_channels[0].ServingCellConfigCommon; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; @@ -428,9 +454,23 @@ void pf_dl(module_id_t module_id, /* Loop UE_info->list to check retransmission */ for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { + if (UE_info->Msg4_ACKed[UE_id] != true) continue; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, NR_SearchSpace__searchSpaceType_PR_ue_Specific); - sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); + int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; + NR_BWP_DownlinkDedicated_t *bwp_Dedicated=NULL; + if (sched_ctrl->active_bwp) bwp_Dedicated = sched_ctrl->active_bwp->bwp_Dedicated; + else if (UE_info->CellGroup[UE_id] && + UE_info->CellGroup[UE_id]->spCellConfig && + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated) + bwp_Dedicated = UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; + + sched_ctrl->search_space = get_searchspace(scc,bwp_Dedicated, + bwp_Dedicated ? + NR_SearchSpace__searchSpaceType_PR_ue_Specific: + NR_SearchSpace__searchSpaceType_PR_common); + + sched_ctrl->coreset = get_coreset(scc,sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); + if (sched_ctrl->coreset == NULL) sched_ctrl->coreset = mac->sched_ctrlCommon->coreset; /* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */ sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; const rnti_t rnti = UE_info->rnti[UE_id]; @@ -445,14 +485,14 @@ void pf_dl(module_id_t module_id, /* Find a free CCE */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE){ - LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); + LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); continue; } /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); + const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot,-1); if (!alloc) { - LOG_W(MAC, + LOG_W(NR_MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", __func__, UE_id, @@ -461,7 +501,7 @@ void pf_dl(module_id_t module_id, slot); int cid = sched_ctrl->coreset->controlResourceSetId; UE_info->num_pdcch_cand[UE_id][cid]--; - int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid]; + int *cce_list = mac->cce_list[bwp_Id][cid]; for (int i = 0; i < sched_ctrl->aggregation_level; i++) cce_list[sched_ctrl->cce_index + i] = 0; return; @@ -469,7 +509,7 @@ void pf_dl(module_id_t module_id, /* Allocate retransmission */ bool r = allocate_retransmission(module_id, rballoc_mask, &n_rb_sched, UE_id, sched_ctrl->dl_harq_pid); if (!r) { - LOG_D(MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot); + LOG_D(NR_MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot); continue; } /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ @@ -484,11 +524,15 @@ void pf_dl(module_id_t module_id, sched_ctrl->time_domain_allocation = 2; sched_ctrl->mcsTableIdx = 0; sched_ctrl->mcs = 9; - sched_ctrl->numDmrsCdmGrpsNoData = 1; + sched_ctrl->numDmrsCdmGrpsNoData = sched_ctrl->active_bwp ? 2 : 1; uint8_t N_PRB_DMRS = - getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); - int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, - sched_ctrl->time_domain_allocation); + getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); + int startSymbol; + int nrOfSymbols; + getStartNrOfSymbols(sched_ctrl->active_bwp,scc, + sched_ctrl->time_domain_allocation, + &startSymbol, + &nrOfSymbols); uint32_t tbs = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), 1, // rbSize @@ -499,7 +543,7 @@ void pf_dl(module_id_t module_id, 1 /* nrOfLayers */) >> 3; coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id]; - LOG_D(MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", + LOG_D(NR_MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", b, UE_id, thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]); /* Create UE_sched list for UEs eligible for new transmission*/ add_tail_nr_list(&UE_sched, UE_id); @@ -527,14 +571,19 @@ void pf_dl(module_id_t module_id, *p = -1; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; const uint16_t rnti = UE_info->rnti[UE_id]; - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + NR_BWP_t *genericParameters = sched_ctrl->active_bwp ? + &sched_ctrl->active_bwp->bwp_Common->genericParameters: + &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + + const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); /* Find a free CCE */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { - LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); + LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); continue; } /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ @@ -543,9 +592,9 @@ void pf_dl(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); + const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot,-1); if (!alloc) { - LOG_W(MAC, + LOG_W(NR_MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", __func__, UE_id, @@ -554,7 +603,7 @@ void pf_dl(module_id_t module_id, slot); int cid = sched_ctrl->coreset->controlResourceSetId; UE_info->num_pdcch_cand[UE_id][cid]--; - int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid]; + int *cce_list = mac->cce_list[bwp_Id][cid]; for (int i = 0; i < sched_ctrl->aggregation_level; i++) cce_list[sched_ctrl->cce_index + i] = 0; return; @@ -567,20 +616,25 @@ void pf_dl(module_id_t module_id, // modulation scheme sched_ctrl->mcsTableIdx = 0; sched_ctrl->mcs = 9; - sched_ctrl->numDmrsCdmGrpsNoData = 1; + sched_ctrl->numDmrsCdmGrpsNoData = sched_ctrl->active_bwp ? 1 : 2; // Freq-demain allocation while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; const uint8_t N_PRB_DMRS = - getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); - const int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, - sched_ctrl->time_domain_allocation); - const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon; + getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); + int startSymbol; + int nrOfSymbols; + getStartNrOfSymbols(sched_ctrl->active_bwp,scc, + sched_ctrl->time_domain_allocation, + &startSymbol, + &nrOfSymbols); + const NR_ServingCellConfigCommon_t *scc = mac->common_channels->ServingCellConfigCommon; const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols( - sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, + sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, - nrOfSymbols); + nrOfSymbols, + startSymbol); int rbSize = 0; uint32_t TBS = 0; @@ -612,6 +666,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) { NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; if (UE_info->num_UEs == 0) return; @@ -622,7 +677,10 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, /* Get bwpSize from the first UE */ int UE_id = UE_info->list.head; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp ? + sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth: + scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, + MAX_BWP_SIZE); uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; uint8_t rballoc_mask[bwpSize]; @@ -672,7 +730,7 @@ void nr_schedule_ue_spec(module_id_t module_id, * If we add the CE, ta_apply will be reset */ if (frame == (sched_ctrl->ta_frame + 10) % 1024){ sched_ctrl->ta_apply = true; /* the timer is reset once TA CE is scheduled */ - LOG_D(MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot); + LOG_D(NR_MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot); } if (sched_ctrl->rbSize <= 0) @@ -682,7 +740,9 @@ void nr_schedule_ue_spec(module_id_t module_id, /* POST processing */ struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = - sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + sched_ctrl->active_bwp ? + sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList: + scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; AssertFatal(sched_ctrl->time_domain_allocation < tdaList->list.count, "time_domain_allocation %d>=%d\n", sched_ctrl->time_domain_allocation, @@ -695,9 +755,10 @@ void nr_schedule_ue_spec(module_id_t module_id, uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); - uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, + uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup:NULL, RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position , - nrOfSymbols); + nrOfSymbols, + startSymbolIndex); const nfapi_nr_dmrs_type_e dmrsConfigType = getDmrsConfigType(sched_ctrl->active_bwp); const int nrOfLayers = 1; const uint16_t R = nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx); @@ -739,7 +800,7 @@ void nr_schedule_ue_spec(module_id_t module_id, harq->is_waiting = true; UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++; - LOG_D(MAC, + LOG_D(NR_MAC, "%4d.%2d RNTI %04x start %d RBs %d startSymbol %d nb_symbsol %d MCS %d TBS %d HARQ PID %d round %d NDI %d\n", frame, slot, @@ -770,15 +831,11 @@ void nr_schedule_ue_spec(module_id_t module_id, harq->ndi); NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp; - AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList, - "searchSpacesToAddModList is null\n"); - AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count > 0, - "searchSPacesToAddModList is empty\n"); /* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not * exist, create it */ - const int bwpid = sched_ctrl->active_bwp->bwp_Id; - const int coresetid = sched_ctrl->coreset->controlResourceSetId; + const int bwpid = bwp ? bwp->bwp_Id : 0; + const int coresetid = bwp ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; if (!pdcch_pdu) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -787,7 +844,10 @@ void nr_schedule_ue_spec(module_id_t module_id, dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_req->nPDUs += 1; pdcch_pdu = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nr_configure_pdcch(pdcch_pdu, sched_ctrl->search_space, sched_ctrl->coreset, scc, bwp); + LOG_D(NR_MAC,"Trying to configure DL pdcch for bwp %d, cs %d\n",bwpid,coresetid); + NR_SearchSpace_t *ss = bwp ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space; + NR_ControlResourceSet_t *coreset = bwp? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset; + nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, bwp); gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu; } @@ -807,13 +867,13 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->pduIndex = pduindex; // BWP - pdsch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,MAX_BWP_SIZE); - pdsch_pdu->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; - if (bwp->bwp_Common->genericParameters.cyclicPrefix) - pdsch_pdu->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; - else - pdsch_pdu->CyclicPrefix = 0; + NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + + pdsch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + pdsch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing; + + pdsch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix : 0; // Codeword information pdsch_pdu->NrOfCodewords = 1; @@ -821,7 +881,9 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->qamModOrder[0] = Qm; pdsch_pdu->mcsIndex[0] = sched_ctrl->mcs; pdsch_pdu->mcsTable[0] = sched_ctrl->mcsTableIdx; - pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round]; + AssertFatal(harq!=NULL,"harq is null\n"); + AssertFatal(harq->round < 16,"harq->round %d > 15\n",harq->round); + pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round&3]; pdsch_pdu->TBSize[0] = TBS; pdsch_pdu->dataScramblingId = *scc->physCellId; @@ -830,10 +892,17 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->refPoint = 0; // Point A // DMRS - pdsch_pdu->dlDmrsSymbPos = - fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, - scc->dmrs_TypeA_Position, - nrOfSymbols); + NR_PDSCH_Config_t *pdsch_Config=NULL; + if (bwp && + bwp->bwp_Dedicated && + bwp->bwp_Dedicated->pdsch_Config && + bwp->bwp_Dedicated->pdsch_Config->choice.setup) + pdsch_Config = bwp->bwp_Dedicated->pdsch_Config->choice.setup; + + pdsch_pdu->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config, + scc->dmrs_TypeA_Position, + nrOfSymbols, + startSymbolIndex); pdsch_pdu->dmrsConfigType = dmrsConfigType; pdsch_pdu->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu->SCID = 0; @@ -852,7 +921,7 @@ void nr_schedule_ue_spec(module_id_t module_id, /* Check and validate PTRS values */ struct NR_SetupRelease_PTRS_DownlinkConfig *phaseTrackingRS = - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS; + pdsch_Config ? pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS : NULL; if (phaseTrackingRS) { bool valid_ptrs_setup = set_dl_ptrs_values(phaseTrackingRS->choice.setup, pdsch_pdu->rbSize, @@ -872,7 +941,9 @@ void nr_schedule_ue_spec(module_id_t module_id, nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; pdcch_pdu->numDlDci++; dci_pdu->RNTI = rnti; - if (sched_ctrl->coreset->pdcch_DMRS_ScramblingID && + if (sched_ctrl->coreset && + sched_ctrl->search_space && + sched_ctrl->coreset->pdcch_DMRS_ScramblingID && sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) { dci_pdu->ScramblingId = *sched_ctrl->coreset->pdcch_DMRS_ScramblingID; dci_pdu->ScramblingRNTI = rnti; @@ -889,19 +960,20 @@ void nr_schedule_ue_spec(module_id_t module_id, dci_pdu_rel15_t dci_payload; memset(&dci_payload, 0, sizeof(dci_pdu_rel15_t)); // bwp indicator - const int n_dl_bwp = UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; - AssertFatal(n_dl_bwp == 1, - "downlinkBWP_ToAddModList has %d BWP!\n", - n_dl_bwp); + const int n_dl_bwp = bwp ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count : 0; + AssertFatal(n_dl_bwp <= 1, + "downlinkBWP_ToAddModList has %d BWP!\n", + n_dl_bwp); // as per table 7.3.1.1.2-1 in 38.212 - dci_payload.bwp_indicator.val = n_dl_bwp < 4 ? bwp->bwp_Id : bwp->bwp_Id - 1; - AssertFatal(bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation == NR_PDSCH_Config__resourceAllocation_resourceAllocationType1, - "Only frequency resource allocation type 1 is currently supported\n"); + dci_payload.bwp_indicator.val = bwp ? (n_dl_bwp < 4 ? bwp->bwp_Id : bwp->bwp_Id - 1) : 0; + if (bwp) AssertFatal(bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation == NR_PDSCH_Config__resourceAllocation_resourceAllocationType1, + "Only frequency resource allocation type 1 is currently supported\n"); dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0( pdsch_pdu->rbSize, pdsch_pdu->rbStart, pdsch_pdu->BWPSize); + dci_payload.format_indicator = 1; dci_payload.time_domain_assignment.val = sched_ctrl->time_domain_allocation; dci_payload.mcs = sched_ctrl->mcs; dci_payload.rv = pdsch_pdu->rvIndex[0]; @@ -913,9 +985,9 @@ void nr_schedule_ue_spec(module_id_t module_id, dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; // PDSCH to HARQ TI dci_payload.antenna_ports.val = 0; // nb of cdm groups w/o data 1 and dmrs port 0 dci_payload.dmrs_sequence_initialization.val = pdsch_pdu->SCID; - LOG_D(MAC, + LOG_D(NR_MAC, "%4d.%2d DCI type 1 payload: freq_alloc %d (%d,%d,%d), " - "time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n", + "time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d tpc %d\n", frame, slot, dci_payload.frequency_domain_assignment.val, @@ -927,22 +999,23 @@ void nr_schedule_ue_spec(module_id_t module_id, dci_payload.mcs, dci_payload.tb_scaling, dci_payload.ndi, - dci_payload.rv); + dci_payload.rv, + dci_payload.tpc); const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; - const int dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; + const int dci_format = bwp ? (f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0) : NR_DL_DCI_FORMAT_1_0; const int rnti_type = NR_RNTI_C; fill_dci_pdu_rel15(scc, - UE_info->secondaryCellGroup[UE_id], + UE_info->CellGroup[UE_id], dci_pdu, &dci_payload, dci_format, rnti_type, pdsch_pdu->BWPSize, - bwp->bwp_Id); + bwp? bwp->bwp_Id : 0); - LOG_D(MAC, + LOG_D(NR_MAC, "coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", (unsigned long long)pdcch_pdu->FreqDomainResource, pdcch_pdu->StartSymbolIndex, @@ -951,19 +1024,19 @@ void nr_schedule_ue_spec(module_id_t module_id, NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid]; if (harq->round != 0) { /* retransmission */ if (sched_ctrl->rbSize != retInfo->rbSize) - LOG_W(MAC, + LOG_W(NR_MAC, "retransmission uses different rbSize (%d vs. orig %d)\n", sched_ctrl->rbSize, retInfo->rbSize); if (sched_ctrl->time_domain_allocation != retInfo->time_domain_allocation) - LOG_W(MAC, + LOG_W(NR_MAC, "retransmission uses different time_domain_allocation (%d vs. orig %d)\n", sched_ctrl->time_domain_allocation, retInfo->time_domain_allocation); if (sched_ctrl->mcs != retInfo->mcs || sched_ctrl->mcsTableIdx != retInfo->mcsTableIdx || sched_ctrl->numDmrsCdmGrpsNoData != retInfo->numDmrsCdmGrpsNoData) - LOG_W(MAC, + LOG_W(NR_MAC, "retransmission uses different table/MCS/numDmrsCdmGrpsNoData (%d/%d/%d vs. orig %d/%d/%d)\n", sched_ctrl->mcsTableIdx, sched_ctrl->mcs, @@ -974,7 +1047,7 @@ void nr_schedule_ue_spec(module_id_t module_id, /* we do not have to do anything, since we do not require to get data * from RLC or encode MAC CEs. The TX_req structure is filled below * or copy data to FAPI structures */ - LOG_D(MAC, + LOG_D(NR_MAC, "%d.%2d DL retransmission UE %d/RNTI %04x HARQ PID %d round %d NDI %d\n", frame, slot, @@ -989,8 +1062,7 @@ void nr_schedule_ue_spec(module_id_t module_id, current_harq_pid); } else { /* initial transmission */ - LOG_D(MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); - + LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); harq->tb_size = TBS; uint8_t *buf = (uint8_t *) harq->tb; @@ -1006,7 +1078,8 @@ void nr_schedule_ue_spec(module_id_t module_id, /* next, get RLC data */ - const int lcid = DL_SCH_LCID_DTCH; + // const int lcid = DL_SCH_LCID_DTCH; + const int lcid = loop_dcch_dtch; int dlsch_total_bytes = 0; if (sched_ctrl->num_total_bytes > 0) { tbs_size_t len = 0; @@ -1033,12 +1106,13 @@ void nr_schedule_ue_spec(module_id_t module_id, 0, 0); - LOG_D(MAC, - "%4d.%2d RNTI %04x: %d bytes from DTCH %d (ndata %d, remaining size %d)\n", + LOG_I(NR_MAC, + "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", frame, slot, rnti, len, + lcid < 4 ? "DCCH" : "DTCH", lcid, ndata, size); @@ -1067,7 +1141,7 @@ void nr_schedule_ue_spec(module_id_t module_id, buf += 3; size -= 3; DevAssert(size > 0); - LOG_D(MAC, "Configuring DL_TX in %d.%d: TBS %d with %d B of random data\n", frame, slot, TBS, size); + LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d with %d B of random data\n", frame, slot, TBS, size); // fill dlsch_buffer with random data for (int i = 0; i < size; i++) buf[i] = lrand48() & 0xff; @@ -1109,7 +1183,7 @@ void nr_schedule_ue_spec(module_id_t module_id, if (sched_ctrl->ta_apply) { sched_ctrl->ta_apply = false; sched_ctrl->ta_frame = frame; - LOG_D(MAC, + LOG_D(NR_MAC, "%d.%2d UE %d TA scheduled, resetting TA frame\n", frame, slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 3ab10e4b5e520fc9fcc7b0001775e49c6ca56b56..f01d963914640c0f87f7a3b7500ed9a457b29735 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -164,7 +164,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, - NrOfSymbols); + NrOfSymbols, + StartSymbolIndex); /* AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n"); @@ -254,14 +255,20 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, } } +extern int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda); +extern uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData); +uint32_t target_dl_mcs = 9; +uint32_t target_dl_bw = 50; +uint64_t dlsch_slot_bitmap = (1<<1); /* schedules whole bandwidth for first user, all the time */ void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot) { - if (slot != 1) + if (!is_xlsch_in_slot(dlsch_slot_bitmap, slot)) return; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; const int UE_id = 0; const int CC_id = 0; AssertFatal(UE_info->active[UE_id], @@ -272,24 +279,25 @@ void nr_preprocessor_phytest(module_id_t module_id, /* find largest unallocated chunk */ const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); int rbStart = 0; - int tStart = 0; int rbSize = 0; uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; - /* find largest unallocated RB region */ - do { + /* loop ensures that we allocate exactly target_dl_bw, or return */ + while (true) { /* advance to first free RB */ - while (tStart < bwpSize && vrb_map[tStart]) - tStart++; - /* find maximum rbSize at current rbStart */ - int tSize = 1; - while (tStart + tSize < bwpSize && !vrb_map[tStart + tSize]) - tSize++; - if (tSize > rbSize) { - rbStart = tStart; - rbSize = tSize; - } - tStart += tSize; - } while (tStart < bwpSize); + while (rbStart < bwpSize && vrb_map[rbStart]) + rbStart++; + rbSize = 1; + /* iterate until we are at target_dl_bw or no available RBs */ + while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && rbSize < target_dl_bw) + rbSize++; + /* found target_dl_bw? */ + if (rbSize == target_dl_bw) + break; + /* at end and below target_dl_bw? */ + if (rbStart + rbSize >= bwpSize) + return; + rbStart += rbSize; + } sched_ctrl->num_total_bytes = 0; const int lcid = DL_SCH_LCID_DTCH; @@ -309,12 +317,12 @@ void nr_preprocessor_phytest(module_id_t module_id, sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss); + sched_ctrl->search_space = get_searchspace(scc,sched_ctrl->active_bwp, target_ss); uint8_t nr_of_candidates; find_aggregation_candidates(&sched_ctrl->aggregation_level, &nr_of_candidates, sched_ctrl->search_space); - sched_ctrl->coreset = get_coreset( + sched_ctrl->coreset = get_coreset(scc, sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); const int cid = sched_ctrl->coreset->controlResourceSetId; const uint16_t Y = UE_info->Y[UE_id][cid][slot]; @@ -331,7 +339,7 @@ void nr_preprocessor_phytest(module_id_t module_id, __func__, UE_id); - const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); + const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot,-1); if (!alloc) { LOG_D(MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", @@ -354,15 +362,15 @@ void nr_preprocessor_phytest(module_id_t module_id, sched_ctrl->rbStart = rbStart; sched_ctrl->rbSize = rbSize; sched_ctrl->time_domain_allocation = 2; - if (!UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table) + if (!UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table) sched_ctrl->mcsTableIdx = 0; else { - if (*UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table == 0) + if (*UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table == 0) sched_ctrl->mcsTableIdx = 1; else sched_ctrl->mcsTableIdx = 2; } - sched_ctrl->mcs = 9; + sched_ctrl->mcs = target_dl_mcs; sched_ctrl->numDmrsCdmGrpsNoData = 1; /* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */ sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; @@ -374,6 +382,9 @@ void nr_preprocessor_phytest(module_id_t module_id, if ((frame&127) == 0) LOG_I(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_ctrl->mcs, rbStart,rbSize); } +uint32_t target_ul_mcs = 9; +uint32_t target_ul_bw = 50; +uint64_t ulsch_slot_bitmap = (1<<8); bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot, @@ -404,25 +415,26 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, "time domain assignment %d >= %d\n", tda, tdaList->list.count); - int K2 = get_K2(sched_ctrl->active_ubwp, tda, mu); + int K2 = get_K2(scc,sched_ctrl->active_ubwp, tda, mu); const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; /* check if slot is UL, and that slot is 8 (assuming K2=6 because of UE * limitations). Note that if K2 or the TDD configuration is changed, below * conditions might exclude each other and never be true */ - if (!(is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot) && sched_slot == 8)) + if (!is_xlsch_in_slot(ulsch_slot_bitmap, sched_slot)) return false; - const int bw = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); uint16_t rbStart = 0; - uint16_t rbSize = 50; /* due to OAI UE limitations */ - if (rbSize>bw) - rbSize = bw; + uint16_t rbSize = target_ul_bw; uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex; for (int i = rbStart; i < rbStart + rbSize; ++i) { - if (vrb_map_UL[i]) { + if ((vrb_map_UL[i] & symb) != 0) { LOG_E(MAC, "%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n", __func__, @@ -437,12 +449,12 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, sched_ctrl->sched_pusch.frame = sched_frame; const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss); + sched_ctrl->search_space = get_searchspace(scc,sched_ctrl->active_bwp, target_ss); uint8_t nr_of_candidates; find_aggregation_candidates(&sched_ctrl->aggregation_level, &nr_of_candidates, sched_ctrl->search_space); - sched_ctrl->coreset = get_coreset( + sched_ctrl->coreset = get_coreset(scc, sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); const int cid = sched_ctrl->coreset->controlResourceSetId; const uint16_t Y = UE_info->Y[UE_id][cid][slot]; @@ -478,7 +490,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, num_dmrs_cdm_grps_no_data, ps); - const int mcs = 9; + const int mcs = target_ul_mcs; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = mcs; sched_pusch->rbStart = rbStart; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 20da8fa30aaa520b3e44a22549de780c03f0043f..055f38d2136b1302ac65594156b38bd41048af6f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -122,19 +122,26 @@ static inline uint8_t get_max_cces(uint8_t scs) { return (nr_max_number_of_cces_per_slot[scs]); } -NR_ControlResourceSet_t *get_coreset(NR_BWP_Downlink_t *bwp, +NR_ControlResourceSet_t *get_coreset(NR_ServingCellConfigCommon_t *scc, + NR_BWP_Downlink_t *bwp, NR_SearchSpace_t *ss, - int ss_type) { + NR_SearchSpace__searchSpaceType_PR ss_type) { NR_ControlResourceSetId_t coreset_id = *ss->controlResourceSetId; - if (ss_type == 0) { // common search space - AssertFatal(coreset_id != 0, "coreset0 currently not supported\n"); - NR_ControlResourceSet_t *coreset = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; - AssertFatal(coreset_id == coreset->controlResourceSetId, - "ID of common ss coreset does not correspond to id set in the " - "search space\n"); + if (ss_type == NR_SearchSpace__searchSpaceType_PR_common) { // common search space + NR_ControlResourceSet_t *coreset; + if (bwp) coreset = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; + else if (scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet) + coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; + else coreset = NULL; + + if (coreset) AssertFatal(coreset_id == coreset->controlResourceSetId, + "ID of common ss coreset does not correspond to id set in the " + "search space\n"); return coreset; } else { + // AssertFatal(bwp!=NULL,"bwp is null here, we have to check for a dedicated configuration for initialBWP in CellGroup, todo\n"); const int n = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.count; + for (int i = 0; i < n; i++) { NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[i]; @@ -146,22 +153,24 @@ NR_ControlResourceSet_t *get_coreset(NR_BWP_Downlink_t *bwp, } } -NR_SearchSpace_t *get_searchspace( - NR_BWP_Downlink_t *bwp, - NR_SearchSpace__searchSpaceType_PR target_ss) { - DevAssert(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList); - DevAssert(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count > 0); +NR_SearchSpace_t *get_searchspace(NR_ServingCellConfigCommon_t *scc, + NR_BWP_DownlinkDedicated_t *bwp_Dedicated, + NR_SearchSpace__searchSpaceType_PR target_ss) { - const int n = bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count; + const int n = bwp_Dedicated ? + bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count: + scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.count; for (int i=0;i<n;i++) { - NR_SearchSpace_t *ss = bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]; + NR_SearchSpace_t *ss = bwp_Dedicated ? + bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]: + scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.array[i]; AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); AssertFatal(ss->searchSpaceType != NULL, "ss->searchSpaceType is null\n"); if (ss->searchSpaceType->present == target_ss) { return ss; } } - AssertFatal(0, "Couldn't find an adequate searchspace\n"); + AssertFatal(0, "Couldn't find an adequate searchspace bwp_Dedicated %p\n",bwp_Dedicated); } int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, @@ -178,8 +187,8 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, int coreset_id = coreset->controlResourceSetId; int *cce_list; - if(bwp->bwp_Id == 0) { - cce_list = nr_mac->cce_list[1][0]; + if(bwp == NULL || bwp->bwp_Id == 0) { + cce_list = nr_mac->cce_list[0][0]; } else { cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; } @@ -223,27 +232,29 @@ void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, ps->time_domain_allocation = tda; const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = - ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + ubwp? + ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: + scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList ; const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols); - ps->pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup; - if (!ps->pusch_Config->transformPrecoder) + ps->pusch_Config = ubwp?ubwp->bwp_Dedicated->pusch_Config->choice.setup:NULL; + if (ps->pusch_Config == NULL || !ps->pusch_Config->transformPrecoder) ps->transform_precoding = !scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder; else ps->transform_precoding = *ps->pusch_Config->transformPrecoder; const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; if (ps->transform_precoding) - ps->mcs_table = get_pusch_mcs_table(ps->pusch_Config->mcs_Table, + ps->mcs_table = get_pusch_mcs_table(ps->pusch_Config ? ps->pusch_Config->mcs_Table : NULL, 0, ps->dci_format, NR_RNTI_C, target_ss, false); else { - ps->mcs_table = get_pusch_mcs_table(ps->pusch_Config->mcs_TableTransformPrecoder, + ps->mcs_table = get_pusch_mcs_table(ps->pusch_Config ? ps->pusch_Config->mcs_TableTransformPrecoder : NULL, 1, ps->dci_format, NR_RNTI_C, @@ -256,20 +267,20 @@ void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, /* DMRS calculations */ ps->mapping_type = tdaList->list.array[tda]->mappingType; - ps->NR_DMRS_UplinkConfig = - ps->mapping_type == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA - ? ps->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup - : ps->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; - ps->dmrs_config_type = ps->NR_DMRS_UplinkConfig->dmrs_Type == NULL ? 0 : 1; + ps->NR_DMRS_UplinkConfig = ps->pusch_Config ? + (ps->mapping_type == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA ? + ps->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup : + ps->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup) : NULL; + ps->dmrs_config_type = ps->NR_DMRS_UplinkConfig ? ((ps->NR_DMRS_UplinkConfig->dmrs_Type == NULL ? 0 : 1)) : 0; const pusch_dmrs_AdditionalPosition_t additional_pos = - ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition == NULL - ? 2 - : (*ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition == - NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos3 - ? 3 - : *ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition); + ps->NR_DMRS_UplinkConfig ? (ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition == NULL + ? 2 + : (*ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition == + NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos3 + ? 3 + : *ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)):2; const pusch_maxLength_t pusch_maxLength = - ps->NR_DMRS_UplinkConfig->maxLength == NULL ? 1 : 2; + ps->NR_DMRS_UplinkConfig ? (ps->NR_DMRS_UplinkConfig->maxLength == NULL ? 1 : 2) : 1; const uint16_t l_prime_mask = get_l_prime(ps->nrOfSymbols, ps->mapping_type, additional_pos, @@ -503,6 +514,7 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, } void config_uldci(const NR_BWP_Uplink_t *ubwp, + const NR_ServingCellConfigCommon_t *scc, const nfapi_nr_pusch_pdu_t *pusch_pdu, dci_pdu_rel15_t *dci_pdu_rel15, int dci_format, @@ -510,7 +522,9 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, uint8_t tpc, int n_ubwp, int bwp_id) { - const int bw = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const int bw = NRRIV2BW(ubwp ? + ubwp->bwp_Common->genericParameters.locationAndBandwidth : + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); dci_pdu_rel15->frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size, pusch_pdu->rb_start, bw); dci_pdu_rel15->time_domain_assignment.val = time_domain_assignment; @@ -520,8 +534,8 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, dci_pdu_rel15->rv = pusch_pdu->pusch_data.rv_index; dci_pdu_rel15->harq_pid = pusch_pdu->pusch_data.harq_process_id; dci_pdu_rel15->tpc = tpc; - AssertFatal(ubwp->bwp_Dedicated->pusch_Config->choice.setup->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1, - "Only frequency resource allocation type 1 is currently supported\n"); + if (ubwp) AssertFatal(ubwp->bwp_Dedicated->pusch_Config->choice.setup->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1, + "Only frequency resource allocation type 1 is currently supported\n"); switch (dci_format) { case NR_UL_DCI_FORMAT_0_0: dci_pdu_rel15->format_indicator = 0; @@ -531,7 +545,11 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, // bwp indicator as per table 7.3.1.1.2-1 in 38.212 dci_pdu_rel15->bwp_indicator.val = n_ubwp < 4 ? bwp_id : bwp_id - 1; // SRS resource indicator - if (ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig != NULL) { + if (ubwp && + ubwp->bwp_Dedicated && + ubwp->bwp_Dedicated->pusch_Config && + ubwp->bwp_Dedicated->pusch_Config->choice.setup && + ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig != NULL) { AssertFatal(*ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig == NR_PUSCH_Config__txConfig_codebook, "Non Codebook configuration non supported\n"); dci_pdu_rel15->srs_resource_indicator.val = 0; // taking resource 0 for SRS @@ -545,7 +563,7 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, AssertFatal(0, "Valid UL formats are 0_0 and 0_1\n"); } - LOG_D(MAC, + LOG_D(NR_MAC, "%s() ULDCI type 0 payload: freq_alloc %d, time_alloc %d, freq_hop_flag %d, mcs %d tpc %d ndi %d rv %d\n", __func__, dci_pdu_rel15->frequency_domain_assignment.val, @@ -557,82 +575,93 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, dci_pdu_rel15->rv); } +const int default_pucch_fmt[] = {0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1}; +const int default_pucch_firstsymb[] = {12,12,12,10,10,10,10,4,4,4,4,0,0,0,0,0}; +const int default_pucch_numbsymb[] = {2,2,2,2,4,4,4,4,10,10,10,10,14,14,14,14,14}; +const int default_pucch_prboffset[] = {0,0,3,0,0,2,4,0,0,2,4,0,0,2,4,-1}; +const int default_pucch_csset[] = {2,3,3,2,4,4,4,2,4,4,4,2,4,4,4,4}; + +int nr_get_default_pucch_res(int pucch_ResourceCommon) { + + AssertFatal(pucch_ResourceCommon>=0 && pucch_ResourceCommon < 16, "illegal pucch_ResourceCommon %d\n",pucch_ResourceCommon); + + return(default_pucch_csset[pucch_ResourceCommon]); +} void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_SearchSpace_t *ss, NR_ControlResourceSet_t *coreset, NR_ServingCellConfigCommon_t *scc, NR_BWP_Downlink_t *bwp) { - if (bwp) { // This is not the InitialBWP - pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdcch_pdu->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; - pdcch_pdu->CyclicPrefix = (bwp->bwp_Common->genericParameters.cyclicPrefix==NULL) ? 0 : *bwp->bwp_Common->genericParameters.cyclicPrefix; - - // first symbol - //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); - int sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; - - AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); - AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); - - // for SPS=14 8 MSBs in positions 13 downto 6 - uint16_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | - (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - - for (int i=0; i<sps; i++) { - if ((monitoringSymbolsWithinSlot>>(sps-1-i))&1) { - pdcch_pdu->StartSymbolIndex=i; - break; - } - } - - pdcch_pdu->DurationSymbols = coreset->duration; - - for (int i=0;i<6;i++) - pdcch_pdu->FreqDomainResource[i] = coreset->frequencyDomainResources.buf[i]; - - - //cce-REG-MappingType - pdcch_pdu->CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved? - NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED : NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED; - - if (pdcch_pdu->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) { - pdcch_pdu->RegBundleSize = (coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize); - pdcch_pdu->InterleaverSize = (coreset->cce_REG_MappingType.choice.interleaved->interleaverSize==NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->interleaverSize); - AssertFatal(scc->physCellId != NULL,"scc->physCellId is null\n"); - pdcch_pdu->ShiftIndex = coreset->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *coreset->cce_REG_MappingType.choice.interleaved->shiftIndex : *scc->physCellId; - } - else { - pdcch_pdu->RegBundleSize = 0; - pdcch_pdu->InterleaverSize = 0; - pdcch_pdu->ShiftIndex = 0; - } - - if(coreset->controlResourceSetId == 0) { - pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; - } else{ - pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; + NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + + pdcch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + pdcch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing; + pdcch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix:0; + + // first symbol + //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); + int sps = genericParameters->cyclicPrefix == NULL ? 14 : 12; + + AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); + AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); + + // for SPS=14 8 MSBs in positions 13 downto 6 + uint16_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | + (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + + for (int i=0; i<sps; i++) { + if ((monitoringSymbolsWithinSlot>>(sps-1-i))&1) { + pdcch_pdu->StartSymbolIndex=i; + break; } - - //precoderGranularity - pdcch_pdu->precoderGranularity = coreset->precoderGranularity; } - else { // this is for InitialBWP - AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n"); + + pdcch_pdu->DurationSymbols = coreset->duration; + + for (int i=0;i<6;i++) + pdcch_pdu->FreqDomainResource[i] = coreset->frequencyDomainResources.buf[i]; + + + //cce-REG-MappingType + pdcch_pdu->CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved? + NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED : NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED; + + if (pdcch_pdu->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) { + pdcch_pdu->RegBundleSize = (coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize); + pdcch_pdu->InterleaverSize = (coreset->cce_REG_MappingType.choice.interleaved->interleaverSize==NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->interleaverSize); + AssertFatal(scc->physCellId != NULL,"scc->physCellId is null\n"); + pdcch_pdu->ShiftIndex = coreset->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *coreset->cce_REG_MappingType.choice.interleaved->shiftIndex : *scc->physCellId; + } + else { + pdcch_pdu->RegBundleSize = 0; + pdcch_pdu->InterleaverSize = 0; + pdcch_pdu->ShiftIndex = 0; + } + + if(coreset->controlResourceSetId == 0) { + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + } else{ + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; } + + //precoderGranularity + pdcch_pdu->precoderGranularity = coreset->precoderGranularity; } // This function configures pucch pdu fapi structure void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, + NR_CellGroupConfig_t *CellGroup, NR_BWP_Uplink_t *bwp, uint16_t rnti, uint8_t pucch_resource, uint16_t O_csi, uint16_t O_ack, - uint8_t O_sr) { + uint8_t O_sr, + int r_pucch) { NR_PUCCH_Config_t *pucch_Config; NR_PUCCH_Resource_t *pucchres; @@ -646,209 +675,238 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, int res_found = 0; pucch_pdu->bit_len_harq = O_ack; + pucch_pdu->bit_len_csi_part1 = O_csi; uint16_t O_uci = O_csi + O_ack; - if (bwp) { // This is not the InitialBWP - - NR_PUSCH_Config_t *pusch_Config = bwp->bwp_Dedicated->pusch_Config->choice.setup; - long *pusch_id = pusch_Config->dataScramblingIdentityPUSCH; - - if (pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA != NULL) - id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup->transformPrecodingDisabled->scramblingID0; - if (pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB != NULL) - id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->transformPrecodingDisabled->scramblingID0; - - // hop flags and hopping id are valid for any BWP - switch (bwp->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping){ - case 0 : - // if neither, both disabled - pucch_pdu->group_hop_flag = 0; - pucch_pdu->sequence_hop_flag = 0; - break; - case 1 : - // if enable, group enabled - pucch_pdu->group_hop_flag = 1; - pucch_pdu->sequence_hop_flag = 0; - break; - case 2 : - // if disable, sequence disabled - pucch_pdu->group_hop_flag = 0; - pucch_pdu->sequence_hop_flag = 1; - break; - default: - AssertFatal(1==0,"Group hopping flag %ld undefined (0,1,2) \n", bwp->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping); - } - - if (bwp->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId != NULL) - pucch_pdu->hopping_id = *bwp->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId; - else - pucch_pdu->hopping_id = *scc->physCellId; - - pucch_pdu->bwp_size = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pucch_pdu->bwp_start = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pucch_pdu->subcarrier_spacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; - pucch_pdu->cyclic_prefix = (bwp->bwp_Common->genericParameters.cyclicPrefix==NULL) ? 0 : *bwp->bwp_Common->genericParameters.cyclicPrefix; - - pucch_Config = bwp->bwp_Dedicated->pucch_Config->choice.setup; - - AssertFatal(pucch_Config->resourceSetToAddModList!=NULL, - "PUCCH resourceSetToAddModList is null\n"); - - n_set = pucch_Config->resourceSetToAddModList->list.count; - AssertFatal(n_set>0,"PUCCH resourceSetToAddModList is empty\n"); - - N2 = 2; - // procedure to select pucch resource id from resource sets according to - // number of uci bits and pucch resource indicator pucch_resource - // ( see table 9.2.3.2 in 38.213) - for (int i=0; i<n_set; i++) { - pucchresset = pucch_Config->resourceSetToAddModList->list.array[i]; - n_list = pucchresset->resourceList.list.count; - if (pucchresset->pucch_ResourceSetId == 0 && O_uci<3) { - if (pucch_resource < n_list) - resource_id = pucchresset->resourceList.list.array[pucch_resource]; - else - AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci); - } - if (pucchresset->pucch_ResourceSetId == 1 && O_uci>2) { + NR_PUSCH_Config_t *pusch_Config = bwp ? bwp->bwp_Dedicated->pusch_Config->choice.setup : NULL; + long *pusch_id = bwp ? pusch_Config->dataScramblingIdentityPUSCH : NULL; + + if (bwp && pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA != NULL) + id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup->transformPrecodingDisabled->scramblingID0; + else if (bwp && pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB != NULL) + id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->transformPrecodingDisabled->scramblingID0; + else id0 = scc->physCellId; + + NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon = bwp ? + bwp->bwp_Common->pucch_ConfigCommon->choice.setup : + scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup; + // hop flags and hopping id are valid for any BWP + switch (pucch_ConfigCommon->pucch_GroupHopping){ + case 0 : + // if neither, both disabled + pucch_pdu->group_hop_flag = 0; + pucch_pdu->sequence_hop_flag = 0; + break; + case 1 : + // if enable, group enabled + pucch_pdu->group_hop_flag = 1; + pucch_pdu->sequence_hop_flag = 0; + break; + case 2 : + // if disable, sequence disabled + pucch_pdu->group_hop_flag = 0; + pucch_pdu->sequence_hop_flag = 1; + break; + default: + AssertFatal(1==0,"Group hopping flag %ld undefined (0,1,2) \n", bwp->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping); + } + + if (pucch_ConfigCommon->hoppingId != NULL) + pucch_pdu->hopping_id = *pucch_ConfigCommon->hoppingId; + else + pucch_pdu->hopping_id = *scc->physCellId; + NR_BWP_t *genericParameters = bwp ? + &bwp->bwp_Common->genericParameters: + &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + pucch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + pucch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + pucch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing; + pucch_pdu->cyclic_prefix = (genericParameters->cyclicPrefix==NULL) ? 0 : *genericParameters->cyclicPrefix; + if (r_pucch<0){ + // we have either a dedicated BWP or Dedicated PUCCH configuration on InitialBWP + pucch_Config = bwp ? + bwp->bwp_Dedicated->pucch_Config->choice.setup: + CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; + + AssertFatal(pucch_Config->resourceSetToAddModList!=NULL, + "PUCCH resourceSetToAddModList is null\n"); + + n_set = pucch_Config->resourceSetToAddModList->list.count; + AssertFatal(n_set>0,"PUCCH resourceSetToAddModList is empty\n"); + + LOG_D(NR_MAC, "UCI n_set= %d\n", n_set); + + N2 = 2; + // procedure to select pucch resource id from resource sets according to + // number of uci bits and pucch resource indicator pucch_resource + // ( see table 9.2.3.2 in 38.213) + for (int i=0; i<n_set; i++) { + pucchresset = pucch_Config->resourceSetToAddModList->list.array[i]; + n_list = pucchresset->resourceList.list.count; + if (pucchresset->pucch_ResourceSetId == 0 && O_uci<3) { + if (pucch_resource < n_list) + resource_id = pucchresset->resourceList.list.array[pucch_resource]; + else + AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci); + } + if (pucchresset->pucch_ResourceSetId == 1 && O_uci>2) { #if (NR_RRC_VERSION >= MAKE_VERSION(16, 0, 0)) - N3 = pucchresset->maxPayloadSize!= NULL ? *pucchresset->maxPayloadSize : 1706; + N3 = pucchresset->maxPayloadSize!= NULL ? *pucchresset->maxPayloadSize : 1706; #else - N3 = pucchresset->maxPayloadMinus1!= NULL ? *pucchresset->maxPayloadMinus1 : 1706; + N3 = pucchresset->maxPayloadMinus1!= NULL ? *pucchresset->maxPayloadMinus1 : 1706; #endif - if (N2<O_uci && N3>O_uci) { - if (pucch_resource < n_list) - resource_id = pucchresset->resourceList.list.array[pucch_resource]; - else - AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci); - } - else N2 = N3; + if (N2<O_uci && N3>O_uci) { + if (pucch_resource < n_list) + resource_id = pucchresset->resourceList.list.array[pucch_resource]; + else + AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci); + } + else N2 = N3; + } + } + + AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); + + AssertFatal(pucch_Config->resourceToAddModList!=NULL, + "PUCCH resourceToAddModList is null\n"); + + n_list = pucch_Config->resourceToAddModList->list.count; + AssertFatal(n_list>0,"PUCCH resourceToAddModList is empty\n"); + + // going through the list of PUCCH resources to find the one indexed by resource_id + for (int i=0; i<n_list; i++) { + pucchres = pucch_Config->resourceToAddModList->list.array[i]; + if (pucchres->pucch_ResourceId == *resource_id) { + res_found = 1; + pucch_pdu->prb_start = pucchres->startingPRB; + pucch_pdu->rnti = rnti; + // FIXME why there is only one frequency hopping flag + // what about inter slot frequency hopping? + pucch_pdu->freq_hop_flag = pucchres->intraSlotFrequencyHopping!= NULL ? 1 : 0; + pucch_pdu->second_hop_prb = pucchres->secondHopPRB!= NULL ? *pucchres->secondHopPRB : 0; + switch(pucchres->format.present) { + case NR_PUCCH_Resource__format_PR_format0 : + pucch_pdu->format_type = 0; + pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format0->initialCyclicShift; + pucch_pdu->nr_of_symbols = pucchres->format.choice.format0->nrofSymbols; + pucch_pdu->start_symbol_index = pucchres->format.choice.format0->startingSymbolIndex; + pucch_pdu->sr_flag = O_sr; + break; + case NR_PUCCH_Resource__format_PR_format1 : + pucch_pdu->format_type = 1; + pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format1->initialCyclicShift; + pucch_pdu->nr_of_symbols = pucchres->format.choice.format1->nrofSymbols; + pucch_pdu->start_symbol_index = pucchres->format.choice.format1->startingSymbolIndex; + pucch_pdu->time_domain_occ_idx = pucchres->format.choice.format1->timeDomainOCC; + pucch_pdu->sr_flag = O_sr; + break; + case NR_PUCCH_Resource__format_PR_format2 : + pucch_pdu->format_type = 2; + pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; + pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; + pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId; + pucch_pdu->dmrs_scrambling_id = id0!= NULL ? *id0 : *scc->physCellId; + pucch_pdu->prb_size = compute_pucch_prb_size(2,pucchres->format.choice.format2->nrofPRBs, + O_uci+O_sr,O_csi,pucch_Config->format2->choice.setup->maxCodeRate, + 2,pucchres->format.choice.format2->nrofSymbols,8); + pucch_pdu->bit_len_csi_part1 = O_csi; + break; + case NR_PUCCH_Resource__format_PR_format3 : + pucch_pdu->format_type = 3; + pucch_pdu->nr_of_symbols = pucchres->format.choice.format3->nrofSymbols; + pucch_pdu->start_symbol_index = pucchres->format.choice.format3->startingSymbolIndex; + pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId; + if (pucch_Config->format3 == NULL) { + pucch_pdu->pi_2bpsk = 0; + pucch_pdu->add_dmrs_flag = 0; + } + else { + pucchfmt = pucch_Config->format3->choice.setup; + pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0; + pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0; + } + int f3_dmrs_symbols; + if (pucchres->format.choice.format3->nrofSymbols==4) + f3_dmrs_symbols = 1<<pucch_pdu->freq_hop_flag; + else { + if(pucchres->format.choice.format3->nrofSymbols<10) + f3_dmrs_symbols = 2; + else + f3_dmrs_symbols = 2<<pucch_pdu->add_dmrs_flag; + } + pucch_pdu->prb_size = compute_pucch_prb_size(3,pucchres->format.choice.format3->nrofPRBs, + O_uci+O_sr,O_csi,pucch_Config->format3->choice.setup->maxCodeRate, + 2-pucch_pdu->pi_2bpsk,pucchres->format.choice.format3->nrofSymbols-f3_dmrs_symbols,12); + pucch_pdu->bit_len_csi_part1 = O_csi; + break; + case NR_PUCCH_Resource__format_PR_format4 : + pucch_pdu->format_type = 4; + pucch_pdu->nr_of_symbols = pucchres->format.choice.format4->nrofSymbols; + pucch_pdu->start_symbol_index = pucchres->format.choice.format4->startingSymbolIndex; + pucch_pdu->pre_dft_occ_len = pucchres->format.choice.format4->occ_Length; + pucch_pdu->pre_dft_occ_idx = pucchres->format.choice.format4->occ_Index; + pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId; + if (pucch_Config->format3 == NULL) { + pucch_pdu->pi_2bpsk = 0; + pucch_pdu->add_dmrs_flag = 0; + } + else { + pucchfmt = pucch_Config->format3->choice.setup; + pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0; + pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0; + } + pucch_pdu->bit_len_csi_part1 = O_csi; + break; + default : + AssertFatal(1==0,"Undefined PUCCH format \n"); + } + } + } + AssertFatal(res_found==1,"No PUCCH resource found corresponding to id %ld\n",*resource_id); } - } - - AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); - - AssertFatal(pucch_Config->resourceToAddModList!=NULL, - "PUCCH resourceToAddModList is null\n"); - - n_list = pucch_Config->resourceToAddModList->list.count; - AssertFatal(n_list>0,"PUCCH resourceToAddModList is empty\n"); - - // going through the list of PUCCH resources to find the one indexed by resource_id - for (int i=0; i<n_list; i++) { - pucchres = pucch_Config->resourceToAddModList->list.array[i]; - if (pucchres->pucch_ResourceId == *resource_id) { - res_found = 1; - pucch_pdu->prb_start = pucchres->startingPRB; - pucch_pdu->rnti = rnti; - // FIXME why there is only one frequency hopping flag - // what about inter slot frequency hopping? - pucch_pdu->freq_hop_flag = pucchres->intraSlotFrequencyHopping!= NULL ? 1 : 0; - pucch_pdu->second_hop_prb = pucchres->secondHopPRB!= NULL ? *pucchres->secondHopPRB : 0; - switch(pucchres->format.present) { - case NR_PUCCH_Resource__format_PR_format0 : - pucch_pdu->format_type = 0; - pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format0->initialCyclicShift; - pucch_pdu->nr_of_symbols = pucchres->format.choice.format0->nrofSymbols; - pucch_pdu->start_symbol_index = pucchres->format.choice.format0->startingSymbolIndex; - pucch_pdu->sr_flag = O_sr; - break; - case NR_PUCCH_Resource__format_PR_format1 : - pucch_pdu->format_type = 1; - pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format1->initialCyclicShift; - pucch_pdu->nr_of_symbols = pucchres->format.choice.format1->nrofSymbols; - pucch_pdu->start_symbol_index = pucchres->format.choice.format1->startingSymbolIndex; - pucch_pdu->time_domain_occ_idx = pucchres->format.choice.format1->timeDomainOCC; - pucch_pdu->sr_flag = O_sr; - break; - case NR_PUCCH_Resource__format_PR_format2 : - pucch_pdu->format_type = 2; - pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; - pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; - pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId; - pucch_pdu->dmrs_scrambling_id = id0!= NULL ? *id0 : *scc->physCellId; - pucch_pdu->prb_size = compute_pucch_prb_size(2,pucchres->format.choice.format2->nrofPRBs, - O_uci+O_sr,O_csi,pucch_Config->format2->choice.setup->maxCodeRate, - 2,pucchres->format.choice.format2->nrofSymbols,8); - pucch_pdu->bit_len_csi_part1 = O_csi; - break; - case NR_PUCCH_Resource__format_PR_format3 : - pucch_pdu->format_type = 3; - pucch_pdu->nr_of_symbols = pucchres->format.choice.format3->nrofSymbols; - pucch_pdu->start_symbol_index = pucchres->format.choice.format3->startingSymbolIndex; - pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId; - if (pucch_Config->format3 == NULL) { - pucch_pdu->pi_2bpsk = 0; - pucch_pdu->add_dmrs_flag = 0; - } - else { - pucchfmt = pucch_Config->format3->choice.setup; - pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0; - pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0; - } - int f3_dmrs_symbols; - if (pucchres->format.choice.format3->nrofSymbols==4) - f3_dmrs_symbols = 1<<pucch_pdu->freq_hop_flag; - else { - if(pucchres->format.choice.format3->nrofSymbols<10) - f3_dmrs_symbols = 2; - else - f3_dmrs_symbols = 2<<pucch_pdu->add_dmrs_flag; - } - pucch_pdu->prb_size = compute_pucch_prb_size(3,pucchres->format.choice.format3->nrofPRBs, - O_uci+O_sr,O_csi,pucch_Config->format3->choice.setup->maxCodeRate, - 2-pucch_pdu->pi_2bpsk,pucchres->format.choice.format3->nrofSymbols-f3_dmrs_symbols,12); - pucch_pdu->bit_len_csi_part1 = O_csi; - break; - case NR_PUCCH_Resource__format_PR_format4 : - pucch_pdu->format_type = 4; - pucch_pdu->nr_of_symbols = pucchres->format.choice.format4->nrofSymbols; - pucch_pdu->start_symbol_index = pucchres->format.choice.format4->startingSymbolIndex; - pucch_pdu->pre_dft_occ_len = pucchres->format.choice.format4->occ_Length; - pucch_pdu->pre_dft_occ_idx = pucchres->format.choice.format4->occ_Index; - pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId; - if (pucch_Config->format3 == NULL) { - pucch_pdu->pi_2bpsk = 0; - pucch_pdu->add_dmrs_flag = 0; - } - else { - pucchfmt = pucch_Config->format3->choice.setup; - pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0; - pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0; - } - pucch_pdu->bit_len_csi_part1 = O_csi; - break; - default : - AssertFatal(1==0,"Undefined PUCCH format \n"); - } + else { // this is the default PUCCH configuration, PUCCH format 0 or 1 + int rsetindex = *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon; + int prboffset = r_pucch/default_pucch_csset[rsetindex]; + int prboffsetm8 = (r_pucch-8)/default_pucch_csset[rsetindex]; + pucch_pdu->prb_start = (r_pucch>>3)==0 ? + default_pucch_prboffset[rsetindex] + prboffset: + pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffsetm8; + pucch_pdu->rnti = rnti; + pucch_pdu->freq_hop_flag = 1; + pucch_pdu->second_hop_prb = (r_pucch>>3)==0? + pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffset: + default_pucch_prboffset[rsetindex] + prboffsetm8; + pucch_pdu->format_type = default_pucch_fmt[rsetindex]; + pucch_pdu->initial_cyclic_shift = r_pucch%default_pucch_csset[rsetindex]; + if (rsetindex==3||rsetindex==7||rsetindex==11) pucch_pdu->initial_cyclic_shift*=6; + else if (rsetindex==1||rsetindex==2) pucch_pdu->initial_cyclic_shift*=3; + else pucch_pdu->initial_cyclic_shift*=4; + pucch_pdu->nr_of_symbols = default_pucch_numbsymb[rsetindex]; + pucch_pdu->start_symbol_index = default_pucch_firstsymb[rsetindex]; + if (pucch_pdu->format_type == 1) pucch_pdu->time_domain_occ_idx = 0; // check this!! + pucch_pdu->sr_flag = O_sr; } - } - AssertFatal(res_found==1,"No PUCCH resource found corresponding to id %ld\n",*resource_id); - } - else { // this is for InitialBWP - AssertFatal(1==0,"Fill in InitialBWP PUCCH configuration\n"); - } } -void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup, +void prepare_dci(const NR_CellGroupConfig_t *CellGroup, dci_pdu_rel15_t *dci_pdu_rel15, nr_dci_format_t format, int bwp_id) { - NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_BWP_Downlink_t *bwp=CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; switch(format) { case NR_UL_DCI_FORMAT_0_1: // format indicator dci_pdu_rel15->format_indicator = 0; // carrier indicator - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) + if (CellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) AssertFatal(1==0,"Cross Carrier Scheduling Config currently not supported\n"); // supplementary uplink - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink != NULL) + if (CellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink != NULL) AssertFatal(1==0,"Supplementary Uplink currently not supported\n"); // SRS request dci_pdu_rel15->srs_request.val = 0; @@ -858,7 +916,7 @@ void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup, // format indicator dci_pdu_rel15->format_indicator = 1; // carrier indicator - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) + if (CellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) AssertFatal(1==0,"Cross Carrier Scheduling Config currently not supported\n"); //vrb to prb mapping if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver==NULL) @@ -879,8 +937,8 @@ void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup, if (bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI != NULL) AssertFatal(1==0,"TCI in DCI currently not supported\n"); //srs resource set - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching!=NULL) { - NR_SRS_CarrierSwitching_t *cs = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching->choice.setup; + if (CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching!=NULL) { + NR_SRS_CarrierSwitching_t *cs = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching->choice.setup; if (cs->srs_TPC_PDCCH_Group!=NULL){ switch(cs->srs_TPC_PDCCH_Group->present) { case NR_SRS_CarrierSwitching__srs_TPC_PDCCH_Group_PR_NOTHING: @@ -900,7 +958,7 @@ void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup, else dci_pdu_rel15->srs_request.val = 0; // CBGTI and CBGFI - if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) + if (CellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) AssertFatal(1==0,"CBG transmission currently not supported\n"); break; default : @@ -910,7 +968,7 @@ void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup, void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, - const NR_CellGroupConfig_t *secondaryCellGroup, + const NR_CellGroupConfig_t *CellGroup, nfapi_nr_dl_dci_pdu_t *pdcch_dci_pdu, dci_pdu_rel15_t *dci_pdu_rel15, int dci_format, @@ -920,12 +978,12 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, uint8_t fsize = 0, pos = 0; uint64_t *dci_pdu = (uint64_t *)pdcch_dci_pdu->Payload; - int dci_size = nr_dci_size(scc, secondaryCellGroup, dci_pdu_rel15, dci_format, rnti_type, N_RB, bwp_id); + int dci_size = nr_dci_size(scc->uplinkConfigCommon->initialUplinkBWP, CellGroup, dci_pdu_rel15, dci_format, rnti_type, N_RB, bwp_id); pdcch_dci_pdu->PayloadSizeBits = dci_size; AssertFatal(dci_size <= 64, "DCI sizes above 64 bits not yet supported"); if (dci_format == NR_DL_DCI_FORMAT_1_1 || dci_format == NR_UL_DCI_FORMAT_0_1) - prepare_dci(secondaryCellGroup, dci_pdu_rel15, dci_format, bwp_id); + prepare_dci(CellGroup, dci_pdu_rel15, dci_format, bwp_id); /// Payload generation switch (dci_format) { @@ -936,7 +994,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1)); pos = fsize; *dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val & ((1 << fsize) - 1)) << (dci_size - pos)); - LOG_D(MAC, + LOG_D(NR_MAC, "frequency-domain assignment %d (%d bits) N_RB_BWP %d=> %d (0x%lx)\n", dci_pdu_rel15->frequency_domain_assignment.val, fsize, @@ -946,7 +1004,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // Time domain assignment pos += 4; *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val & 0xf) << (dci_size - pos)); - LOG_D(MAC, + LOG_D(NR_MAC, "time-domain assignment %d (3 bits)=> %d (0x%lx)\n", dci_pdu_rel15->time_domain_assignment.val, dci_size - pos, @@ -954,7 +1012,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // VRB to PRB mapping pos++; *dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val & 0x1) << (dci_size - pos); - LOG_D(MAC, + LOG_D(NR_MAC, "vrb to prb mapping %d (1 bits)=> %d (0x%lx)\n", dci_pdu_rel15->vrb_to_prb_mapping.val, dci_size - pos, @@ -963,21 +1021,21 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, pos += 5; *dci_pdu |= ((uint64_t)dci_pdu_rel15->mcs & 0x1f) << (dci_size - pos); #ifdef DEBUG_FILL_DCI - LOG_I(MAC, "mcs %d (5 bits)=> %d (0x%lx)\n", dci_pdu_rel15->mcs, dci_size - pos, *dci_pdu); + LOG_I(NR_MAC, "mcs %d (5 bits)=> %d (0x%lx)\n", dci_pdu_rel15->mcs, dci_size - pos, *dci_pdu); #endif // TB scaling pos += 2; *dci_pdu |= ((uint64_t)dci_pdu_rel15->tb_scaling & 0x3) << (dci_size - pos); #ifdef DEBUG_FILL_DCI - LOG_I(MAC, "tb_scaling %d (2 bits)=> %d (0x%lx)\n", dci_pdu_rel15->tb_scaling, dci_size - pos, *dci_pdu); + LOG_I(NR_MAC, "tb_scaling %d (2 bits)=> %d (0x%lx)\n", dci_pdu_rel15->tb_scaling, dci_size - pos, *dci_pdu); #endif break; case NR_RNTI_C: // indicating a DL DCI format 1bit pos++; - *dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos); - LOG_D(MAC, + *dci_pdu |= ((uint64_t)1) << (dci_size - pos); + LOG_D(NR_MAC, "Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n", dci_pdu_rel15->format_indicator, 1, @@ -988,7 +1046,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1)); pos += fsize; *dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val & ((1 << fsize) - 1)) << (dci_size - pos)); - LOG_D(MAC, + LOG_D(NR_MAC, "Freq domain assignment %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->frequency_domain_assignment.val, fsize, @@ -1018,7 +1076,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // Time domain assignment 4bit pos += 4; *dci_pdu |= ((dci_pdu_rel15->time_domain_assignment.val & 0xf) << (dci_size - pos)); - LOG_D(MAC, + LOG_D(NR_MAC, "Time domain assignment %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->time_domain_assignment.val, 4, @@ -1027,7 +1085,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // VRB to PRB mapping 1bit pos++; *dci_pdu |= (dci_pdu_rel15->vrb_to_prb_mapping.val & 1) << (dci_size - pos); - LOG_D(MAC, + LOG_D(NR_MAC, "VRB to PRB %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->vrb_to_prb_mapping.val, 1, @@ -1036,31 +1094,31 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // MCS 5bit //bit over 32, so dci_pdu ++ pos += 5; *dci_pdu |= (dci_pdu_rel15->mcs & 0x1f) << (dci_size - pos); - LOG_D(MAC, "MCS %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->mcs, 5, dci_size - pos, *dci_pdu); + LOG_D(NR_MAC, "MCS %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->mcs, 5, dci_size - pos, *dci_pdu); // New data indicator 1bit pos++; *dci_pdu |= (dci_pdu_rel15->ndi & 1) << (dci_size - pos); - LOG_D(MAC, "NDI %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->ndi, 1, dci_size - pos, *dci_pdu); + LOG_D(NR_MAC, "NDI %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->ndi, 1, dci_size - pos, *dci_pdu); // Redundancy version 2bit pos += 2; *dci_pdu |= (dci_pdu_rel15->rv & 0x3) << (dci_size - pos); - LOG_D(MAC, "RV %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->rv, 2, dci_size - pos, *dci_pdu); + LOG_D(NR_MAC, "RV %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->rv, 2, dci_size - pos, *dci_pdu); // HARQ process number 4bit pos += 4; *dci_pdu |= ((dci_pdu_rel15->harq_pid & 0xf) << (dci_size - pos)); - LOG_D(MAC, "HARQ_PID %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->harq_pid, 4, dci_size - pos, *dci_pdu); + LOG_D(NR_MAC, "HARQ_PID %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->harq_pid, 4, dci_size - pos, *dci_pdu); // Downlink assignment index 2bit pos += 2; *dci_pdu |= ((dci_pdu_rel15->dai[0].val & 3) << (dci_size - pos)); - LOG_D(MAC, "DAI %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->dai[0].val, 2, dci_size - pos, *dci_pdu); + LOG_D(NR_MAC, "DAI %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->dai[0].val, 2, dci_size - pos, *dci_pdu); // TPC command for scheduled PUCCH 2bit pos += 2; *dci_pdu |= ((dci_pdu_rel15->tpc & 3) << (dci_size - pos)); - LOG_D(MAC, "TPC %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->tpc, 2, dci_size - pos, *dci_pdu); + LOG_D(NR_MAC, "TPC %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->tpc, 2, dci_size - pos, *dci_pdu); // PUCCH resource indicator 3bit pos += 3; *dci_pdu |= ((dci_pdu_rel15->pucch_resource_indicator & 0x7) << (dci_size - pos)); - LOG_D(MAC, + LOG_D(NR_MAC, "PUCCH RI %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->pucch_resource_indicator, 3, @@ -1069,7 +1127,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // PDSCH-to-HARQ_feedback timing indicator 3bit pos += 3; *dci_pdu |= ((dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val & 0x7) << (dci_size - pos)); - LOG_D(MAC, + LOG_D(NR_MAC, "PDSCH to HARQ TI %d (%d bits)=> %d (0x%lx)\n", dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val, 3, @@ -1131,8 +1189,9 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, break; case NR_RNTI_TC: + pos = 1; // indicating a DL DCI format 1bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos++); + *dci_pdu |= ((uint64_t)1) << (dci_size - pos++); // Freq domain assignment 0-16 bit fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1)); for (int i = 0; i < fsize; i++) @@ -1159,9 +1218,27 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // TPC command for scheduled PUCCH – 2 bits for (int i = 0; i < 2; i++) *dci_pdu |= (((uint64_t)dci_pdu_rel15->tpc >> (1 - i)) & 1) << (dci_size - pos++); + // PUCCH resource indicator – 3 bits + for (int i = 0; i < 3; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->pucch_resource_indicator >> (2 - i)) & 1) << (dci_size - pos++); // PDSCH-to-HARQ_feedback timing indicator – 3 bits for (int i = 0; i < 3; i++) *dci_pdu |= (((uint64_t)dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val >> (2 - i)) & 1) << (dci_size - pos++); + + LOG_D(NR_MAC,"N_RB = %i\n", N_RB); + LOG_D(NR_MAC,"dci_size = %i\n", dci_size); + LOG_D(NR_MAC,"fsize = %i\n", fsize); + LOG_D(NR_MAC,"dci_pdu_rel15->format_indicator = %i\n", dci_pdu_rel15->format_indicator); + LOG_D(NR_MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(NR_MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(NR_MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(NR_MAC,"dci_pdu_rel15->harq_pid = %i\n", dci_pdu_rel15->harq_pid); + LOG_D(NR_MAC,"dci_pdu_rel15->dai[0].val = %i\n", dci_pdu_rel15->dai[0].val); + LOG_D(NR_MAC,"dci_pdu_rel15->tpc = %i\n", dci_pdu_rel15->tpc); + LOG_D(NR_MAC,"dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = %i\n", dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val); + break; } break; @@ -1169,31 +1246,34 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, case NR_UL_DCI_FORMAT_0_0: switch (rnti_type) { case NR_RNTI_C: - // indicating a DL DCI format 1bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos++); + // indicating a UL DCI format 1bit + pos=1; + //*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos); // Freq domain assignment max 16 bit fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1)); - for (int i = 0; i < fsize; i++) - *dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment.val >> (fsize - i - 1)) & 1) << (dci_size - pos++); + pos+=fsize; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val & ((1 << fsize) - 1)) << (dci_size - pos); // Time domain assignment 4bit - for (int i = 0; i < 4; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val >> (3 - i)) & 1) << (dci_size - pos++); + pos += 4; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->time_domain_assignment.val & ((1 << 4) - 1)) << (dci_size - pos); // Frequency hopping flag – 1 bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag.val & 1) << (dci_size - pos++); + pos++; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag.val & 1) << (dci_size - pos); // MCS 5 bit - for (int i = 0; i < 5; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs >> (4 - i)) & 1) << (dci_size - pos++); + pos+=5; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->mcs & 0x1f) << (dci_size - pos); // New data indicator 1bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->ndi & 1) << (dci_size - pos++); + pos++; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->ndi & 1) << (dci_size - pos); // Redundancy version 2bit - for (int i = 0; i < 2; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->rv >> (1 - i)) & 1) << (dci_size - pos++); + pos+=2; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->rv & 0x3) << (dci_size - pos); // HARQ process number 4bit - for (int i = 0; i < 4; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->harq_pid >> (3 - i)) & 1) << (dci_size - pos++); + pos+=4; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->harq_pid & 0xf) << (dci_size - pos); // TPC command for scheduled PUSCH – 2 bits - for (int i = 0; i < 2; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->tpc >> (1 - i)) & 1) << (dci_size - pos++); + pos+=2; + *dci_pdu |= ((uint64_t)dci_pdu_rel15->tpc & 0x3) << (dci_size - pos); // Padding bits for (int a = pos; a < 32; a++) *dci_pdu |= ((uint64_t)dci_pdu_rel15->padding & 1) << (dci_size - pos++); @@ -1406,7 +1486,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, pos += 1; *dci_pdu |= ((uint64_t)dci_pdu_rel15->dmrs_sequence_initialization.val & 0x1) << (dci_size - pos); } - LOG_D(MAC, "DCI has %d bits and the payload is %lx\n", dci_size, *dci_pdu); + LOG_D(NR_MAC, "DCI has %d bits and the payload is %lx\n", dci_size, *dci_pdu); } int get_spf(nfapi_nr_config_request_scf_t *cfg) { @@ -1445,7 +1525,7 @@ int extract_length(int startSymbolAndLength) { void dump_nr_list(NR_list_t *listP) { for (int j = listP->head; j >= 0; j = listP->next[j]) - LOG_T(MAC, "NR list node %d => %d\n", j, listP->next[j]); + LOG_T(NR_MAC, "NR list node %d => %d\n", j, listP->next[j]); } /* @@ -1581,7 +1661,7 @@ int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) { RA_t *ra = (RA_t *) &RC.nrmac[mod_idP]->common_channels[CC_idP].ra[0]; for (RA_id = 0; RA_id < NB_RA_PROC_MAX; RA_id++) { - LOG_D(MAC, "Checking RA_id %d for %x : state %d\n", + LOG_D(NR_MAC, "Checking RA_id %d for %x : state %d\n", RA_id, rntiP, ra[RA_id].state); @@ -1614,58 +1694,65 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces } //------------------------------------------------------------------------------ -int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secondaryCellGroup) +int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup) { NR_UE_info_t *UE_info = &RC.nrmac[mod_idP]->UE_info; - LOG_I(MAC, "[gNB %d] Adding UE with rnti %x (num_UEs %d)\n", + LOG_I(NR_MAC, "[gNB %d] Adding UE with rnti %x (num_UEs %d)\n", mod_idP, rntiP, UE_info->num_UEs); dump_nr_list(&UE_info->list); for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) { - if (UE_info->active[i]) + if (UE_info->active[i]) { + LOG_I(NR_MAC,"UE %x is active, skipping\n",rntiP); continue; - + } int UE_id = i; UE_info->num_UEs++; UE_info->active[UE_id] = true; + if (CellGroup) UE_info->Msg4_ACKed[UE_id] = true; + else UE_info->Msg4_ACKed[UE_id] = false; UE_info->rnti[UE_id] = rntiP; - UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; + UE_info->CellGroup[UE_id] = CellGroup; add_nr_list(&UE_info->list, UE_id); memset(&UE_info->mac_stats[UE_id], 0, sizeof(NR_mac_stats_t)); set_Y(UE_info->Y[UE_id], rntiP); - compute_csi_bitlen(secondaryCellGroup, UE_info, UE_id); + if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) + compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; sched_ctrl->ul_rssi = 0; + sched_ctrl->pucch_consecutive_dtx_cnt = 0; + sched_ctrl->pusch_consecutive_dtx_cnt = 0; + sched_ctrl->ul_failure = 0; /* set illegal time domain allocation to force recomputation of all fields */ sched_ctrl->pusch_save.time_domain_allocation = -1; - const NR_ServingCellConfig_t *servingCellConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated; + const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL; /* Set default BWPs */ - const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList; - AssertFatal(bwpList->list.count == 1, - "downlinkBWP_ToAddModList has %d BWP!\n", - bwpList->list.count); + const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig ? servingCellConfig->downlinkBWP_ToAddModList : NULL; + if (bwpList) AssertFatal(bwpList->list.count == 1, + "downlinkBWP_ToAddModList has %d BWP!\n", + bwpList->list.count); const int bwp_id = 1; - sched_ctrl->active_bwp = bwpList->list.array[bwp_id - 1]; - const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList; - AssertFatal(ubwpList->list.count == 1, - "uplinkBWP_ToAddModList has %d BWP!\n", - ubwpList->list.count); - sched_ctrl->active_ubwp = ubwpList->list.array[bwp_id - 1]; + sched_ctrl->active_bwp = bwpList ? bwpList->list.array[bwp_id - 1] : NULL; + const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig ? servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList : NULL; + if (ubwpList) AssertFatal(ubwpList->list.count == 1, + "uplinkBWP_ToAddModList has %d BWP!\n", + ubwpList->list.count); + sched_ctrl->active_ubwp = ubwpList ? ubwpList->list.array[bwp_id - 1] : NULL; /* get Number of HARQ processes for this UE */ - AssertFatal(servingCellConfig->pdsch_ServingCellConfig->present == NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup, - "no pdsch-ServingCellConfig found for UE %d\n", - UE_id); - const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig->pdsch_ServingCellConfig->choice.setup; - const int nrofHARQ = pdsch->nrofHARQ_ProcessesForPDSCH ? - get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8; + if (servingCellConfig) AssertFatal(servingCellConfig->pdsch_ServingCellConfig->present == NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup, + "no pdsch-ServingCellConfig found for UE %d\n", + UE_id); + const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL; + const int nrofHARQ = pdsch ? (pdsch->nrofHARQ_ProcessesForPDSCH ? + get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8) : 8; // add all available DL HARQ processes for this UE create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ); for (int harq = 0; harq < nrofHARQ; harq++) @@ -1679,7 +1766,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); create_nr_list(&sched_ctrl->feedback_ul_harq, 16); create_nr_list(&sched_ctrl->retrans_ul_harq, 16); - LOG_I(MAC, "gNB %d] Add NR UE_id %d : rnti %x\n", + LOG_I(NR_MAC, "[gNB %d] Add NR UE_id %d : rnti %x\n", mod_idP, UE_id, rntiP); @@ -1688,7 +1775,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon } // printf("MAC: cannot add new UE for rnti %x\n", rntiP); - LOG_E(MAC, "error in add_new_ue(), could not find space in UE_info, Dumping UE list\n"); + LOG_E(NR_MAC, "error in add_new_ue(), could not find space in UE_info, Dumping UE list\n"); dump_nr_list(&UE_info->list); return -1; } @@ -1702,6 +1789,7 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti) { int UE_id; int i; + int cc_id; NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; for (i = 0; i < MAX_MOBILES_PER_GNB; i++) { @@ -1725,7 +1813,7 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti) destroy_nr_list(&sched_ctrl->available_ul_harq); destroy_nr_list(&sched_ctrl->feedback_ul_harq); destroy_nr_list(&sched_ctrl->retrans_ul_harq); - LOG_I(MAC, "[gNB %d] Remove NR UE_id %d : rnti %x\n", + LOG_I(NR_MAC, "[gNB %d] Remove NR UE_id %d : rnti %x\n", mod_id, UE_id, rnti); @@ -1734,16 +1822,41 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti) if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); if (rnti_to_remove_count == 10) exit(1); rnti_to_remove[rnti_to_remove_count] = rnti; - LOG_W(MAC, "to remove in mac rnti_to_remove[%d]=%d\n", rnti_to_remove_count, rnti); + LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti); rnti_to_remove_count++; if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); } + + /* clear RA process(es?) associated to the UE */ + for (cc_id = 0; cc_id < NFAPI_CC_MAX; cc_id++) { + NR_COMMON_channels_t *cc = &RC.nrmac[mod_id]->common_channels[cc_id]; + for (i = 0; i < NR_NB_RA_PROC_MAX; i++) { + if (cc->ra[i].rnti == rnti) { + LOG_D(NR_MAC, "free RA process %d for rnti %d\n", i, rnti); + /* is it enough? */ + cc->ra[i].cfra = false; + cc->ra[i].rnti = 0; + cc->ra[i].crnti = 0; + } + } + } +} + +void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti) { + // Hack to remove UE in the phy (following the same procedure as in function mac_remove_nr_ue) + if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); + if (rnti_to_remove_count == 10) exit(1); + rnti_to_remove[rnti_to_remove_count] = rnti; + LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti); + rnti_to_remove_count++; + if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); } uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) { // al values passed to this function are x10 int snrx10 = (cqi*5) - 640; + LOG_D(NR_MAC,"tpc : target %d, snrx10 %d\n",target,snrx10); if (snrx10 > target + incr) return 0; // decrease 1dB if (snrx10 < target - incr) return 2; // increase 1dB if (snrx10 < target - (3*incr)) return 3; // increase 3dB @@ -1758,9 +1871,14 @@ void get_pdsch_to_harq_feedback(int Mod_idP, int bwp_id=1; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; - NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; + NR_BWP_Downlink_t *bwp=NULL; + NR_BWP_Uplink_t *ubwp=NULL; + + if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) + bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) + ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; NR_SearchSpace_t *ss; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 629b4dc7b065972f9923fb2d5d66b98b3b82efac..b94dcced6e0e9529d071cc12d22ad1ce63848554 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -72,14 +72,52 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; nr_configure_pucch(pucch_pdu, scc, + UE_info->CellGroup[UE_id], UE_info->UE_sched_ctrl[UE_id].active_ubwp, UE_info->rnti[UE_id], pucch->resource_indicator, pucch->csi_bits, pucch->dai_c, - pucch->sr_flag); + pucch->sr_flag, + pucch->r_pucch); } +#define MIN_RSRP_VALUE -141 +#define MAX_NUM_SSB 128 +#define MAX_SSB_SCHED 8 +#define L1_RSRP_HYSTERIS 10 //considering 10 dBm as hysterisis for avoiding frequent SSB Beam Switching. !Fixme provide exact value if any +//#define L1_DIFF_RSRP_STEP_SIZE 2 + +int ssb_index_sorted[MAX_NUM_SSB] = {0}; +int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; + +//Measured RSRP Values Table 10.1.16.1-1 from 36.133 +//Stored all the upper limits[Max RSRP Value of corresponding index] +//stored -1 for invalid values +int L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[128] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //0 - 9 + -1, -1, -1, -1, -1, -1, -140, -139, -138, -137, //10 - 19 + -136, -135, -134, -133, -132, -131, -130, -129, -128, -127, //20 - 29 + -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, //30 - 39 + -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, //40 - 49 + -106, -105, -104, -103, -102, -101, -100, -99, -98, -97, //50 - 59 + -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, //60 - 69 + -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, //70 - 79 + -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, //80 - 89 + -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, //90 - 99 + -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, //100 - 109 + -46, -45, -44, -44, -1, -1, -1, -1, -1, -1, //110 - 119 + -1, -1, -1, -1, -1, -1, -1, -1//120 - 127 + }; + +//Differential RSRP values Table 10.1.6.1-2 from 36.133 +//Stored the upper limits[MAX RSRP Value] +int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = { + 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, //0 - 9 + -20, -22, -24, -26, -28, -30 //10 - 15 +}; + + void nr_schedule_pucch(int Mod_idP, frame_t frameP, sub_frame_t slotP) { @@ -98,7 +136,7 @@ void nr_schedule_pucch(int Mod_idP, || frameP != curr_pucch->frame || slotP != curr_pucch->ul_slot) continue; - + LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack); nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id); memset(curr_pucch, 0, sizeof(*curr_pucch)); } @@ -106,74 +144,293 @@ void nr_schedule_pucch(int Mod_idP, } +//! Calculating number of bits set +uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ + uint8_t nb_of_bits_set = 0; + uint8_t mask = 0xff; + uint8_t index = 0; + + for (index=7; (buf & mask) && (index>=0) ; index--){ + if (buf & (1<<index)) + nb_of_bits_set++; + + mask>>=1; + } + *max_ri = 8-index; + return nb_of_bits_set; +} + + //!TODO : same function can be written to handle csi_resources -void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t *UE_info, int UE_id) { +void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP){ uint8_t csi_report_id = 0; uint8_t csi_resourceidx =0; uint8_t csi_ssb_idx =0; - - NR_CSI_MeasConfig_t *csi_MeasConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ - csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; - UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; + nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id]; + csi_ResourceConfigId=csi_reportconfig->resourcesForChannelMeasurement; + reportQuantity_type = csi_reportconfig->reportQuantity.present; + csi_report->reportQuantity_type = reportQuantity_type; for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) - continue; + struct NR_CSI_ResourceConfig *csi_resourceconfig = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]; + if ( csi_resourceconfig->csi_ResourceConfigId != csi_ResourceConfigId) + continue; else { - //Finding the CSI_RS or SSB Resources - UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; - if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; - - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; + uint8_t nb_ssb_resources =0; + //Finding the CSI_RS or SSB Resources + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { + + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_reportconfig->groupBasedBeamReporting.present) { + if (NULL != csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + csi_report->CSI_report_bitlen.nb_ssbri_cri = *(csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + else + /*! From Spec 38.331 + * nrofReportedRS + * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE + * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + * When the field is absent the UE applies the value 1 + */ + csi_report->CSI_report_bitlen.nb_ssbri_cri= 1; + }else + csi_report->CSI_report_bitlen.nb_ssbri_cri= 2; + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == csi_report->reportQuantity_type) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ + + ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + csi_report->SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; + csi_report->CSI_Index_list = NULL; + break; + } + } + } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { + + ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + csi_report->SSB_Index_list = NULL; + break; + } + } + } + + if (nb_ssb_resources) { + csi_report->CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + csi_report->CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + csi_report->CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + } else { + csi_report->CSI_report_bitlen.cri_ssbri_bitlen =0; + csi_report->CSI_report_bitlen.rsrp_bitlen = 0; + csi_report->CSI_report_bitlen.diff_rsrp_bitlen =0; + } + + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", + csi_report->CSI_report_bitlen.cri_ssbri_bitlen, + csi_report->CSI_report_bitlen.rsrp_bitlen, + csi_report->CSI_report_bitlen.diff_rsrp_bitlen); } - if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report){ - uint8_t nb_ssb_resources =0; + uint8_t ri_restriction; + uint8_t ri_bitlen; + uint8_t nb_allowed_ri; + uint8_t max_ri; + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type|| + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1==reportQuantity_type){ + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { - ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { - if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { + ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + csi_report->SSB_Index_list = NULL; + } + break; + } + csi_report->csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); + + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { + case 1:; + csi_report->csi_meas_bitlen.ri_bitlen=0; + break; + case 2: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_reportconfig->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 4: + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_reportconfig->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 6: + case 8: + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_reportconfig->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + default: + AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); + } + } + csi_report->csi_meas_bitlen.li_bitlen=0; + csi_report->csi_meas_bitlen.cqi_bitlen=0; + csi_report->csi_meas_bitlen.pmi_x1_bitlen=0; + csi_report->csi_meas_bitlen.pmi_x2_bitlen=0; + } + + if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { + case 1:; + csi_report->csi_meas_bitlen.li_bitlen=0; + break; + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted + // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. + csi_report->csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; + break; + default: + AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); + } + } + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ + + switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value){ + case 1: + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + + if (max_ri > 4 && max_ri < 8){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) + csi_report->csi_meas_bitlen.cqi_bitlen = 8; + else + csi_report->csi_meas_bitlen.cqi_bitlen = 4; + } + }else{ //This condition will work even for type1-multipanel. + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) + csi_report->csi_meas_bitlen.cqi_bitlen = 4; else - /*! From Spec 38.331 - * nrofReportedRS - * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE - * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. - * When the field is absent the UE applies the value 1 - */ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; - } else - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; - - nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - if (nb_ssb_resources){ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } - else{ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + csi_report->csi_meas_bitlen.cqi_bitlen = 2; } - - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); - break ; + break; + default: + AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); + } + } + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ + switch (csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: + if (max_ri ==1) + csi_report->csi_meas_bitlen.pmi_x1_bitlen = 2; + else if (max_ri ==2) + csi_report->csi_meas_bitlen.pmi_x1_bitlen = 1; + break; + default: + AssertFatal(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, + "Not handled Yet %d", csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); + break; } } } - if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report) - AssertFatal(1==0,"Currently configuring only SSB beamreporting."); break; } } @@ -181,12 +438,27 @@ void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t } -uint16_t nr_get_csi_bitlen(const nr_csi_report_t *csi_report) -{ - const CRI_SSBRI_RSRP_bitlen_t *bitlen = &csi_report->CSI_report_bitlen[0]; - return bitlen->cri_ssbri_bitlen * bitlen->nb_ssbri_cri - + bitlen->rsrp_bitlen - + bitlen->diff_rsrp_bitlen * (bitlen->nb_ssbri_cri - 1) * csi_report->nb_of_csi_ssb_report; +uint16_t nr_get_csi_bitlen(int Mod_idP, + int UE_id, + uint8_t csi_report_id) { + + uint16_t csi_bitlen =0; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + L1_RSRP_bitlen_t * CSI_report_bitlen = NULL; + CSI_Meas_bitlen_t * csi_meas_bitlen = NULL; + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP==UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type|| + NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP==UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type){ + CSI_report_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements + csi_bitlen+= ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + + CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * + (CSI_report_bitlen->nb_ssbri_cri -1 ))); + } else{ + csi_meas_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements + csi_bitlen+= (csi_meas_bitlen->cri_bitlen +csi_meas_bitlen->ri_bitlen+csi_meas_bitlen->li_bitlen+csi_meas_bitlen->cqi_bitlen+csi_meas_bitlen->pmi_x1_bitlen+csi_meas_bitlen->pmi_x2_bitlen); + } + + return csi_bitlen; } @@ -201,9 +473,11 @@ void nr_csi_meas_reporting(int Mod_idP, NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; NR_list_t *UE_list = &UE_info->list; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { - const NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; + const NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - const NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated || + !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig) continue; + const NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; AssertFatal(csi_measconfig->csi_ReportConfigToAddModList->list.count > 0, "NO CSI report configuration available"); NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; @@ -244,7 +518,7 @@ void nr_csi_meas_reporting(int Mod_idP, curr_pucch->ul_slot = sched_slot; curr_pucch->resource_indicator = res_index; curr_pucch->csi_bits += - nr_get_csi_bitlen(&UE_info->csi_report_template[UE_id][csi_report_id]); + nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); // going through the list of PUCCH resources to find the one indexed by resource_id uint16_t *vrb_map_UL = &RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; @@ -299,7 +573,9 @@ static void handle_dl_harq(module_id_t mod_id, add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; - } else if (harq->round == MAX_HARQ_ROUNDS) { + } else { + harq->round++; + if (harq->round == MAX_HARQ_ROUNDS) { add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; @@ -308,8 +584,377 @@ static void handle_dl_harq(module_id_t mod_id, LOG_D(MAC, "retransmission error for UE %d (total %d)\n", UE_id, stats->dlsch_errors); } else { add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid); - harq->round++; + } + } +} + +int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id] ; + int nb_tci_states = CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + int i; + + for(i=0; i<nb_tci_states && i<64; i++) { + tci = (NR_TCI_State_t *)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; + + if(tci != NULL) { + if(tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID + } + // if type2 is configured + else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type2->referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID + } else LOG_I(MAC,"SSB index is not found in first 64 TCI states of TCI_statestoAddModList[%d]", i); + } + } + + // tci state not identified in first 64 TCI States of PDSCH Config + return -1; +} + +int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id] ; + int nb_tci_states = CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + NR_TCI_StateId_t *tci_id = NULL; + int bwp_id = 1; + NR_BWP_Downlink_t *bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]; + int i; + int flag = 0; + int tci_stateID = -1; + + for(i=0; i<nb_tci_states && i<128; i++) { + tci = (NR_TCI_State_t *)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; + + if(tci != NULL && tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; + } else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; + } + } + + if(flag != 0 && tci_stateID != -1 && coreset != NULL) { + for(i=0; i<64 && i<coreset->tci_StatesPDCCH_ToAddList->list.count; i++) { + tci_id = coreset->tci_StatesPDCCH_ToAddList->list.array[i]; + + if(tci_id != NULL && *tci_id == tci_stateID) + return tci_stateID; + } + } + } + + // Need to implement once configuration is received + return -1; +} + +//returns the measured RSRP value (upper limit) +int get_measured_rsrp(uint8_t index) { + //if index is invalid returning minimum rsrp -140 + if(index <= 15 || index >= 114) + return MIN_RSRP_VALUE; + + return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; +} + +//returns the differential RSRP value (upper limit) +int get_diff_rsrp(uint8_t index, int strongest_rsrp) { + if(strongest_rsrp != -1) { + return strongest_rsrp + diff_rsrp_ssb_csi_meas_10_1_6_1_2[index]; + } else + return MIN_RSRP_VALUE; +} + +//identifies the target SSB Beam index +//keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally +//handles triggering of PDCCH and PDSCH MAC CEs +void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { + + int strongest_ssb_rsrp = 0; + int cqi_idx = 0; + int curr_ssb_beam_index = 0; //ToDo: yet to know how to identify the serving ssb beam index + uint8_t target_ssb_beam_index = curr_ssb_beam_index; + uint8_t is_triggering_ssb_beam_switch =0; + uint8_t ssb_idx = 0; + int pdsch_bwp_id =0; + int ssb_index[MAX_NUM_SSB] = {0}; + int ssb_rsrp[MAX_NUM_SSB] = {0}; + uint8_t idx = 0; + int bwp_id = 1; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; + NR_BWP_Downlink_t *bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + //bwp indicator + int n_dl_bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; + uint8_t nr_ssbri_cri = 0; + uint8_t nb_of_csi_ssb_report = UE_info->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; + int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially + uint8_t diff_rsrp_idx = 0; + uint8_t i, j; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; + + if (n_dl_bwp < 4) + pdsch_bwp_id = bwp_id; + else + pdsch_bwp_id = bwp_id - 1; // as per table 7.3.1.1.2-1 in 38.212 + + /*Example: + CRI_SSBRI: 1 2 3 4| 5 6 7 8| 9 10 1 2| + nb_of_csi_ssb_report = 3 //3 sets as above + nr_ssbri_cri = 4 //each set has 4 elements + storing ssb indexes in ssb_index array as ssb_index[0] = 1 .. ssb_index[4] = 5 + ssb_rsrp[0] = strongest rsrp in first set, ssb_rsrp[4] = strongest rsrp in second set, .. + idx: resource set index + */ + + //for all reported SSB + for (idx = 0; idx < nb_of_csi_ssb_report; idx++) { + nr_ssbri_cri = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; + //extracting the ssb indexes + for (ssb_idx = 0; ssb_idx < nr_ssbri_cri; ssb_idx++) { + ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + } + + //if strongest measured RSRP is configured + strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + // including ssb rsrp in mac stats + stats->cumul_rsrp += strongest_ssb_rsrp; + stats->num_rsrp_meas++; + ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; + LOG_D(MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); + + //if current ssb rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report; + } + + for(diff_rsrp_idx =1; diff_rsrp_idx < nr_ssbri_cri; diff_rsrp_idx++) { + ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx-1], strongest_ssb_rsrp); + + //if current reported rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report + diff_rsrp_idx; + } + } + } + + + if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { + if( ssb_rsrp[target_ssb_beam_index] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + is_triggering_ssb_beam_switch = 1; + LOG_D(MAC, "Triggering ssb beam switching using tci\n"); + } } + + if(is_triggering_ssb_beam_switch) { + //filling pdcch tci state activativation mac ce structure fields + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 1; + //OAI currently focusing on Non CA usecase hence 0 is considered as serving + //cell id + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.servingCellId = 0; //0 for PCell as 38.331 v15.9.0 page 353 //serving cell id for which this MAC CE applies + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId = 0; //coreset id for which the TCI State id is being indicated + + /* 38.321 v15.8.0 page 66 + TCI State ID: This field indicates the TCI state identified by TCI-StateId as specified in TS 38.331 [5] applicable + to the Control Resource Set identified by CORESET ID field. + If the field of CORESET ID is set to 0, + this field indicates a TCI-StateId for a TCI state of the first 64 TCI-states configured by tci-States-ToAddModList and tciStates-ToReleaseList in the PDSCH-Config in the active BWP. + If the field of CORESET ID is set to the other value than 0, + this field indicates a TCI-StateId configured by tci-StatesPDCCH-ToAddList and tciStatesPDCCH-ToReleaseList in the controlResourceSet identified by the indicated CORESET ID. + The length of the field is 7 bits + */ + if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId == 0) { + int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); + + if( tci_state_id != -1) + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + else { + //identify the best beam within first 64 TCI States of PDSCH + //Config TCI-states-to-addModList + int flag = 0; + + for(i =0; ssb_index_sorted[i]!=0; i++) { + tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i], Mod_idP, UE_id) ; + + if(tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + flag = 1; + break; + } + } + + if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; + } + } + } else { + int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); + + if (tci_state_id !=-1) + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + else { + //identify the best beam within CORESET/PDCCH + ////Config TCI-states-to-addModList + int flag = 0; + + for(i =0; ssb_index_sorted[i]!=0; i++) { + tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i], Mod_idP, UE_id); + + if( tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + flag = 1; + break; + } + } + + if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; + } + } + } + + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI; + + //filling pdsch tci state activation deactivation mac ce structure fields + if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.is_scheduled = 1; + /* + Serving Cell ID: This field indicates the identity of the Serving Cell for which the MAC CE applies + Considering only PCell exists. Serving cell index of PCell is always 0, hence configuring 0 + */ + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.servingCellId = 0; + /* + BWP ID: This field indicates a DL BWP for which the MAC CE applies as the codepoint of the DCI bandwidth + part indicator field as specified in TS 38.212 + */ + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.bwpId = pdsch_bwp_id; + + /* + * TODO ssb_rsrp_sort() API yet to code to find 8 best beams, rrc configuration + * is required + */ + for(i = 0; i<8; i++) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i] = i; + } + + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.highestTciStateActivated = 8; + + for(i = 0, j =0; i<MAX_TCI_STATES; i++) { + if(sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i]) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.codepoint[j] = i; + j++; + } + } + }//tci_presentInDCI + }//is-triggering_beam_switch +}//tci handling + +void reverse_n_bits(uint8_t *value, uint16_t bitlen) { + uint16_t j; + uint8_t i; + for(j = bitlen - 1,i = 0; j > i; j--, i++) { + if(((*value>>j)&1) != ((*value>>i)&1)) { + *value ^= (1<<j); + *value ^= (1<<i); + } + } +} + +void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + frame_t frame, + slot_t slot, + int UE_id, + module_id_t Mod_idP) { + + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + uint8_t idx = 0; + uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); + uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; + NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + uint8_t csi_report_id = 0; + + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; + for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { + //Has to implement according to reportSlotConfig type + /*reportQuantity must be considered according to the current scheduled + CSI-ReportConfig if multiple CSI-ReportConfigs present*/ + reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + LOG_D(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { + uint8_t csi_ssb_idx = 0; + uint8_t diff_rsrp_idx = 0; + uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; + + /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ + + /** from 38.214 sec 5.2.1.4.2 + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is + not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting + + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not + required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter + */ + + idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; + + for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { + if(cri_ssbri_bitlen > 1) + reverse_n_bits(payload, cri_ssbri_bitlen); + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + else + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + + *payload >>= cri_ssbri_bitlen; + LOG_D(PHY,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + } + + reverse_n_bits(payload, 7); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; + + for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + reverse_n_bits(payload,4); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; + *payload >>= 4; + } + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + LOG_D(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + } + } + + if ( !(reportQuantity_type)) + AssertFatal(reportQuantity_type, "reportQuantity is not configured"); + } void handle_nr_uci_pucch_0_1(module_id_t mod_id, @@ -326,10 +971,11 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // tpc (power control) - sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, - uci_01->ul_cqi, - 30); - + if (uci_01->harq->harq_confidence_level == 0) + sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, + uci_01->ul_cqi, + 30); + LOG_I(NR_MAC,"pucch tpc %d\n",sched_ctrl->tpc1); NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; if (((uci_01->pduBitmap >> 1) & 0x01)) { @@ -337,7 +983,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; + const int feedback_slot = (slot + num_slots) % num_slots; /* In case of realtime problems: we can only identify a HARQ process by * timing. If the HARQ process's feedback_slot is not the one we * expected, we assume that processing has been aborted and we need to @@ -374,6 +1020,12 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti); return; } + AssertFatal(RC.nrmac[mod_id]->UE_info.CellGroup[UE_id],"Cellgroup is null for UE %d/%x\n",UE_id,uci_234->rnti); + AssertFatal(RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig, "Cellgroup->spCellConfig is null for UE %d/%x\n",UE_id,uci_234->rnti); + AssertFatal(RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated, "Cellgroup->spCellConfig->spCellConfigDedicated is null for UE %d/%x\n",UE_id,uci_234->rnti); + if ( RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig==NULL) return; + + NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; @@ -388,7 +1040,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, // iterate over received harq bits for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { const int acknack = ((uci_234->harq.harq_payload[harq_bit >> 3]) >> harq_bit) & 0x01; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; + const int feedback_slot = (slot + num_slots) % num_slots; /* In case of realtime problems: we can only identify a HARQ process by * timing. If the HARQ process's feedback_slot is not the one we * expected, we assume that processing has been aborted and we need to @@ -413,6 +1065,15 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); } } + if ((uci_234->pduBitmap >> 2) & 0x01) { + //API to parse the csi report and store it into sched_ctrl + extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); + //TCI handling function + tci_handling(mod_id, UE_id,frame, slot); + } + if ((uci_234->pduBitmap >> 3) & 0x01) { + //@TODO:Handle CSI Report 2 + } } @@ -420,7 +1081,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, bool nr_acknack_scheduling(int mod_id, int UE_id, frame_t frame, - sub_frame_t slot) + sub_frame_t slot, + int r_pucch) { const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; @@ -448,6 +1110,7 @@ bool nr_acknack_scheduling(int mod_id, * resources by index, and not by their ID! */ NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; + pucch->r_pucch=r_pucch; AssertFatal(pucch->csi_bits == 0, "%s(): csi_bits %d in sched_pucch[0]\n", __func__, @@ -468,8 +1131,9 @@ bool nr_acknack_scheduling(int mod_id, pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; pucch->ul_slot = (s + 1) % n_slots_frame; // we assume that only two indices over the array sched_pucch exist - const NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[2]; + NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[2]; // skip the CSI PUCCH if it is present and if in the next frame/slot + csi_pucch->r_pucch=-1; if (csi_pucch->csi_bits > 0 && csi_pucch->frame == pucch->frame && csi_pucch->ul_slot == pucch->ul_slot) { @@ -485,6 +1149,7 @@ bool nr_acknack_scheduling(int mod_id, } } + LOG_I(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot); /* if the UE's next PUCCH occasion is after the possible UL slots (within the * same frame) or wrapped around to the next frame, then we assume there is * no possible PUCCH allocation anymore */ @@ -493,8 +1158,9 @@ bool nr_acknack_scheduling(int mod_id, || (pucch->frame == frame + 1)) return false; - // this is hardcoded for now as ue specific - NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + // this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP + NR_SearchSpace__searchSpaceType_PR ss_type = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific: NR_SearchSpace__searchSpaceType_PR_common; + ; uint8_t pdsch_to_harq_feedback[8]; get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback); @@ -520,7 +1186,7 @@ bool nr_acknack_scheduling(int mod_id, memset(pucch, 0, sizeof(*pucch)); pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; pucch->ul_slot = (s + 1) % n_slots_frame; - return nr_acknack_scheduling(mod_id, UE_id, frame, slot); + return nr_acknack_scheduling(mod_id, UE_id, frame, slot,pucch->r_pucch); } pucch->timing_indicator = i; @@ -531,11 +1197,27 @@ bool nr_acknack_scheduling(int mod_id, /* we need to find a new PUCCH occasion */ - NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; - DevAssert(pucch_Config->resourceToAddModList->list.count > 0); - DevAssert(pucch_Config->resourceSetToAddModList->list.count > 0); - const int n_res = pucch_Config->resourceSetToAddModList->list.array[0]->resourceList.list.count; - int *pucch_index_used = RC.nrmac[mod_id]->pucch_index_used[sched_ctrl->active_ubwp->bwp_Id]; + NR_PUCCH_Config_t *pucch_Config=NULL; + int bwp_Id=0; + if (sched_ctrl->active_ubwp) { + pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; + bwp_Id= sched_ctrl->active_ubwp->bwp_Id; + } + else if (RC.nrmac[mod_id]->UE_info.CellGroup[UE_id] && + RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig && + RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated && + RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig && + RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && + RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) + pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; + if (pucch_Config) { + DevAssert(pucch_Config->resourceToAddModList->list.count > 0); + DevAssert(pucch_Config->resourceSetToAddModList->list.count > 0); + } + int n_res = (pucch_Config) ? + pucch_Config->resourceSetToAddModList->list.array[0]->resourceList.list.count : + nr_get_default_pucch_res(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon); + int *pucch_index_used = RC.nrmac[mod_id]->pucch_index_used[bwp_Id]; /* if time information is outdated (e.g., last PUCCH occasion in last frame), * set to first possible UL occasion in this frame. Note that if such UE is @@ -572,6 +1254,8 @@ bool nr_acknack_scheduling(int mod_id, // Find the right timing_indicator value. int i = 0; while (i < 8) { + LOG_D(MAC,"pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", + i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot); if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot) break; ++i; @@ -588,8 +1272,10 @@ bool nr_acknack_scheduling(int mod_id, } pucch->timing_indicator = i; // index in the list of timing indicators + LOG_D(MAC,"2. DL slot %d, UL_ACK %d (index %d)\n",slot,pucch->ul_slot,i); + pucch->dai_c++; - const int pucch_res = pucch_index_used[pucch->ul_slot]; + const int pucch_res = r_pucch<0 ? pucch_index_used[pucch->ul_slot] : r_pucch; pucch->resource_indicator = pucch_res; pucch_index_used[pucch->ul_slot] += 1; AssertFatal(pucch_index_used[pucch->ul_slot] <= n_res, @@ -603,16 +1289,18 @@ bool nr_acknack_scheduling(int mod_id, /* verify that at that slot and symbol, resources are free. We only do this * for initialCyclicShift 0 (we assume it always has that one), so other * initialCyclicShifts can overlap with ICS 0!*/ - const NR_PUCCH_Resource_t *resource = - pucch_Config->resourceToAddModList->list.array[pucch_res]; - DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); - if (resource->format.choice.format0->initialCyclicShift == 0) { - uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; - const uint16_t symb = 1 << resource->format.choice.format0->startingSymbolIndex; - AssertFatal((vrb_map_UL[resource->startingPRB] & symb) == 0, - "symbol %x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d\n", - symb, resource->startingPRB, pucch->ul_slot); - vrb_map_UL[resource->startingPRB] |= symb; + if (pucch_Config) { + const NR_PUCCH_Resource_t *resource = + pucch_Config->resourceToAddModList->list.array[pucch_res]; + DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); + if (resource->format.choice.format0->initialCyclicShift == 0) { + uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; + const uint16_t symb = 1 << resource->format.choice.format0->startingSymbolIndex; + AssertFatal((vrb_map_UL[resource->startingPRB] & symb) == 0, + "symbol %x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d\n", + symb, resource->startingPRB, pucch->ul_slot); + vrb_map_UL[resource->startingPRB] |= symb; + } } return true; } @@ -743,5 +1431,4 @@ uint16_t compute_pucch_prb_size(uint8_t format, else{ AssertFatal(1==0,"Not yet implemented"); } - } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 29c782a242b3fadfc91fc54b0746943ae4a9393e..4f913a0c2da51d2faba2d9d9554866baeaf00fe2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -77,11 +77,10 @@ void nr_process_mac_pdu( int pdu_len = mac_pdu_len; uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len; - NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; int UE_id = find_nr_UE_id(module_idP, rnti); if (UE_id == -1) { - LOG_E(MAC, "%s() UE_id == -1\n",__func__); + LOG_E(NR_MAC, "%s() UE_id == -1\n",__func__); return; } NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; @@ -116,7 +115,7 @@ void nr_process_mac_pdu( mac_sdu_len = 0; rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID; - LOG_D(MAC, "LCID received at gNB side: %d \n", rx_lcid); + LOG_D(NR_MAC, "LCID received at gNB side: %d \n", rx_lcid); unsigned char *ce_ptr; int n_Lcg = 0; @@ -125,7 +124,7 @@ void nr_process_mac_pdu( // MAC CE /*#ifdef DEBUG_HEADER_PARSING - LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len); + LOG_D(NR_MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len); #endif*/ case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY: // 38.321 Ch6.1.3.20 @@ -137,15 +136,15 @@ void nr_process_mac_pdu( case UL_SCH_LCID_S_BSR: case UL_SCH_LCID_S_TRUNCATED_BSR: - //38.321 section 6.1.3.1 - //fixed length - mac_ce_len =1; - /* Extract short BSR value */ + //38.321 section 6.1.3.1 + //fixed length + mac_ce_len =1; + /* Extract short BSR value */ ce_ptr = &pdu_ptr[mac_subheader_len]; NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr; sched_ctrl->estimated_ul_buffer = 0; sched_ctrl->estimated_ul_buffer = NR_SHORT_BSR_TABLE[bsr_s->Buffer_size]; - LOG_D(MAC, "SHORT BSR, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n", + LOG_D(NR_MAC, "SHORT BSR, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n", bsr_s->LcgID, bsr_s->Buffer_size, NR_SHORT_BSR_TABLE[bsr_s->Buffer_size], @@ -170,19 +169,19 @@ void nr_process_mac_pdu( n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - LOG_D(MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", + LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); for (int n = 0; n < n_Lcg; n++){ - LOG_D(MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", + LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", n, n_Lcg, pdu_ptr[mac_subheader_len + 1 + n], NR_LONG_BSR_TABLE[pdu_ptr[mac_subheader_len + 1 + n]]); sched_ctrl->estimated_ul_buffer += NR_LONG_BSR_TABLE[pdu_ptr[mac_subheader_len + 1 + n]]; } - break; + break; case UL_SCH_LCID_C_RNTI: //38.321 section 6.1.3.2 @@ -227,23 +226,71 @@ void nr_process_mac_pdu( // end of MAC PDU, can ignore the rest. break; - // MAC SDUs case UL_SCH_LCID_SRB1: - // todo - break; case UL_SCH_LCID_SRB2: - // todo - break; + if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){ + //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8; + mac_subheader_len = 3; + mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L1 & 0x7f) << 8) + | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L2 & 0xff); + } else { + mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L; + mac_subheader_len = 2; + } + LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: %d \n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, rnti); + mac_rlc_data_ind(module_idP, + rnti, + module_idP, + frameP, + ENB_FLAG_YES, + MBMS_FLAG_NO, + rx_lcid, + (char *) (pdu_ptr + mac_subheader_len), + mac_sdu_len, + 1, + NULL); + break; case UL_SCH_LCID_SRB3: // todo break; - case UL_SCH_LCID_CCCH_MSG3: - // todo - break; + case UL_SCH_LCID_CCCH: - // todo - mac_subheader_len = 2; + case UL_SCH_LCID_CCCH1: + // fixed length + mac_subheader_len = 1; + + if ( rx_lcid == UL_SCH_LCID_CCCH1 ) { + // RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes + mac_sdu_len = 8; + + // Check if it is a valid CCCH1 message, we get all 00's messages very often + int i = 0; + for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + if(pdu_ptr[i] != 0) { + break; + } + } + if (i == (mac_subheader_len+mac_sdu_len)) { + LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len); + done = 1; break; + } + } else { + // fixed length of 6 bytes + mac_sdu_len = 6; + } + + nr_mac_rrc_data_ind(module_idP, + CC_id, + frameP, + 0, + 0, + rnti, + CCCH, + pdu_ptr+mac_subheader_len, + mac_sdu_len, + 0); + break; case UL_SCH_LCID_DTCH: // check if LCID is valid at current time. @@ -258,11 +305,11 @@ void nr_process_mac_pdu( mac_subheader_len = 2; } - 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); + LOG_I(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len); int UE_id = find_nr_UE_id(module_idP, rnti); RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; #if defined(ENABLE_MAC_PAYLOAD_DEBUG) - log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n"); + log_dump(NR_MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n"); #endif @@ -287,7 +334,7 @@ void nr_process_mac_pdu( break; default: - LOG_D(MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid); + LOG_D(NR_MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid); return; break; } @@ -295,8 +342,8 @@ 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!, pdu_len: %d\n", __func__, pdu_len); - LOG_E(MAC, "MAC PDU "); + LOG_E(NR_MAC, "%s() residual mac pdu length < 0!, pdu_len: %d\n", __func__, pdu_len); + LOG_E(NR_MAC, "MAC PDU "); for (int i = 0; i < 20; i++) // Only printf 1st - 20nd bytes printf("%02x ", pdu_ptr[i]); printf("\n"); @@ -312,7 +359,7 @@ void handle_nr_ul_harq(module_id_t mod_id, { int UE_id = find_nr_UE_id(mod_id, crc_pdu->rnti); if (UE_id < 0) { - LOG_E(MAC, "%s(): unknown RNTI %04x in PUSCH\n", __func__, crc_pdu->rnti); + LOG_E(NR_MAC, "%s(): unknown RNTI %04x in PUSCH\n", __func__, crc_pdu->rnti); return; } NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; @@ -320,7 +367,7 @@ void handle_nr_ul_harq(module_id_t mod_id, int8_t harq_pid = sched_ctrl->feedback_ul_harq.head; while (crc_pdu->harq_id != harq_pid || harq_pid < 0) { - LOG_W(MAC, + LOG_W(NR_MAC, "Unexpected ULSCH HARQ PID %d (have %d) for RNTI %04x (ignore this warning for RA)\n", crc_pdu->harq_id, harq_pid, @@ -329,8 +376,16 @@ void handle_nr_ul_harq(module_id_t mod_id, return; remove_front_nr_list(&sched_ctrl->feedback_ul_harq); - sched_ctrl->ul_harq_processes[harq_pid].round++; - add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); + sched_ctrl->ul_harq_processes[harq_pid].is_waiting = false; + if(sched_ctrl->ul_harq_processes[harq_pid].round == MAX_HARQ_ROUNDS) { + sched_ctrl->ul_harq_processes[harq_pid].ndi ^= 1; + sched_ctrl->ul_harq_processes[harq_pid].round = 0; + UE_info->mac_stats[UE_id].ulsch_errors++; + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); + } else { + sched_ctrl->ul_harq_processes[harq_pid].round++; + add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); + } harq_pid = sched_ctrl->feedback_ul_harq.head; } remove_front_nr_list(&sched_ctrl->feedback_ul_harq); @@ -341,30 +396,31 @@ void handle_nr_ul_harq(module_id_t mod_id, if (!crc_pdu->tb_crc_status) { harq->ndi ^= 1; harq->round = 0; - LOG_D(MAC, + LOG_D(NR_MAC, "Ulharq id %d crc passed for RNTI %04x\n", harq_pid, crc_pdu->rnti); add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); - } else if (harq->round == MAX_HARQ_ROUNDS) { - harq->ndi ^= 1; - harq->round = 0; - LOG_D(MAC, - "RNTI %04x: Ulharq id %d crc failed in all rounds\n", - crc_pdu->rnti, - harq_pid); - UE_info->mac_stats[UE_id].ulsch_errors++; - add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); } else { harq->round++; - LOG_D(MAC, - "Ulharq id %d crc failed for RNTI %04x\n", - harq_pid, - crc_pdu->rnti); - add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); + if (harq->round == MAX_HARQ_ROUNDS) { + harq->ndi ^= 1; + harq->round = 0; + LOG_D(NR_MAC, + "RNTI %04x: Ulharq id %d crc failed in all rounds\n", + crc_pdu->rnti, + harq_pid); + UE_info->mac_stats[UE_id].ulsch_errors++; + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); + } else { + LOG_D(NR_MAC, + "Ulharq id %d crc failed for RNTI %04x\n", + harq_pid, + crc_pdu->rnti); + add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); + } } } - /* * When data are received on PHY and transmitted to MAC */ @@ -384,7 +440,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, const int current_rnti = rntiP; const int UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti); const int target_snrx10 = gNB_mac->pusch_target_snrx10; - + const int pusch_failure_thres = gNB_mac->pusch_failure_thres; if (UE_id != -1) { NR_UE_sched_ctrl_t *UE_scheduling_control = &UE_info->UE_sched_ctrl[UE_id]; const int8_t harq_pid = UE_scheduling_control->feedback_ul_harq.head; @@ -395,7 +451,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, T_BUFFER(sduP, sdu_lenP)); UE_info->mac_stats[UE_id].ulsch_total_bytes_rx += sdu_lenP; - LOG_D(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d sduP %p\n", + LOG_D(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d TA %d sduP %p\n", gnb_mod_idP, harq_pid, CC_idP, @@ -404,6 +460,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, current_rnti, UE_id, ul_cqi, + timing_advance, sduP); // if not missed detection (10dB threshold for now) @@ -420,7 +477,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, #if defined(ENABLE_MAC_PAYLOAD_DEBUG) - LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n"); + LOG_I(NR_MAC, "Printing received UL MAC payload at gNB side: %d \n"); for (int i = 0; i < sdu_lenP ; i++) { //harq_process_ul_ue->a[i] = (unsigned char) rand(); //printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); @@ -433,6 +490,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (sduP != NULL){ LOG_D(NR_MAC, "Received PDU at MAC gNB \n"); + UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt = 0; const uint32_t tb_size = UE_scheduling_control->ul_harq_processes[harq_pid].sched_pusch.tb_size; UE_scheduling_control->sched_ul_bytes -= tb_size; if (UE_scheduling_control->sched_ul_bytes < 0) @@ -449,10 +507,26 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_scheduling_control->sched_ul_bytes < 0) UE_scheduling_control->sched_ul_bytes = 0; } + if (ul_cqi < 128) UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++; + if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { + LOG_I(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n"); + UE_info->UE_sched_ctrl[UE_id].ul_failure = 1; + } + } + } else if(sduP) { + + + bool no_sig = true; + for (int k = 0; k < sdu_lenP; k++) { + if(sduP[k]!=0) { + no_sig = false; + break; + } + } + + if(no_sig) { + LOG_W(NR_MAC, "No signal\n"); } - } else { - if (!sduP) // check that CRC passed - return; T(T_GNB_MAC_UL_PDU_WITH_DATA, T_INT(gnb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(slotP), T_INT(-1) /* harq_pid */, @@ -466,47 +540,97 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (ra->state != WAIT_Msg3) continue; - // random access pusch with TC-RNTI - if (ra->rnti != current_rnti) { - LOG_W(NR_MAC, - "expected TC-RNTI %04x to match current RNTI %04x\n", - ra->rnti, - current_rnti); - continue; - } - const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup); - UE_info->UE_beam_index[UE_id] = ra->beam_id; - LOG_I(NR_MAC, - "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, " - "adding UE MAC Context UE_id %d/RNTI %04x\n", - gnb_mod_idP, - current_rnti, - UE_id, - ra->rnti); - - LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); - for (int k = 0; k < sdu_lenP; k++) { - LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); - } - - // re-initialize ta update variables afrer RA procedure completion - UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; + if(no_sig) { + LOG_W(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + } else { + + // random access pusch with TC-RNTI + if (ra->rnti != current_rnti) { + LOG_W(NR_MAC, + "expected TC_RNTI %04x to match current RNTI %04x\n", + ra->rnti, + current_rnti); + + if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) { + LOG_W(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x\n", i, ra->state,ra->rnti,current_rnti); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + } + + continue; + } + int UE_id=-1; + + UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->CellGroup); + UE_info->UE_beam_index[UE_id] = ra->beam_id; + + // re-initialize ta update variables after RA procedure completion + UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; + + LOG_I(NR_MAC, + "reset RA state information for RA-RNTI %04x/index %d\n", + ra->rnti, + i); + + LOG_I(NR_MAC, + "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, " + "adding UE MAC Context UE_id %d/RNTI %04x\n", + gnb_mod_idP, + current_rnti, + UE_id, + ra->rnti); + + if (ra->cfra) { + + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + UE_info->active[UE_id] = true; + + } else { + + LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP); + LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); + for (int k = 0; k < sdu_lenP; k++) { + LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); + } + + // UE Contention Resolution Identity + // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4 + // First byte corresponds to R/LCID MAC sub-header + memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6); + + nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP); + + ra->state = Msg4; + ra->Msg4_frame = ( frameP +2 ) % 1024; + ra->Msg4_slot = 1; + LOG_I(NR_MAC, "Scheduling RA-Msg4 for TC_RNTI %04x (state %d, frame %d, slot %d)\n", ra->rnti, ra->state, ra->Msg4_frame, ra->Msg4_slot); - free(ra->preambles.preamble_list); - ra->state = RA_IDLE; - LOG_I(NR_MAC, - "reset RA state information for RA-RNTI %04x/index %d\n", - ra->rnti, - i); + } + return; + } + } + } else { + for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) { + NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i]; + if (ra->state != WAIT_Msg3) + continue; - return; + LOG_W(NR_MAC, "Random Access %i failed at state %i (state is not WAIT_Msg3)\n", i, ra->state); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } } } -long get_K2(NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) { - DevAssert(ubwp); - const NR_PUSCH_TimeDomainResourceAllocation_t *tda_list = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]; +long get_K2(NR_ServingCellConfigCommon_t *scc,NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) { + DevAssert(scc); + const NR_PUSCH_TimeDomainResourceAllocation_t *tda_list = ubwp ? + ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]: + scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]; if (tda_list->k2) return *tda_list->k2; else if (mu < 2) @@ -553,9 +677,18 @@ void pf_ul(module_id_t module_id, /* Loop UE_list to calculate throughput and coeff */ for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { + + if (UE_info->Msg4_ACKed[UE_id] != true) continue; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + int rbStart = 0; /*NRRIV2PRBOFFSET(sched_ctrl->active_bwp ? + sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth: + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, + MAX_BWP_SIZE);*/ + const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp? + sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth: + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, + MAX_BWP_SIZE); /* Calculate throughput */ const float a = 0.0005f; // corresponds to 200ms window @@ -567,11 +700,21 @@ void pf_ul(module_id_t module_id, * every TTI if we can save it, so check whether dci_format, TDA, or * num_dmrs_cdm_grps_no_data has changed and only then recompute */ sched_ctrl->sched_pusch.time_domain_allocation = tda; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, NR_SearchSpace__searchSpaceType_PR_ue_Specific); - sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); + NR_BWP_DownlinkDedicated_t *bwp_Dedicated=NULL; + if (sched_ctrl->active_bwp) bwp_Dedicated = sched_ctrl->active_bwp->bwp_Dedicated; + else if (UE_info->CellGroup[UE_id] && + UE_info->CellGroup[UE_id]->spCellConfig && + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated) + bwp_Dedicated = UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; + sched_ctrl->search_space = get_searchspace(scc,bwp_Dedicated, + bwp_Dedicated ? + NR_SearchSpace__searchSpaceType_PR_ue_Specific: + NR_SearchSpace__searchSpaceType_PR_common); + sched_ctrl->coreset = get_coreset(scc,sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); + if (sched_ctrl->coreset == NULL) sched_ctrl->coreset = RC.nrmac[module_id]->sched_ctrlCommon->coreset; const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; - const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; - const uint8_t num_dmrs_cdm_grps_no_data = 1; + const int dci_format = sched_ctrl->active_bwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0; + const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? 1 : 2; NR_sched_pusch_save_t *ps = &sched_ctrl->pusch_save; if (ps->time_domain_allocation != tda || ps->dci_format != dci_format @@ -585,7 +728,7 @@ void pf_ul(module_id_t module_id, /* Find free CCE */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { - LOG_D(MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); + LOG_D(NR_MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); continue; } /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ @@ -600,15 +743,15 @@ void pf_ul(module_id_t module_id, /* Get previous PSUCH filed info */ sched_ctrl->sched_pusch = cur_harq->sched_pusch; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; - LOG_D(MAC, "%4d.%2d Allocate UL retransmission UE %d/RNTI %04x sched %4d.%2d (%d RBs)\n", + LOG_D(NR_MAC, "%4d.%2d Allocate UL retransmission UE %d/RNTI %04x sched %4d.%2d (%d RBs)\n", frame, slot, UE_id, UE_info->rnti[UE_id], sched_pusch->frame, sched_pusch->slot, sched_pusch->rbSize); while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; if (rbStart + sched_pusch->rbSize >= bwpSize) { - LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n", - UE_id, UE_info->rnti[UE_id]); + LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, sched_pusch->rbSize %d, bwpSize %d)\n", + UE_id, UE_info->rnti[UE_id],rbStart,sched_pusch->rbSize,bwpSize); return; } sched_pusch->rbStart = rbStart; @@ -628,8 +771,9 @@ void pf_ul(module_id_t module_id, sched_pusch->mcs = mcs; sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table); sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table); - if (ps->pusch_Config->tp_pi2BPSK - && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6))) { + LOG_W(NR_MAC, "Fixme: work around a NULL pointer (set in function nr_save_pusch_fields that is actually called)\n"); + if (ps->pusch_Config && (ps->pusch_Config->tp_pi2BPSK + && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6)))) { sched_pusch->R >>= 1; sched_pusch->Qm <<= 1; } @@ -642,7 +786,7 @@ void pf_ul(module_id_t module_id, /* if no data, pre-allocate 5RB */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { - LOG_D(MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE_info->rnti[UE_id]); + LOG_I(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE_info->rnti[UE_id]); continue; } /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ @@ -650,10 +794,11 @@ void pf_ul(module_id_t module_id, if (max_num_ue < 0) return; + LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb,rbStart); while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; if (rbStart + min_rb >= bwpSize) { - LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n", - UE_id, UE_info->rnti[UE_id]); + LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", + UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); return; } sched_pusch->rbStart = rbStart; @@ -690,7 +835,7 @@ void pf_ul(module_id_t module_id, 1 /* NrOfLayers */) >> 3; coeff_ue[UE_id] = (float) tbs / ul_thr_ue[UE_id]; - LOG_D(MAC,"b %d, ul_thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", + LOG_D(NR_MAC,"b %d, ul_thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", b, UE_id, ul_thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]); } @@ -716,7 +861,7 @@ void pf_ul(module_id_t module_id, bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { - LOG_D(MAC, "%4d.%2d no free CCE for UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); + LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); continue; } @@ -726,16 +871,17 @@ void pf_ul(module_id_t module_id, return; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters:&scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + int rbStart = 0; /*NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);*/ + const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; sched_pusch->rbStart = rbStart; if (rbStart + min_rb >= bwpSize) { - LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n", - UE_id, UE_info->rnti[UE_id]); + LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", + UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); return; } @@ -756,7 +902,7 @@ void pf_ul(module_id_t module_id, >> 3; } while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart+rbSize] && sched_pusch->tb_size < B); - LOG_D(MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d\n", + LOG_D(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d\n", rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B); /* Mark the corresponding RBs as used */ @@ -787,13 +933,16 @@ bool nr_simple_ulsch_preprocessor(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; const int tda = 1; const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = - sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + sched_ctrl->active_ubwp ? + sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: + scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + AssertFatal(tda < tdaList->list.count, "time domain assignment %d >= %d\n", tda, tdaList->list.count); - int K2 = get_K2(sched_ctrl->active_ubwp, tda, mu); + int K2 = get_K2(scc,sched_ctrl->active_ubwp, tda, mu); const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; if (!is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot)) @@ -805,8 +954,8 @@ bool nr_simple_ulsch_preprocessor(module_id_t module_id, /* Confirm all the UE have same K2 as the first UE */ for (UE_id = UE_info->list.next[UE_id]; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - AssertFatal(K2 == get_K2(sched_ctrl->active_ubwp, tda, mu), - "Different K2, %d(UE%d) != %ld(UE%d)\n", K2, 0, get_K2(sched_ctrl->active_ubwp, tda, mu), UE_id); + AssertFatal(K2 == get_K2(scc,sched_ctrl->active_ubwp, tda, mu), + "Different K2, %d(UE%d) != %ld(UE%d)\n", K2, 0, get_K2(scc,sched_ctrl->active_ubwp, tda, mu), UE_id); sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; } @@ -814,13 +963,17 @@ bool nr_simple_ulsch_preprocessor(module_id_t module_id, /* Change vrb_map_UL to rballoc_mask */ uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp ? + sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth: + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, + MAX_BWP_SIZE); + int st = 0, e = 0, len = 0; for (int i = 0; i < bwpSize; i++) { - while (vrb_map_UL[i] == 1) + while (vrb_map_UL[i] == 1 && i<bwpSize) i++; st = i; - while (vrb_map_UL[i] == 0) + while (vrb_map_UL[i] == 0 && i<bwpSize) i++; if (i - st > len) { len = i - st; @@ -856,7 +1009,7 @@ void nr_schedule_ulsch(module_id_t module_id, /* Uplink data ONLY can be scheduled when the current slot is downlink slot, * because we have to schedule the DCI0 first before schedule uplink data */ if (is_xlsch_in_slot(ulsch_in_slot_bitmap, slot)) { - LOG_D(MAC, "Current slot %d is NOT DL slot, cannot schedule DCI0 for UL data\n", slot); + LOG_D(NR_MAC, "Current slot %d is NOT DL slot, cannot schedule DCI0 for UL data\n", slot); return; } bool do_sched = RC.nrmac[module_id]->pre_processor_ul( @@ -882,6 +1035,7 @@ void nr_schedule_ulsch(module_id_t module_id, /* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in * every TTI are pre-populated by the preprocessor and used below */ NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; + LOG_D(NR_MAC,"UE %x : sched_pusch->rbSize %d\n",UE_info->rnti[UE_id],sched_pusch->rbSize); if (sched_pusch->rbSize <= 0) continue; @@ -927,7 +1081,7 @@ void nr_schedule_ulsch(module_id_t module_id, cur_harq->sched_pusch = *sched_pusch; sched_ctrl->sched_ul_bytes += sched_pusch->tb_size; } else { - LOG_D(MAC, + LOG_D(NR_MAC, "%d.%2d UL retransmission RNTI %04x sched %d.%2d HARQ PID %d round %d NDI %d\n", frame, slot, @@ -940,7 +1094,7 @@ void nr_schedule_ulsch(module_id_t module_id, } UE_info->mac_stats[UE_id].ulsch_current_bytes = sched_pusch->tb_size; - LOG_D(MAC, + LOG_D(NR_MAC, "%4d.%2d RNTI %04x UL sched %4d.%2d start %d RBS %d MCS %d TBS %d HARQ PID %d round %d NDI %d\n", frame, slot, @@ -971,16 +1125,18 @@ void nr_schedule_ulsch(module_id_t module_id, memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t)); future_ul_tti_req->n_pdus += 1; - LOG_D(MAC, "%4d.%2d Scheduling UE specific PUSCH\n", frame, slot); + LOG_D(NR_MAC, "%4d.%2d Scheduling UE specific PUSCH for sched %d.%d, ul_tto_req %d.%d\n", frame, slot, + sched_pusch->frame,sched_pusch->slot,future_ul_tti_req->SFN,future_ul_tti_req->Slot); pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; pusch_pdu->rnti = rnti; pusch_pdu->handle = 0; //not yet used /* FAPI: BWP */ - pusch_pdu->bwp_size = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pusch_pdu->bwp_start = NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pusch_pdu->subcarrier_spacing = sched_ctrl->active_ubwp->bwp_Common->genericParameters.subcarrierSpacing; + NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters:&scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + pusch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + pusch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + pusch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing; pusch_pdu->cyclic_prefix = 0; /* FAPI: PUSCH information always included */ @@ -989,7 +1145,8 @@ void nr_schedule_ulsch(module_id_t module_id, pusch_pdu->mcs_index = sched_pusch->mcs; pusch_pdu->mcs_table = ps->mcs_table; pusch_pdu->transform_precoding = ps->transform_precoding; - if (ps->pusch_Config->dataScramblingIdentityPUSCH) + if (ps->pusch_Config && + ps->pusch_Config->dataScramblingIdentityPUSCH) pusch_pdu->data_scrambling_id = *ps->pusch_Config->dataScramblingIdentityPUSCH; else pusch_pdu->data_scrambling_id = *scc->physCellId; @@ -999,10 +1156,10 @@ void nr_schedule_ulsch(module_id_t module_id, pusch_pdu->ul_dmrs_symb_pos = ps->ul_dmrs_symb_pos; pusch_pdu->dmrs_config_type = ps->dmrs_config_type; if (pusch_pdu->transform_precoding) { // transform precoding disabled - long *scramblingid; - if (pusch_pdu->scid == 0) + long *scramblingid=NULL; + if (ps->NR_DMRS_UplinkConfig && pusch_pdu->scid == 0) scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0; - else + else if (ps->NR_DMRS_UplinkConfig) scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1; if (scramblingid == NULL) pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId; @@ -1011,9 +1168,9 @@ void nr_schedule_ulsch(module_id_t module_id, } else { pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId; - if (ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL) + if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL) pusch_pdu->pusch_identity = *ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity; - else + else if (ps->NR_DMRS_UplinkConfig) pusch_pdu->pusch_identity = *scc->physCellId; } pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1] @@ -1021,13 +1178,11 @@ void nr_schedule_ulsch(module_id_t module_id, pusch_pdu->dmrs_ports = 1; /* FAPI: Pusch Allocation in frequency domain */ - AssertFatal(ps->pusch_Config->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1, - "Only frequency resource allocation type 1 is currently supported\n"); pusch_pdu->resource_alloc = 1; //type 1 pusch_pdu->rb_start = sched_pusch->rbStart; pusch_pdu->rb_size = sched_pusch->rbSize; pusch_pdu->vrb_to_prb_mapping = 0; - if (ps->pusch_Config->frequencyHopping==NULL) + if (ps->pusch_Config==NULL || ps->pusch_Config->frequencyHopping==NULL) pusch_pdu->frequency_hopping = 0; else pusch_pdu->frequency_hopping = 1; @@ -1051,8 +1206,8 @@ void nr_schedule_ulsch(module_id_t module_id, pusch_pdu->dfts_ofdm.low_papr_group_number = pusch_pdu->pusch_identity % 30; // V as specified in section 6.4.1.1.1.2 in 38.211 V = 0 if sequence hopping and group hopping are disabled - if ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) && - (ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL)) + if ((ps->NR_DMRS_UplinkConfig==NULL) || ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) && + (ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL))) pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0; else AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n"); @@ -1063,19 +1218,17 @@ void nr_schedule_ulsch(module_id_t module_id, /*-----------------------------------------------------------------------------*/ /* PUSCH PTRS */ - if (ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) { - // TODO to be fixed from RRC config - 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); + if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) { + bool valid_ptrs_setup = false; 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; - - pusch_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS + valid_ptrs_setup = set_ul_ptrs_values(ps->NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup, + pusch_pdu->rb_size, pusch_pdu->mcs_index, pusch_pdu->mcs_table, + &pusch_pdu->pusch_ptrs.ptrs_freq_density,&pusch_pdu->pusch_ptrs.ptrs_time_density, + &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset,&pusch_pdu->pusch_ptrs.num_ptrs_ports, + &pusch_pdu->pusch_ptrs.ul_ptrs_power, pusch_pdu->nr_of_symbols); + if (valid_ptrs_setup==true) { + pusch_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS + } } else{ pusch_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS @@ -1083,8 +1236,10 @@ void nr_schedule_ulsch(module_id_t module_id, /* look up the PDCCH PDU for this BWP and CORESET. If it does not exist, * create it */ - const int bwpid = sched_ctrl->active_bwp->bwp_Id; - const int coresetid = sched_ctrl->coreset->controlResourceSetId; + const int bwpid = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; + NR_SearchSpace_t *ss = sched_ctrl->active_bwp ? sched_ctrl->search_space: RC.nrmac[module_id]->sched_ctrlCommon->search_space; + NR_ControlResourceSet_t *coreset = sched_ctrl->active_bwp? sched_ctrl->coreset: RC.nrmac[module_id]->sched_ctrlCommon->coreset; + const int coresetid = coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = pdcch_pdu_bwp_coreset[bwpid][coresetid]; if (!pdcch_pdu) { nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu = &ul_dci_req->ul_dci_pdu_list[ul_dci_req->numPdus]; @@ -1093,19 +1248,19 @@ void nr_schedule_ulsch(module_id_t module_id, ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); pdcch_pdu = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15; ul_dci_req->numPdus += 1; - nr_configure_pdcch(pdcch_pdu, sched_ctrl->search_space, sched_ctrl->coreset, scc, sched_ctrl->active_bwp); + nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, sched_ctrl->active_bwp); pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu; } - LOG_D(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frame,slot); + LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frame,slot); /* Fill PDCCH DL DCI PDU */ nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; pdcch_pdu->numDlDci++; dci_pdu->RNTI = rnti; - if (sched_ctrl->coreset->pdcch_DMRS_ScramblingID && - sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) { - dci_pdu->ScramblingId = *sched_ctrl->coreset->pdcch_DMRS_ScramblingID; + if (coreset->pdcch_DMRS_ScramblingID && + ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) { + dci_pdu->ScramblingId = *coreset->pdcch_DMRS_ScramblingID; dci_pdu->ScramblingRNTI = rnti; } else { dci_pdu->ScramblingId = *scc->physCellId; @@ -1118,25 +1273,31 @@ void nr_schedule_ulsch(module_id_t module_id, dci_pdu_rel15_t uldci_payload; memset(&uldci_payload, 0, sizeof(uldci_payload)); - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; - const int n_ubwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; + NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; + int n_ubwp=1; + if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated && + CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig && + CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) + n_ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; + config_uldci(sched_ctrl->active_ubwp, + scc, pusch_pdu, &uldci_payload, ps->dci_format, ps->time_domain_allocation, UE_info->UE_sched_ctrl[UE_id].tpc0, n_ubwp, - sched_ctrl->active_bwp->bwp_Id); + bwpid); fill_dci_pdu_rel15(scc, - secondaryCellGroup, + CellGroup, dci_pdu, &uldci_payload, ps->dci_format, rnti_types[0], pusch_pdu->bwp_size, - sched_ctrl->active_bwp->bwp_Id); + bwpid); memset(sched_pusch, 0, sizeof(*sched_pusch)); } -} \ No newline at end of file +} diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 88f6dbcc56d319ae3f4d1791fc70e44b8d0341f2..18698635dea8e545197ac1777eb25cc0084187f9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -41,19 +41,20 @@ void set_cset_offset(uint16_t); void mac_top_init_gNB(void); void config_common(int Mod_idP, + int ssb_SubcarrierOffset, int pdsch_AntennaPorts, + int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc ); -int rrc_mac_config_req_gNB(module_id_t Mod_idP, - int ssb_SubcarrierOffset, +int rrc_mac_config_req_gNB(module_id_t Mod_idP, + int ssb_SubcarrierOffset, int pdsch_AntennaPorts, - int pusch_tgt_snrx10, - int pucch_tgt_snrx10, + int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc, int nsa_flag, uint32_t rnti, - NR_CellGroupConfig_t *secondaryCellGroup + NR_CellGroupConfig_t *CellGroup ); void clear_nr_nfapi_information(gNB_MAC_INST * gNB, @@ -70,6 +71,7 @@ void nr_schedule_ue_spec(module_id_t module_id, void schedule_control_sib1(module_id_t module_id, int CC_id, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, int time_domain_allocation, uint8_t mcsTableIdx, uint8_t mcs, @@ -83,7 +85,11 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot); -void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, uint8_t slots_per_frame); +void schedule_nr_mib(module_id_t module_idP, + frame_t frameP, + sub_frame_t subframeP, + uint8_t slots_per_frame, + int nb_periods_per_frame); /// uplink scheduler void nr_schedule_ulsch(module_id_t module_id, @@ -114,7 +120,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset); -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP); +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra); int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only); @@ -124,7 +130,8 @@ void nr_get_Msg3alloc(module_id_t module_id, NR_BWP_Uplink_t *ubwp, sub_frame_t current_subframe, frame_t current_frame, - NR_RA_t *ra); + NR_RA_t *ra, + int16_t *tdd_beam_association); /* \brief Function in gNB to fill RAR pdu when requested by PHY. @param ra Instance of RA resources of gNB @@ -171,6 +178,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, void config_uldci(const NR_BWP_Uplink_t *ubwp, + const NR_ServingCellConfigCommon_t *scc, const nfapi_nr_pusch_pdu_t *pusch_pdu, dci_pdu_rel15_t *dci_pdu_rel15, int dci_format, @@ -193,7 +201,8 @@ void nr_csi_meas_reporting(int Mod_idP, bool nr_acknack_scheduling(int Mod_idP, int UE_id, frame_t frameP, - sub_frame_t slotP); + sub_frame_t slotP, + int r_pucch); void get_pdsch_to_harq_feedback(int Mod_idP, int UE_id, @@ -221,12 +230,14 @@ int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space, void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, + NR_CellGroupConfig_t *CellGroup, NR_BWP_Uplink_t *bwp, uint16_t rnti, uint8_t pucch_resource, uint16_t O_csi, uint16_t O_ack, - uint8_t O_sr); + uint8_t O_sr, + int r_pucch); void find_search_space(int ss_type, NR_BWP_Downlink_t *bwp, @@ -239,7 +250,7 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_BWP_Downlink_t *bwp); void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, - const NR_CellGroupConfig_t *secondaryCellGroup, + const NR_CellGroupConfig_t *CellGroup, nfapi_nr_dl_dci_pdu_t *pdcch_dci_pdu, dci_pdu_rel15_t *dci_pdu_rel15, int dci_formats, @@ -247,23 +258,23 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, int N_RB, int bwp_id); -void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup, +void prepare_dci(const NR_CellGroupConfig_t *CellGroup, dci_pdu_rel15_t *dci_pdu_rel15, nr_dci_format_t format, int bwp_id); /* find coreset within the search space */ -NR_ControlResourceSet_t *get_coreset(NR_BWP_Downlink_t *bwp, +NR_ControlResourceSet_t *get_coreset(NR_ServingCellConfigCommon_t *scc, + NR_BWP_Downlink_t *bwp, NR_SearchSpace_t *ss, - int ss_type); + NR_SearchSpace__searchSpaceType_PR ss_type); /* find a search space within a BWP */ -NR_SearchSpace_t *get_searchspace( - NR_BWP_Downlink_t *bwp, - NR_SearchSpace__searchSpaceType_PR target_ss); - +NR_SearchSpace_t *get_searchspace(NR_ServingCellConfigCommon_t *scc, + NR_BWP_DownlinkDedicated_t *bwp_Dedicated, + NR_SearchSpace__searchSpaceType_PR target_ss); -long get_K2(NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu); +long get_K2(NR_ServingCellConfigCommon_t *scc, NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu); void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, const NR_BWP_Uplink_t *ubwp, @@ -308,10 +319,12 @@ int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP); int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP); -int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secondaryCellGroup); +int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup); void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti); +void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti); + int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, NR_BWP_Downlink_t *bwp, NR_ControlResourceSet_t *coreset, @@ -329,7 +342,9 @@ uint16_t compute_pucch_prb_size(uint8_t format, uint8_t n_symb, uint8_t n_re_ctrl); -void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t *UE_info, int UE_id); +int nr_get_default_pucch_res(int pucch_ResourceCommon); + +void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP); int get_dlscs(nfapi_nr_config_request_t *cfg); @@ -347,8 +362,18 @@ void config_nr_mib(int Mod_idP, int cellBarred, int intraFreqReselection); +int nr_write_ce_dlsch_pdu(module_id_t module_idP, + const NR_UE_sched_ctrl_t *ue_sched_ctl, + unsigned char *mac_pdu, + unsigned char drx_cmd, + unsigned char *ue_cont_res_id); + void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra); +void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra); + +void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t slot, NR_RA_t *ra); + void nr_process_mac_pdu( module_id_t module_idP, rnti_t rnti, @@ -361,7 +386,7 @@ int binomial(int n, int k); bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot); -void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id); +void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart, int CC_id); /* \brief Function to indicate a received SDU on ULSCH. diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 63587d58a4f118935ff4f0e38477e25c8e46e3ec..47864efb00c93d9660ca30b88a6adebaa94eeb09 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -80,6 +80,7 @@ #define NR_NB_RA_PROC_MAX 4 #define MAX_NUM_OF_SSB 64 + /*! \brief NR_list_t is a "list" (of users, HARQ processes, slices, ...). * Especially useful in the scheduler and to keep "classes" of users. */ typedef struct { @@ -160,8 +161,8 @@ typedef struct { NR_SearchSpace_t *ra_ss; // Beam index uint8_t beam_id; - /// secondaryCellGroup for UE in NSA that is to come - NR_CellGroupConfig_t *secondaryCellGroup; + /// CellGroup for UE that is to come (NSA is non-null, null for SA) + NR_CellGroupConfig_t *CellGroup; /// Preambles for contention-free access NR_preamble_ue_t preambles; /// NSA: the UEs C-RNTI to use @@ -246,8 +247,17 @@ typedef struct pdcchStateInd { uint8_t servingCellId; uint8_t coresetId; uint8_t tciStateId; + bool tci_present_inDCI; } pdcchStateInd_t; +typedef struct pucchSpatialRelation { + bool is_scheduled; + uint8_t servingCellId; + uint8_t bwpId; + uint8_t pucchResourceId; + bool s0tos7_actDeact[8]; +} pucchSpatialRelation_t; + typedef struct SPCSIReportingpucch { bool is_scheduled; uint8_t servingCellId; @@ -271,12 +281,14 @@ typedef struct pdschTciStatesActDeact { uint8_t bwpId; uint8_t highestTciStateActivated; bool tciStateActDeact[MAX_TCI_STATES]; + uint8_t codepoint[8]; } 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; + pucchSpatialRelation_t pucch_spatial_relation; SPCSIReportingpucch_t SP_CSI_reporting_pucch; aperiodicCSI_triggerStateSelection_t aperi_CSI_trigger; pdschTciStatesActDeact_t pdsch_TCI_States_ActDeact; @@ -292,6 +304,7 @@ typedef struct NR_sched_pucch { uint8_t dai_c; uint8_t timing_indicator; uint8_t resource_indicator; + int r_pucch; } NR_sched_pucch_t; /* this struct is a helper: as long as the TDA and DCI format remain the same @@ -352,6 +365,84 @@ typedef struct NR_UE_harq { uint32_t tb_size; } NR_UE_harq_t; +//! fixme : need to enhace for the multiple TB CQI report + + +// +/*! As per spec 38.214 section 5.2.1.4.2 + * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. + * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter +*/ +#define MAX_NR_OF_REPORTED_RS 4 + +typedef enum NR_CSI_Report_Config { + CSI_Report_PR_cri_ri_li_pmi_cqi_report, + CSI_Report_PR_ssb_cri_report +} NR_CSI_Report_Config_PR; +struct CRI_RI_LI_PMI_CQI { + uint8_t cri; + uint8_t ri; + uint8_t li; + uint8_t pmi_x1; + uint8_t pmi_x2; + uint8_t cqi; +}; + +typedef struct CRI_SSB_RSRP { + uint8_t nr_ssbri_cri; + uint8_t CRI_SSBRI[MAX_NR_OF_REPORTED_RS]; + uint8_t RSRP; + uint8_t diff_RSRP[MAX_NR_OF_REPORTED_RS - 1]; +} CRI_SSB_RSRP_t; + +struct CSI_Report { + NR_CSI_Report_Config_PR present; + union Config_CSI_Report { + struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report; + struct CRI_SSB_RSRP ssb_cri_report; + } choice; +}; + +#define MAX_SR_BITLEN 8 + +typedef struct { + uint8_t nb_ssbri_cri; + uint8_t cri_ssbri_bitlen; + uint8_t rsrp_bitlen; + uint8_t diff_rsrp_bitlen; +}L1_RSRP_bitlen_t; + +typedef struct{ + uint8_t cri_bitlen; + uint8_t ri_bitlen; + uint8_t li_bitlen; + uint8_t pmi_x1_bitlen; + uint8_t pmi_x2_bitlen; + uint8_t cqi_bitlen; +} CSI_Meas_bitlen_t; + +typedef struct nr_csi_report { + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; + long periodicity; + uint16_t offset; + long ** SSB_Index_list; + long ** CSI_Index_list; +// uint8_t nb_of_nzp_csi_report; + uint8_t nb_of_csi_ssb_report; + L1_RSRP_bitlen_t CSI_report_bitlen; + CSI_Meas_bitlen_t csi_meas_bitlen; +} nr_csi_report_t; + +/*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ +#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 typedef struct NR_UE_old_sched { uint16_t rbSize; int time_domain_allocation; @@ -376,26 +467,8 @@ typedef struct NR_UE_ul_harq { NR_sched_pusch_t sched_pusch; } NR_UE_ul_harq_t; - -typedef struct { - uint8_t nb_ssbri_cri; - uint8_t cri_ssbri_bitlen; - uint8_t rsrp_bitlen; - uint8_t diff_rsrp_bitlen; -}CRI_SSBRI_RSRP_bitlen_t; - - -#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 -typedef struct nr_csi_report { - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; - NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; - uint8_t nb_of_nzp_csi_report; - uint8_t nb_of_csi_ssb_report; - CRI_SSBRI_RSRP_bitlen_t CSI_report_bitlen[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; -} nr_csi_report_t; - - /*! \brief scheduling control information set through an API */ +#define MAX_CSI_REPORTS 48 typedef struct { /// total amount of data awaiting for this UE uint32_t num_total_bytes; @@ -450,6 +523,11 @@ typedef struct { uint8_t tpc0; uint8_t tpc1; uint16_t ul_rssi; + uint8_t current_harq_pid; + int pusch_consecutive_dtx_cnt; + int pucch_consecutive_dtx_cnt; + int ul_failure; + struct CSI_Report CSI_report[MAX_CSI_REPORTS]; /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; /// HARQ processes that are free @@ -487,6 +565,8 @@ typedef struct { int ulsch_total_bytes_scheduled; int ulsch_total_bytes_rx; int ulsch_current_bytes; + int cumul_rsrp; + uint8_t num_rsrp_meas; } NR_mac_stats_t; @@ -502,13 +582,14 @@ typedef struct { bool active[MAX_MOBILES_PER_GNB]; rnti_t rnti[MAX_MOBILES_PER_GNB]; - NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB]; + NR_CellGroupConfig_t *CellGroup[MAX_MOBILES_PER_GNB]; /// CCE indexing int Y[MAX_MOBILES_PER_GNB][3][160]; int m[MAX_MOBILES_PER_GNB]; int num_pdcch_cand[MAX_MOBILES_PER_GNB][MAX_NUM_CORESET]; // UE selected beam index uint8_t UE_beam_index[MAX_MOBILES_PER_GNB]; + bool Msg4_ACKed[MAX_MOBILES_PER_GNB]; } NR_UE_info_t; typedef void (*nr_pp_impl_dl)(module_id_t mod_id, @@ -536,6 +617,12 @@ typedef struct gNB_MAC_INST_s { int pusch_target_snrx10; /// Pucch target SNR int pucch_target_snrx10; + /// PUCCH Failure threshold (compared to consecutive PUCCH DTX) + int pucch_failure_thres; + /// PUSCH Failure threshold (compared to consecutive PUSCH DTX) + int pusch_failure_thres; + /// Subcarrier Offset + int ssb_SubcarrierOffset; /// Common cell resources NR_COMMON_channels_t common_channels[NFAPI_CC_MAX]; /// current PDU index (BCH,DLSCH) @@ -589,19 +676,19 @@ typedef struct gNB_MAC_INST_s { time_stats_t schedule_pch; /// CCE lists int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE]; + /// list of allocated beams per period + int16_t *tdd_beam_association; /// PUCCH: keep track of the resources has already been used by saving the /// highest index not yet been used in a given slot. Dynamically allocated /// so we can have it for every slot as a function of the numerology int *pucch_index_used[MAX_NUM_BWP]; - /// DL preprocessor for differentiated scheduling nr_pp_impl_dl pre_processor_dl; /// UL preprocessor for differentiated scheduling nr_pp_impl_ul pre_processor_ul; NR_UE_sched_ctrl_t *sched_ctrlCommon; - NR_CellGroupConfig_t *secondaryCellGroupCommon; - NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config[64]; } gNB_MAC_INST; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index ee2711c6efe82f3415e817594640e8a7ea87bb15..e516217ff13747b8d95625ded8fcdc325985ed3a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -61,6 +61,7 @@ # include "gtpv1u_eNB_task.h" # include "gtpv1u.h" +#include <openair3/ocp-gtpu/gtp_itf.h> #include "ENB_APP/enb_config.h" @@ -83,9 +84,57 @@ hash_table_t *pdcp_coll_p = NULL; static int mbms_socket = -1; #endif - +uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + +uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +int pdcp_pc5_sockfd; +struct sockaddr_in prose_ctrl_addr; +struct sockaddr_in prose_pdcp_addr; +struct sockaddr_in pdcp_sin; /* pdcp module parameters and related functions*/ static pdcp_params_t pdcp_params= {0,NULL}; +rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; +rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode +unsigned int pdcp_eNB_UE_instance_to_rnti_index; + +signed int pdcp_2_nas_irq; +pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; +pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; + +static pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +static pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +static sdu_size_t pdcp_input_sdu_remaining_size_to_read; +static sdu_size_t pdcp_output_header_bytes_to_write; +static sdu_size_t pdcp_output_sdu_bytes_to_write; +notifiedFIFO_t pdcp_sdu_list; + +pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; + uint64_t get_pdcp_optmask(void) { return pdcp_params.optmask; @@ -937,7 +986,7 @@ pdcp_data_ind( GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; - itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); packet_forwarded = TRUE; } } else { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index c8ab4499eeddc9f07fb6d0d9e8506346d9a9e3e4..0c3dd2f04fed4798988e4cab59ef53d2cc29b8d4 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -91,34 +91,34 @@ extern int pdcp_instance_cnt; int init_pdcp_thread(void); void cleanup_pdcp_thread(void); -uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; - -uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +extern uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + +extern uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +extern uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; void pdcp_update_perioidical_stats(const protocol_ctxt_t *const ctxt_pP); @@ -138,7 +138,7 @@ typedef struct pdcp_enb_s { } pdcp_enb_t; -pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; +extern pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; typedef struct pdcp_stats_s { time_stats_t pdcp_run; @@ -242,17 +242,18 @@ typedef struct pdcp_mbms_s { * \note None * @ingroup _pdcp */ + boolean_t pdcp_data_req( protocol_ctxt_t *ctxt_pP, const srb_flag_t srb_flagP, const rb_id_t rb_id, const mui_t muiP, - const confirm_t confirmP, \ + const confirm_t confirmP, const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer, const pdcp_transmission_mode_t mode, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id + const uint32_t * sourceL2Id, + const uint32_t * destinationL2Id ); /*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) @@ -455,10 +456,10 @@ struct pdcp_netlink_element_s { //TTN for D2D (PC5S) #define PDCP_SOCKET_PORT_NO 9999 //temporary value #define PC5_SIGNALLING_PAYLOAD_SIZE 100 //should be updated with a correct value -int pdcp_pc5_sockfd; -struct sockaddr_in prose_ctrl_addr; -struct sockaddr_in prose_pdcp_addr; -struct sockaddr_in pdcp_sin; +extern int pdcp_pc5_sockfd; +extern struct sockaddr_in prose_ctrl_addr; +extern struct sockaddr_in prose_pdcp_addr; +extern struct sockaddr_in pdcp_sin; void pdcp_pc5_socket_init(void); typedef struct { @@ -500,28 +501,18 @@ typedef struct { #define REORDERING_WINDOW_SN_7BIT 64 #define REORDERING_WINDOW_SN_12BIT 2048 -signed int pdcp_2_nas_irq; -pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; -pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; +extern signed int pdcp_2_nas_irq; +extern pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; +extern pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; // for UE code conly -rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; -rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode -unsigned int pdcp_eNB_UE_instance_to_rnti_index; - -pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h - -sdu_size_t pdcp_output_sdu_bytes_to_write; -sdu_size_t pdcp_output_header_bytes_to_write; -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]; -sdu_size_t pdcp_input_index_header; -sdu_size_t pdcp_input_sdu_size_read; -sdu_size_t pdcp_input_sdu_remaining_size_to_read; +extern rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; +extern rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode +extern unsigned int pdcp_eNB_UE_instance_to_rnti_index; + + +extern notifiedFIFO_t pdcp_sdu_list; #define PDCP_COLL_KEY_VALUE(mODULE_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ ((hash_key_t)mODULE_iD | \ diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 687d7b1bfefaf905f75e31dfd8f8c8f4ff4f0ad4..8ff3c06cd4005156fd1bab5d7a784c42a61e5082 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -78,9 +78,6 @@ extern int nas_sock_fd[MAX_MOBILES_PER_ENB]; extern int nas_sock_mbms_fd; -extern int mbms_rab_id; - - extern struct msghdr nas_msg_tx; extern struct msghdr nas_msg_rx; @@ -113,8 +110,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { * PDCP packet to pick the right socket below */ int rb_id = pdcpHead->rb_id; - int sizeToWrite= sizeof (pdcp_data_ind_header_t) + - pdcpHead->data_size; void * pdcpData=(void*)(pdcpHead+1); if (rb_id == 10) { //hardcoded for PC5-Signaling if( LOG_DEBUGFLAG(DEBUG_PDCP) ) { @@ -128,24 +123,25 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { } else if (UE_NAS_USE_TUN) { //ret = write(nas_sock_fd[pdcpHead->inst], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); if(rb_id == mbms_rab_id){ - ret = write(nas_sock_mbms_fd, pdcpData,sizeToWrite ); + ret = write(nas_sock_mbms_fd, pdcpData, pdcpHead->data_size ); 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[pdcpHead->inst],sizeToWrite); + ret,rb_id,nas_sock_fd[pdcpHead->inst],pdcpHead->data_size); } else { 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[pdcpHead->inst], pdcpData,sizeToWrite ); + log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[pdcpHead->inst], pdcpData,pdcpHead->data_size ); 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[pdcpHead->inst],sizeToWrite); + ret,rb_id,nas_sock_fd[pdcpHead->inst],pdcpHead->data_size); } } else if (ENB_NAS_USE_TUN) { 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); + log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[0], pdcpData, pdcpHead->data_size); + 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],pdcpHead->data_size); } else if (PDCP_USE_NETLINK) { + int sizeToWrite= sizeof (pdcp_data_ind_header_t) + pdcpHead->data_size; 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); @@ -154,7 +150,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { 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( LOG_DEBUGFLAG(DEBUG_PDCP) ) - log_dump(PDCP, pdcpData, min(sizeToWrite,30) , LOG_DUMP_CHAR, + log_dump(PDCP, pdcpData, min(pdcpHead->data_size,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 ++; @@ -377,7 +373,6 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx protocol_ctxt_t ctxt; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; - module_id_t ue_id = 0; pdcp_t *pdcp_p = NULL; static unsigned char pdcp_read_state_g =0; rb_id_t rab_id = 0; @@ -471,30 +466,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx } else { // rb_id =0, thus interpreated as broadcast and transported as multiple unicast // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs //#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES - for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) { - if (oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id] != NOT_A_RNTI) { - ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id]; - LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n", - ctxt.frame, - pdcp_read_header_g.inst, - pdcp_read_header_g.rb_id, - pdcp_read_header_g.data_size, - ctxt.module_id, - ctxt.rnti, - DEFAULT_RAB_ID); - pdcp_data_req ( - &ctxt, - SRB_FLAG_NO, - DEFAULT_RAB_ID, - RLC_MUI_UNDEFINED, - RLC_SDU_CONFIRM_NO, - pdcp_read_header_g.data_size, - (unsigned char *)NLMSG_DATA(nas_nlh_rx), - PDCP_TRANSMISSION_MODE_DATA - ,NULL, NULL - ); - } - } + // never finished code, dropped } } else { // ctxt.enb_flag => UE if (NFAPI_MODE == NFAPI_UE_STUB_PNF) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 6898c9e447421ab954a86a21dd3c6dd387da45bb..32bf5aa13c7793f07732c4af25d208f6133f45ec 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -30,6 +30,8 @@ #define PROTO_AGENT_H_ #include "ENB_APP/enb_config.h" // for enb properties #include "proto_agent_common.h" +#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" +#include "RRC/NR/nr_rrc_defs.h" void *proto_agent_receive(void *args); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index bf6579955ba7985ef2b8daf88cec310b5fd47c95..36500c3d163be3d73ca9f418ea8276fa8577489a 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -319,13 +319,15 @@ error: } int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { +/* code useless in this status: return 0 anyways rlc_op_status_t result = 0; - //printf("PROTO_AGENT: handling the data_req_ack message\n"); + printf("PROTO_AGENT: handling the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; result = data_ack->result; - //printf("PROTO_AGENT: ACK RESULT IS %u\n", result); + printf("PROTO_AGENT: ACK RESULT IS %u\n", result); ack_result = result; +*/ return 0; } @@ -365,17 +367,23 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto if (!pdcp_pdu_p) goto error; memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); - result = rlc_data_req(&ctxt_pP - ,srb_flagP - ,flag_MBMS - ,rb_idP - ,muiP - ,confirmP - ,pdcp_pdu_size - ,pdcp_pdu_p - ,NULL - ,NULL - ); + // result = rlc_data_req(&ctxt_pP + // ,srb_flagP + // ,flag_MBMS + // ,rb_idP + // ,muiP + // ,confirmP + // ,pdcp_pdu_size + // ,pdcp_pdu_p + // ,NULL + // ,NULL + // ); + LOG_D(PROTO_AGENT, "proto_agent received pdcp_data_req \n"); + // for (int i = 0; i < pdcp_pdu_size; i++) + // printf(" %2.2x", (unsigned char)pdcp_pdu_p->data[i]); + // printf("\n"); + du_rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + result = 1; return result; error: @@ -522,6 +530,8 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto ctxt_pP.rnti = ctxt->fsp_rnti; ctxt_pP.frame = ctxt->fsp_frame; ctxt_pP.subframe = ctxt->fsp_subframe; + ctxt_pP.configured = 1; + ctxt_pP.brOption = 0; ctxt_pP.eNB_index = ctxt->fsp_enb_index; srb_flagP = rlc_data->fsp_srb_flag; flag_MBMS = rlc_data->fsp_mbms_flag; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index c805b8154339cb654521969847708f0654424086..8f553e05e1db1401358c4fa0dc9dc5d5624b8d42 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -62,7 +62,6 @@ typedef int (*proto_agent_message_destruction_callback)( ); -uint32_t ack_result; /********************************** * progRAN protocol messages helper diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 9a63427ed5887111ba21b9863da5e738763ad239..925c11c8f81907b4869f681f7d3ffe93fdbed9dc 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -30,7 +30,7 @@ #include "common/utils/LOG/log.h" proto_agent_channel_t *proto_channel[NUMBER_OF_eNB_MAX][ENB_AGENT_MAX]; -proto_agent_channel_instance_t channel_instance; +static proto_agent_channel_instance_t channel_instance; int proto_agent_channel_id = 0; int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) { diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c index fda84879be06681705e62bbd15b1b7fe3f769284..cf77f9ec37f6992fa829a35ce2f5f5d035c362d1 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c @@ -80,6 +80,8 @@ static int g_send_id_read_index[2]; static struct mac_data_ind g_tx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ]; static struct mac_data_ind g_rx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ]; +static rlc_um_entity_t um_tx; +static rlc_um_entity_t um_rx; static int8_t *g_sdus[] = {"En dépit de son volontarisme affiché, le premier ministre est de plus en plus décrié pour son incompétence. La tension politique et dans l'opinion publique est encore montée d'un cran au Japon, sur fond d'inquiétantes nouvelles, avec du plutonium détecté dans le sol autour de la centrale de Fukushima. Le premier ministre Naoto Kan a solennellement déclaré que son gouvernement était «en état d'alerte maximum». Tout en reconnaissant que la situation restait «imprévisible». Ce volontarisme affiché par le premier ministre - que Nicolas Sarkozy rencontrera demain lors d'une visite au Japon - ne l'a pas empêché d'être la cible de violentes critiques de la part de parlementaires sur sa gestion de la crise. Attaqué sur le manque de transparence, il a assuré qu'il rendait publiques toutes les informations en sa possession. Un député de l'opposition, Yosuke Isozaki, a aussi reproché à Naoto Kan de ne pas avoir ordonné l'évacuation des populations dans la zone comprise entre 20 et 30 km autour de la centrale. «Peut-il y avoir quelque chose de plus irresponsable que cela ?», a-t-il lancé. Pour l'heure, la zone d'évacuation est limitée à un rayon de 20 km, seul le confinement étant recommandé pour les 10 km suivants. Sur ce sujet, les autorités japonaises ont été fragilisées mardi par les déclarations de Greenpeace, affirmant que ses experts avaient détecté une radioactivité dangereuse à 40 km de la centrale. L'organisation écologiste a appelé à une extension de la zone d'évacuation, exhortant Tokyo à «cesser de privilégier la politique aux dépens de la science». L'Agence japonaise de sûreté nucléaire a balayé ces critiques.", diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h index 6da464aa28ef0894808a884c628231a5020cfecf..bfde1b31f35f286ae8d928011363468a059ffa0e 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h @@ -21,8 +21,6 @@ # ifndef __RLC_UM_TEST_H__ # define __RLC_UM_TEST_H__ -rlc_um_entity_t um_tx; -rlc_um_entity_t um_rx; void rlc_um_v9_3_0_test_windows_5(void); void rlc_um_v9_3_0_test_windows_10(void); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 98c8c3e252da05ebe81b4f237b2078f07ffe39d7..b9dcf0414b99024195fe1a6bdc26f4ba7e10ef06 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -36,6 +36,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "targets/COMMON/openairinterface5g_limits.h" #include "assertions.h" +#include <rlc.h> #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -51,7 +52,27 @@ extern boolean_t pdcp_data_ind( #define DEBUG_RLC_PDCP_INTERFACE 1 //#define TRACE_RLC_PAYLOAD 1 #define DEBUG_RLC_DATA_REQ 1 +void (*rlc_rrc_data_conf)( + const protocol_ctxt_t *const ctxtP, + const rb_id_t rb_idP, + const mui_t muiP, + const rlc_tx_status_t statusP) __attribute__ ((aligned(32))); + +void (*rlc_rrc_data_ind)( + const protocol_ctxt_t *const ctxtP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + const uint8_t *const sduP) __attribute__ ((aligned(32))); + +logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); + +logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ //----------------------------------------------------------------------------- void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP) //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 7e4920a579c1b76a8971f96bca1283f876fecd27..1e5b7947d7a384f209776fce7a9af2136e3eda04 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -133,13 +133,13 @@ typedef struct { #define RLC_MAX_MBMS_LC (LTE_maxSessionPerPMCH * LTE_maxServiceCount) #define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) -void (*rlc_rrc_data_ind)( +extern void (*rlc_rrc_data_ind)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, const uint8_t *const sduP) __attribute__ ((aligned(32))); -void (*rlc_rrc_data_conf)( +extern void (*rlc_rrc_data_conf)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const mui_t muiP, @@ -184,8 +184,8 @@ typedef struct rlc_mbms_id_s { //rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h //rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h #define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] ; @@ -201,8 +201,8 @@ rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_ rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] = lOG_cH_iD; \ } while (0); -logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ -logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +extern logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +extern logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ #define RLC_COLL_KEY_VALUE(eNB_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ @@ -250,7 +250,7 @@ logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; (((hash_key_t)(sESSION_ID)) << 37) | \ (((hash_key_t)(0x0000000000000001)) << 63)) -hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); +extern hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); /*! \fn tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP) * \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC. @@ -624,6 +624,14 @@ rlc_op_status_t rlc_stat_req ( */ int rlc_module_init(int enb_flag); +void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP); /** @} */ #define RLC_FG_COLOR_BLACK "\e[0;30m" diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp.h b/openair2/LAYER2/nr_pdcp/nr_pdcp.h new file mode 100644 index 0000000000000000000000000000000000000000..a5f182c822a5531289c14cee9018a53ecc1dc593 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp.h @@ -0,0 +1,31 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include <stdint.h> + +#ifndef _NR_PDCP_H_ +#define _NR_PDCP_H_ + +void pdcp_layer_init_for_CU(void); +void nr_pdcp_layer_init_ue(void); +void nr_DRB_preconfiguration(uint16_t crnti); + +#endif /* _NR_PDCP_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index eda6888ecdc2e0c58dd70ce57f1a1638f31c1553..edf342dc964ce131524f72976515b179c998d18e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -26,6 +26,7 @@ #include <string.h> #include "nr_pdcp_security_nea2.h" +#include "nr_pdcp_integrity_nia2.h" #include "nr_pdcp_sdu.h" #include "LOG/log.h" @@ -48,23 +49,29 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, return; } - if (!(buffer[0] & 0x80)) { + if (entity->type != NR_PDCP_SRB && + !(buffer[0] & 0x80)) { LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } if (entity->sn_size == 12) { - rcvd_sn = (((unsigned char)buffer[0] & 0xf) << 8) | - (unsigned char)buffer[1]; + rcvd_sn = ((buffer[0] & 0xf) << 8) | + buffer[1]; header_size = 2; } else { - rcvd_sn = (((unsigned char)buffer[0] & 0x3) << 16) | - ((unsigned char)buffer[1] << 8) | - (unsigned char)buffer[2]; + rcvd_sn = ((buffer[0] & 0x3) << 16) | + (buffer[1] << 8) | + buffer[2]; header_size = 3; } - - integrity_size = 0; + /* SRBs always have MAC-I, even if integrity is not active */ + if (entity->has_integrity + || entity->type == NR_PDCP_SRB) { + integrity_size = 4; + } else { + integrity_size = 0; + } if (size < header_size + integrity_size + 1) { LOG_E(PDCP, "bad PDU received (size = %d)\n", size); @@ -86,9 +93,19 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (entity->has_ciphering) entity->cipher(entity->security_context, - (unsigned char *)buffer+header_size, size-header_size, + buffer+header_size, size-header_size, entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1); + if (entity->has_integrity) { + unsigned char integrity[4]; + entity->integrity(entity->integrity_context, integrity, + buffer, size - integrity_size, + entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1); + if (memcmp(integrity, buffer + size - integrity_size, 4) != 0) { + LOG_E(PDCP, "discard NR PDU, integrity failed\n"); + } + } + if (rcvd_count < entity->rx_deliv || nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) { LOG_D(PDCP, "discard NR PDU rcvd_count=%d\n", rcvd_count); @@ -139,39 +156,116 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, uint32_t count; int sn; int header_size; - char buf[size+3+4]; + int integrity_size; + char buf[size + 3 + 4]; + int dc_bit; count = entity->tx_next; sn = entity->tx_next & entity->sn_max; + /* D/C bit is only to be set for DRBs */ + if (entity->type == NR_PDCP_DRB_AM || entity->type == NR_PDCP_DRB_UM) { + dc_bit = 0x80; + } else { + dc_bit = 0; + } + if (entity->sn_size == 12) { - buf[0] = 0x80 | ((sn >> 8) & 0xf); + buf[0] = dc_bit | ((sn >> 8) & 0xf); buf[1] = sn & 0xff; header_size = 2; } else { - buf[0] = 0x80 | ((sn >> 16) & 0x3); + buf[0] = dc_bit | ((sn >> 16) & 0x3); buf[1] = (sn >> 8) & 0xff; buf[2] = sn & 0xff; header_size = 3; } - memcpy(buf+header_size, buffer, size); + /* SRBs always have MAC-I, even if integrity is not active */ + if (entity->has_integrity + || entity->type == NR_PDCP_SRB) { + integrity_size = 4; + } else { + integrity_size = 0; + } + + memcpy(buf + header_size, buffer, size); + + if (entity->has_integrity) + entity->integrity(entity->integrity_context, + (unsigned char *)buf + header_size + size, + (unsigned char *)buf, header_size + size, + entity->rb_id, count, entity->is_gnb ? 1 : 0); + else if (integrity_size == 4) + /* set MAC-I to 0 for SRBs with integrity not active */ + memset(buf + header_size + size, 0, 4); if (entity->has_ciphering) entity->cipher(entity->security_context, - (unsigned char *)buf+header_size, size, + (unsigned char *)buf + header_size, size + integrity_size, entity->rb_id, count, entity->is_gnb ? 1 : 0); entity->tx_next++; entity->deliver_pdu(entity->deliver_pdu_data, entity, buf, - size+header_size, sdu_id); + header_size + size + integrity_size, sdu_id); } -static void nr_pdcp_entity_set_integrity_key(nr_pdcp_entity_t *entity, - char *key) +/* may be called several times, take care to clean previous settings */ +static void nr_pdcp_entity_set_security(nr_pdcp_entity_t *entity, + int integrity_algorithm, + char *integrity_key, + int ciphering_algorithm, + char *ciphering_key) { - memcpy(entity->integrity_key, key, 16); + if (integrity_algorithm != -1) + entity->integrity_algorithm = integrity_algorithm; + if (ciphering_algorithm != -1) + entity->ciphering_algorithm = ciphering_algorithm; + if (integrity_key != NULL) + memcpy(entity->integrity_key, integrity_key, 16); + if (ciphering_key != NULL) + memcpy(entity->ciphering_key, ciphering_key, 16); + + if (integrity_algorithm == 0) { + entity->has_integrity = 0; + if (entity->free_integrity != NULL) + entity->free_integrity(entity->integrity_context); + entity->free_integrity = NULL; + } + + if (integrity_algorithm != 0 && integrity_algorithm != -1) { + if (integrity_algorithm != 2) { + LOG_E(PDCP, "FATAL: only nia2 supported for the moment\n"); + exit(1); + } + entity->has_integrity = 1; + if (entity->free_integrity != NULL) + entity->free_integrity(entity->integrity_context); + entity->integrity_context = nr_pdcp_integrity_nia2_init(entity->integrity_key); + entity->integrity = nr_pdcp_integrity_nia2_integrity; + entity->free_integrity = nr_pdcp_integrity_nia2_free_integrity; + } + + if (ciphering_algorithm == 0) { + entity->has_ciphering = 0; + if (entity->free_security != NULL) + entity->free_security(entity->security_context); + entity->free_security = NULL; + } + + if (ciphering_algorithm != 0 && ciphering_algorithm != -1) { + if (ciphering_algorithm != 2) { + LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n"); + exit(1); + } + entity->has_ciphering = 1; + if (entity->free_security != NULL) + entity->free_security(entity->security_context); + entity->security_context = nr_pdcp_security_nea2_init(entity->ciphering_key); + entity->cipher = nr_pdcp_security_nea2_cipher; + entity->free_security = nr_pdcp_security_nea2_free_security; + } } static void check_t_reordering(nr_pdcp_entity_t *entity) @@ -232,12 +326,14 @@ void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity) } if (entity->free_security != NULL) entity->free_security(entity->security_context); + if (entity->free_integrity != NULL) + entity->free_integrity(entity->integrity_context); free(entity); } nr_pdcp_entity_t *new_nr_pdcp_entity( nr_pdcp_entity_type_t type, - int is_gnb, int rb_id, + int is_gnb, int rb_id, int pdusession_id, void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), void *deliver_sdu_data, @@ -262,10 +358,10 @@ nr_pdcp_entity_t *new_nr_pdcp_entity( ret->type = type; - ret->recv_pdu = nr_pdcp_entity_recv_pdu; - ret->recv_sdu = nr_pdcp_entity_recv_sdu; - ret->set_integrity_key = nr_pdcp_entity_set_integrity_key; - ret->set_time = nr_pdcp_entity_set_time; + ret->recv_pdu = nr_pdcp_entity_recv_pdu; + ret->recv_sdu = nr_pdcp_entity_recv_sdu; + ret->set_security = nr_pdcp_entity_set_security; + ret->set_time = nr_pdcp_entity_set_time; ret->delete = nr_pdcp_entity_delete; @@ -276,6 +372,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity( ret->deliver_pdu_data = deliver_pdu_data; ret->rb_id = rb_id; + ret->pdusession_id = pdusession_id; ret->sn_size = sn_size; ret->t_reordering = t_reordering; ret->discard_timer = discard_timer; @@ -283,25 +380,11 @@ nr_pdcp_entity_t *new_nr_pdcp_entity( ret->sn_max = (1 << sn_size) - 1; ret->window_size = 1 << (sn_size - 1); - if (ciphering_key != NULL && ciphering_algorithm != 0) { - if (ciphering_algorithm != 2) { - LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n"); - exit(1); - } - ret->has_ciphering = 1; - ret->ciphering_algorithm = ciphering_algorithm; - memcpy(ret->ciphering_key, ciphering_key, 16); - - ret->security_context = nr_pdcp_security_nea2_init(ciphering_key); - ret->cipher = nr_pdcp_security_nea2_cipher; - ret->free_security = nr_pdcp_security_nea2_free_security; - } ret->is_gnb = is_gnb; - if (integrity_key != NULL) { - printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } + nr_pdcp_entity_set_security(ret, + integrity_algorithm, (char *)integrity_key, + ciphering_algorithm, (char *)ciphering_key); return ret; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index 36e7a540c4d6736f0be73ba9303d710461133f31..f8f09d1532ce4fb2a6aa7dc561caa7b867336f44 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -40,7 +40,16 @@ typedef struct nr_pdcp_entity_t { void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size, int sdu_id); void (*delete)(struct nr_pdcp_entity_t *entity); - void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key); + /* set_security: pass -1 to integrity_algorithm / ciphering_algorithm + * to keep the current algorithm + * pass NULL to integrity_key / ciphering_key + * to keep the current key + */ + void (*set_security)(struct nr_pdcp_entity_t *entity, + int integrity_algorithm, + char *integrity_key, + int ciphering_algorithm, + char *ciphering_key); void (*set_time)(struct nr_pdcp_entity_t *entity, uint64_t now); /* callbacks provided to the PDCP module */ @@ -53,7 +62,7 @@ typedef struct nr_pdcp_entity_t { /* configuration variables */ int rb_id; - + int pdusession_id; int sn_size; /* SN size, in bits */ int t_reordering; /* unit: ms */ int discard_timer; /* unit: ms */ @@ -85,7 +94,12 @@ typedef struct nr_pdcp_entity_t { unsigned char *buffer, int length, int bearer, int count, int direction); void (*free_security)(void *security_context); - /* security algorithms need to know uplink/downlink information + void *integrity_context; + void (*integrity)(void *integrity_context, unsigned char *out, + unsigned char *buffer, int length, + int bearer, int count, int direction); + void (*free_integrity)(void *integrity_context); + /* security/integrity algorithms need to know uplink/downlink information * which is reverse for gnb and ue, so we need to know if this * pdcp entity is for a gnb or an ue */ @@ -99,7 +113,7 @@ typedef struct nr_pdcp_entity_t { nr_pdcp_entity_t *new_nr_pdcp_entity( nr_pdcp_entity_type_t type, - int is_gnb, int rb_id, + int is_gnb, int rb_id, int pdusession_id, void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), void *deliver_sdu_data, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c new file mode 100644 index 0000000000000000000000000000000000000000..73840aeb0aae0da858d99c4bfd9cf2da841229ed --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c @@ -0,0 +1,75 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nr_pdcp_entity_srb.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +void nr_pdcp_entity_srb_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size) +{ + nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity; + + if (size < 2) abort(); + entity->common.deliver_sdu(entity->common.deliver_sdu_data, + (nr_pdcp_entity_t *)entity, buffer+2, size-6); +} + +void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size, + int sdu_id) +{ + nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity; + int sn; + char buf[size+6]; + + sn = entity->common.next_nr_pdcp_tx_sn; + + entity->common.next_nr_pdcp_tx_sn++; + if (entity->common.next_nr_pdcp_tx_sn > entity->common.maximum_nr_pdcp_sn) { + entity->common.next_nr_pdcp_tx_sn = 0; + entity->common.tx_hfn++; + } + + buf[0] = (sn >> 8) & 0x0f; + buf[1] = sn & 0xff; + memcpy(buf+2, buffer, size); + + /* For now use padding for the MAC-I bytes (normally carrying message authentication code) + * which come after the data payload bytes (38.323, section 6.2.2.1) */ + for (int i=size+2; i<size+6; i++) + buf[i] = 0x11*(i-size-1); + + entity->common.deliver_pdu(entity->common.deliver_pdu_data, + (nr_pdcp_entity_t *)entity, buf, size+6, sdu_id); +} + +void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key) +{ + /* nothing to do */ +} + +void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity) +{ + nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity; + free(entity); +} + diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h new file mode 100644 index 0000000000000000000000000000000000000000..f0f9d3e28f200c47e781064b3fb6fe22f750b33f --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h @@ -0,0 +1,38 @@ + /* + * 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 _NR_PDCP_ENTITY_SRB_H_ +#define _NR_PDCP_ENTITY_SRB_H_ + +#include "nr_pdcp_entity.h" + +typedef struct { + nr_pdcp_entity_t common; + int srb_id; +} nr_pdcp_entity_srb_t; + +void nr_pdcp_entity_srb_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size); +void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size, int sdu_id); +void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key); +void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity); + + +#endif /* _NR_PDCP_ENTITY_SRB_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c new file mode 100644 index 0000000000000000000000000000000000000000..86f05586114e439201e9aee59ac57db2a9084025 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c @@ -0,0 +1,82 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nr_pdcp_integrity_nia2.h" + +#include <stdlib.h> +#include <string.h> +#include <stdint.h> +#include <openssl/cmac.h> + +void *nr_pdcp_integrity_nia2_init(unsigned char *integrity_key) +{ + CMAC_CTX *ctx; + + ctx = CMAC_CTX_new(); + if (ctx == NULL) abort(); + + CMAC_Init(ctx, integrity_key, 16, EVP_aes_128_cbc(), NULL); + + return ctx; +} + +static void compute_t(unsigned char *t, uint32_t count, int bearer, + int direction) +{ + t[0] = (count >> 24) & 255; + t[1] = (count >> 16) & 255; + t[2] = (count >> 8) & 255; + t[3] = (count ) & 255; + t[4] = ((bearer-1) << 3) | (direction << 2); + memset(&t[5], 0, 8-5); +} + +void nr_pdcp_integrity_nia2_integrity(void *integrity_context, + unsigned char *out, + unsigned char *buffer, int length, + int bearer, int count, int direction) +{ + CMAC_CTX *ctx = integrity_context; + unsigned char t[8]; + unsigned char mac[16]; + size_t maclen; + + /* see 33.401 B.2.3 for the input to 128-EIA2 + * (which is identical to 128-NIA2, see 33.501 D.3.1.3) */ + compute_t(t, count, bearer, direction); + + CMAC_Init(ctx, NULL, 0, NULL, NULL); + CMAC_Update(ctx, t, 8); + CMAC_Update(ctx, buffer, length); + CMAC_Final(ctx, mac, &maclen); + + /* AES CMAC (RFC 4493) outputs 128 bits but NR PDCP PDUs have a MAC-I of + * 32 bits (see 38.323 6.2). RFC 4493 2.1 says to truncate most significant + * bit first (so seems to say 33.401 B.2.3) + */ + memcpy(out, mac, 4); +} + +void nr_pdcp_integrity_nia2_free_integrity(void *integrity_context) +{ + CMAC_CTX *ctx = integrity_context; + CMAC_CTX_free(ctx); +} diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.h new file mode 100644 index 0000000000000000000000000000000000000000..9593a2825c0022e384f7bcc9d45711f10fb29264 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.h @@ -0,0 +1,34 @@ +/* + * 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 _NR_PDCP_INTEGRITY_NIA2_H_ +#define _NR_PDCP_INTEGRITY_NIA2_H_ + +void *nr_pdcp_integrity_nia2_init(unsigned char *integrity_key); + +void nr_pdcp_integrity_nia2_integrity(void *integrity_context, + unsigned char *out, + unsigned char *buffer, int length, + int bearer, int count, int direction); + +void nr_pdcp_integrity_nia2_free_integrity(void *integrity_context); + +#endif /* _NR_PDCP_INTEGRITY_NIA2_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 597cba7bf52a8021aaed239de9055a68f5260446..dd7bfb97bb924d5159525a1a7f9bbd0e8664ffec 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -30,10 +30,12 @@ #include "NR_RLC-Config.h" #include "NR_CellGroupConfig.h" #include "openair2/RRC/NR/nr_rrc_proto.h" +#include <stdint.h> /* from OAI */ #include "pdcp.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" +#include <openair3/ocp-gtpu/gtp_itf.h> #define TODO do { \ printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \ @@ -51,6 +53,10 @@ static int nr_pdcp_current_time_last_subframe; hash_table_t *pdcp_coll_p; static uint64_t pdcp_optmask; +ngran_node_t node_type = ngran_gNB; +uint8_t first_dcch = 0; +uint8_t proto_agent_flag = 0; + /****************************************************************************/ /* rlc_data_req queue - begin */ /****************************************************************************/ @@ -185,6 +191,26 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, if (pthread_mutex_unlock(&q.m) != 0) abort(); } +void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP) +{ + enqueue_rlc_data_req(ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, muiP, + confirmP, + sdu_sizeP, + sdu_pP, + NULL, + NULL); +} + /****************************************************************************/ /* rlc_data_req queue - end */ /****************************************************************************/ @@ -349,6 +375,22 @@ void pdcp_layer_init(void) nr_pdcp_init_timer_thread(nr_pdcp_ue_manager); } +void pdcp_layer_init_for_CU(void) +{ + /* hack: be sure to initialize only once */ + static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; + static int initialized = 0; + if (pthread_mutex_lock(&m) != 0) abort(); + if (initialized) { + if (pthread_mutex_unlock(&m) != 0) abort(); + return; + } + initialized = 1; + if (pthread_mutex_unlock(&m) != 0) abort(); + + nr_pdcp_ue_manager = new_nr_pdcp_ue_manager(1); +} + #include "nfapi/oai_integration/vendor_ext.h" #include "targets/RT/USER/lte-softmodem.h" #include "openair2/RRC/NAS/nas_config.h" @@ -440,17 +482,17 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, size + GTPU_HEADER_OVERHEAD_MAX); AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size); - message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); + message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ); AssertFatal(message_p != NULL, "OUT OF MEMORY"); - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size; - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti; - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; + GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; + GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size; + GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; + GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti; + GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = entity->pdusession_id; LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]); //printf("\n"); - itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); } } @@ -490,12 +532,111 @@ rb_found: memblock = get_free_mem_block(size, __FUNCTION__); memcpy(memblock->data, buf, size); - LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); + LOG_I(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); //printf("\n"); enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock, NULL, NULL); } +static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, + char *buf, int size) +{ + nr_pdcp_ue_t *ue = _ue; + int srb_id; + int i; + + for (i = 0; i < 3; i++) { + if (entity == ue->srb[i]) { + srb_id = i+1; + goto srb_found; + } + } + + LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for ue %d\n", + __FILE__, __LINE__, __FUNCTION__, ue->rnti); + exit(1); + + srb_found: + { + uint8_t *rrc_buffer_p = entity->is_gnb ? + itti_malloc(TASK_PDCP_ENB, TASK_RRC_GNB, size): + itti_malloc(TASK_PDCP_UE, TASK_RRC_NRUE, size); + MessageDef *message_p; + + AssertFatal(rrc_buffer_p != NULL, "OUT OF MEMORY"); + memcpy(rrc_buffer_p, buf, size); + message_p = entity->is_gnb ? + itti_alloc_new_message(TASK_PDCP_ENB, 0, NR_RRC_DCCH_DATA_IND): + itti_alloc_new_message(TASK_PDCP_UE, 0, NR_RRC_DCCH_DATA_IND); + + AssertFatal(message_p != NULL, "OUT OF MEMORY"); + NR_RRC_DCCH_DATA_IND(message_p).dcch_index = srb_id; + NR_RRC_DCCH_DATA_IND(message_p).sdu_p = rrc_buffer_p; + NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size; + NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->rnti; + + itti_send_msg_to_task(entity->is_gnb ? TASK_RRC_GNB : TASK_RRC_NRUE, 0, message_p); + } +} + +static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity, + char *buf, int size, int sdu_id) +{ + nr_pdcp_ue_t *ue = _ue; + int srb_id; + protocol_ctxt_t ctxt; + int i; + mem_block_t *memblock; + + for (i = 0; i < 3; i++) { + if (entity == ue->srb[i]) { + srb_id = i+1; + goto srb_found; + } + } + + LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for ue %d\n", + __FILE__, __LINE__, __FUNCTION__, ue->rnti); + exit(1); + +srb_found: + + + LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, srb_id, size); + //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); + //printf("\n"); + if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) { + ctxt.module_id = 0; + ctxt.enb_flag = 1; + ctxt.instance = 0; + ctxt.frame = 0; + ctxt.subframe = 0; + ctxt.eNB_index = 0; + ctxt.configured = 1; + ctxt.brOption = 0; + + ctxt.rnti = ue->rnti; + + memblock = get_free_mem_block(size, __FUNCTION__); + memcpy(memblock->data, buf, size); + enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL); + } + else { + MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t*)buf; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = size; + F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).rnti = ue->rnti; + F1AP_DL_RRC_MESSAGE (message_p).srb_id = srb_id; + F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; + F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, 0, message_p); + LOG_D(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + } +} + boolean_t pdcp_data_ind( const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, @@ -560,10 +701,12 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) while (1) { itti_poll_msg(ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p); - if (msg_p == NULL) - break; + if (msg_p == NULL){ + break; + } switch (ITTI_MSG_ID(msg_p)) { case RRC_DCCH_DATA_REQ: + LOG_I(PDCP, "Received RRC_DCCH_DATA_REQ type at PDCP task \n"); PROTOCOL_CTXT_SET_BY_MODULE_ID( &ctxt, RRC_DCCH_DATA_REQ(msg_p).module_id, @@ -594,9 +737,33 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) } } -static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) +static void add_srb(int is_gnb, int rnti, struct NR_SRB_ToAddMod *s) { - TODO; + nr_pdcp_entity_t *pdcp_srb; + nr_pdcp_ue_t *ue; + int t_Reordering=3000; + + int srb_id = s->srb_Identity; + if (s->pdcp_Config == NULL || + s->pdcp_Config->t_Reordering == NULL) t_Reordering = 3000; + else t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering); + + nr_pdcp_manager_lock(nr_pdcp_ue_manager); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + if (ue->srb[srb_id-1] != NULL) { + LOG_D(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n", + __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + } else { + pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id, 0, + deliver_sdu_srb, ue, deliver_pdu_srb, ue, + 12, t_Reordering, -1, + 0, 0, + NULL, NULL); + nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb); + + LOG_D(PDCP, "%s:%d:%s: added srb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + } + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, @@ -613,7 +780,21 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, int sn_size_ul = decode_sn_size_ul(*s->pdcp_Config->drb->pdcp_SN_SizeUL); int sn_size_dl = decode_sn_size_dl(*s->pdcp_Config->drb->pdcp_SN_SizeDL); int discard_timer = decode_discard_timer(*s->pdcp_Config->drb->discardTimer); - + if ((!s->cnAssociation) || s->cnAssociation->present == NR_DRB_ToAddMod__cnAssociation_PR_NOTHING) { + LOG_E(PDCP,"%s:%d:%s: fatal, cnAssociation is missing or present is NR_DRB_ToAddMod__cnAssociation_PR_NOTHING\n",__FILE__,__LINE__,__FUNCTION__); + exit(-1); + } + + int pdusession_id; + if (s->cnAssociation->present == NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity) + pdusession_id = s->cnAssociation->choice.eps_BearerIdentity; + else { + if (!s->cnAssociation->choice.sdap_Config) { + LOG_E(PDCP,"%s:%d:%s: fatal, sdap_Config is null",__FILE__,__LINE__,__FUNCTION__); + exit(-1); + } + pdusession_id = s->cnAssociation->choice.sdap_Config->pdu_Session; + } /* TODO(?): accept different UL and DL SN sizes? */ if (sn_size_ul != sn_size_dl) { LOG_E(PDCP, "%s:%d:%s: fatal, bad SN sizes, must be same. ul=%d, dl=%d\n", @@ -633,7 +814,7 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } else { - pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id, + pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id, deliver_sdu_drb, ue, deliver_pdu_drb, ue, sn_size_dl, t_reordering, discard_timer, ciphering_algorithm, integrity_algorithm, @@ -710,7 +891,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req( if (srb2add_list != NULL) { for (i = 0; i < srb2add_list->list.count; i++) { - add_srb(rnti, srb2add_list->list.array[i]); + add_srb(ctxt_pP->enb_flag,rnti, srb2add_list->list.array[i]); } } @@ -754,6 +935,7 @@ boolean_t rrc_pdcp_config_asn1_req( return 0; } + void nr_DRB_preconfiguration(uint16_t crnti) { @@ -776,7 +958,7 @@ void nr_DRB_preconfiguration(uint16_t crnti) drb_ToAddMod->pdcp_Config = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config)); drb_ToAddMod->pdcp_Config->drb = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb)); drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer)); - *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_ms30; + *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_infinity; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL)); *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len12bits; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL)); @@ -804,10 +986,12 @@ void nr_DRB_preconfiguration(uint16_t crnti) rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse)); *rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master; - xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + } NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); - nr_rlc_bearer_init(RLC_BearerConfig); + nr_rlc_bearer_init(RLC_BearerConfig,NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); @@ -846,6 +1030,7 @@ void nr_DRB_preconfiguration(uint16_t crnti) } + uint64_t get_pdcp_optmask(void) { return pdcp_optmask; @@ -873,37 +1058,88 @@ void pdcp_config_set_security( uint8_t *const kRRCint_pP, uint8_t *const kUPenc_pP) { - DevAssert(pdcp_pP != NULL); - - if ((security_modeP >= 0) && (security_modeP <= 0x77)) { - pdcp_pP->cipheringAlgorithm = security_modeP & 0x0f; - pdcp_pP->integrityProtAlgorithm = (security_modeP>>4) & 0xf; - LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_SET_SECURITY_MODE: cipheringAlgorithm %d integrityProtAlgorithm %d\n", - PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP), - pdcp_pP->cipheringAlgorithm, - pdcp_pP->integrityProtAlgorithm); - pdcp_pP->kRRCenc = kRRCenc_pP; - pdcp_pP->kRRCint = kRRCint_pP; - pdcp_pP->kUPenc = kUPenc_pP; - /* Activate security */ - pdcp_pP->security_activated = 1; - MSC_LOG_EVENT( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - "0 Set security ciph %X integ %x UE %"PRIx16" ", - pdcp_pP->cipheringAlgorithm, - pdcp_pP->integrityProtAlgorithm, - ctxt_pP->rnti); + nr_pdcp_ue_t *ue; + nr_pdcp_entity_t *rb; + int rnti = ctxt_pP->rnti; + int integrity_algorithm; + int ciphering_algorithm; + + nr_pdcp_manager_lock(nr_pdcp_ue_manager); + + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + + /* TODO: proper handling of DRBs, for the moment only SRBs are handled */ + + if (rb_id >= 1 && rb_id <= 3) { + rb = ue->srb[rb_id - 1]; + + if (rb == NULL) { + LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n", + __FILE__, __LINE__, __FUNCTION__, rnti, rb_id); + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); + return; + } + + integrity_algorithm = (security_modeP>>4) & 0xf; + ciphering_algorithm = security_modeP & 0x0f; + rb->set_security(rb, integrity_algorithm, (char *)kRRCint_pP, + ciphering_algorithm, (char *)kRRCenc_pP); } else { - MSC_LOG_EVENT( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - "0 Set security failed UE %"PRIx16" ", - ctxt_pP->rnti); - LOG_E(PDCP,PROTOCOL_PDCP_CTXT_FMT" bad security mode %d", - PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP), - security_modeP); + LOG_E(PDCP, "%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); +} + + +static boolean_t pdcp_data_req_srb( + protocol_ctxt_t *ctxt_pP, + const rb_id_t rb_id, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_size, + unsigned char *const sdu_buffer) +{ + LOG_D(PDCP, "%s() called, size %d\n", __func__, sdu_buffer_size); + nr_pdcp_ue_t *ue; + nr_pdcp_entity_t *rb; + int rnti = ctxt_pP->rnti; + + if (ctxt_pP->module_id != 0 || + //ctxt_pP->enb_flag != 1 || + ctxt_pP->instance != 0 || + ctxt_pP->eNB_index != 0 /*|| + ctxt_pP->configured != 1 || + ctxt_pP->brOption != 0*/) { + LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); } + + nr_pdcp_manager_lock(nr_pdcp_ue_manager); + + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + + if (rb_id < 1 || rb_id > 3) + rb = NULL; + else + rb = ue->srb[rb_id - 1]; + + if (rb == NULL) { + LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n", + __FILE__, __LINE__, __FUNCTION__, rnti, rb_id); + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); + return 0; + } + + rb->recv_sdu(rb, (char *)sdu_buffer, sdu_buffer_size, muiP); + + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); + + return 1; } + static boolean_t pdcp_data_req_drb( protocol_ctxt_t *ctxt_pP, const rb_id_t rb_id, @@ -964,9 +1200,14 @@ boolean_t pdcp_data_req( #endif ) { - if (srb_flagP) { TODO; } - return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, + if (srb_flagP) { + return pdcp_data_req_srb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer); + } + else{ + return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, + sdu_buffer); + } } void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c index f89a18f94e4a00ebc6d9654fd40c9e1a83e3499a..160c5ebb22697c70ee2b16685a97bbdd71834fb5 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c @@ -85,7 +85,7 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, int rnti) if (m->ue_list[i]->rnti == rnti) return m->ue_list[i]; - LOG_D(PDCP, "%s:%d:%s: new UE %d\n", __FILE__, __LINE__, __FUNCTION__, rnti); + LOG_D(PDCP, "%s:%d:%s: new UE 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti); m->ue_count++; m->ue_list = realloc(m->ue_list, sizeof(nr_pdcp_ue_t *) * m->ue_count); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index 1d4efc1e264b19a25b5b5ffc4feb11d6ba933249..000c764e8f1c31b8752aa35d33fa3a67722f2cc2 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -650,7 +650,7 @@ control: control_decoder = decoder; control_e1 = e1; while (control_e1) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, entity->sn_field_length); R(control_decoder); /* NACK_SN */ + nack_sn = nr_rlc_pdu_decoder_get_bits(&control_decoder, entity->sn_field_length); R(control_decoder); control_e1 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); control_e2 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); control_e3 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); @@ -660,17 +660,36 @@ control: } else { nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); } + /* check range and so_start/so_end consistency */ if (control_e2) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); /* SOstart */ - nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); /* SOend */ + so_start = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); + so_end = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); + } else { + so_start = 0; + so_end = 0xffff; } if (control_e3) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 8); R(control_decoder); /* NACK range */ + range = nr_rlc_pdu_decoder_get_bits(&control_decoder, 8); R(control_decoder); + } else { + range = 1; + } + if (range < 1) { + LOG_E(RLC, "%s:%d:%s: error, bad 'range' in RLC NACK (sn %d)\n", + __FILE__, __LINE__, __FUNCTION__, nack_sn); + goto err; + } + /* so_start can be > so_end if more than one range; they don't refer + * to the same PDU then + */ + if (range == 1 && so_end < so_start) { + LOG_E(RLC, "%s:%d:%s: error, bad so start/end (sn %d)\n", + __FILE__, __LINE__, __FUNCTION__, nack_sn); + goto err; } } /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' + * received for the SN 'poll_sn' - check ACK case (NACK done below) */ if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0) entity->t_poll_retransmit_start = 0; @@ -697,28 +716,22 @@ control: if (e2) { so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); - if (so_end < so_start) { - LOG_W(RLC, "%s:%d:%s: warning, bad so start/end, NACK the whole PDU (sn %d)\n", - __FILE__, __LINE__, __FUNCTION__, nack_sn); - so_start = 0; - so_end = -1; - } - /* special value 0xffff indicates 'all bytes to the end' */ - if (so_end == 0xffff) - so_end = -1; } else { so_start = 0; - so_end = -1; + so_end = 0xffff; } if (e3) { range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder); } else { range = 1; } + /* special value 0xffff indicates 'all bytes to the end' */ + if (so_end == 0xffff) + so_end = -1; process_received_nack(entity, nack_sn, so_start, so_end, range, sn_set); /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' + * received for the SN 'poll_sn' - check NACK case (ACK done above) */ if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 && sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index b440ee44b1b8bcf24c1c95f60fc37bda1e22dae8..5660be088637e96bc620e2c902d0a4ee6efcde84 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -35,29 +35,46 @@ #include "NR_DRB-ToReleaseList.h" #include "NR_CellGroupConfig.h" #include "NR_RLC-Config.h" +#include "common/ran_context.h" +#include "NR_UL-CCCH-Message.h" + +#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace +#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h" + +#include "openair2/LAYER2/PROTO_AGENT/proto_agent.h" + +extern RAN_CONTEXT_t RC; #include <stdint.h> #include <executables/softmodem-common.h> static nr_rlc_ue_manager_t *nr_rlc_ue_manager; +uint8_t ccch_flag = 1; /* TODO: handle time a bit more properly */ static uint64_t nr_rlc_current_time; static int nr_rlc_current_time_last_frame; static int nr_rlc_current_time_last_subframe; -void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig){ +void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR rb_type){ RLC_BearerConfig->servedRadioBearer = calloc(1, sizeof(*RLC_BearerConfig->servedRadioBearer)); RLC_BearerConfig->reestablishRLC = calloc(1, sizeof(*RLC_BearerConfig->reestablishRLC)); RLC_BearerConfig->rlc_Config = calloc(1, sizeof(*RLC_BearerConfig->rlc_Config)); RLC_BearerConfig->mac_LogicalChannelConfig = calloc(1, sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig)); - RLC_BearerConfig->logicalChannelIdentity = 4; - RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity; - RLC_BearerConfig->servedRadioBearer->choice.drb_Identity = 1; *RLC_BearerConfig->reestablishRLC = NR_RLC_BearerConfig__reestablishRLC_true; + if(rb_type == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){ + RLC_BearerConfig->logicalChannelIdentity = 4; + RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity; + RLC_BearerConfig->servedRadioBearer->choice.drb_Identity = 1; + } + else{ + RLC_BearerConfig->logicalChannelIdentity = 1; + RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity; + RLC_BearerConfig->servedRadioBearer->choice.srb_Identity = 1; + } } @@ -160,7 +177,7 @@ void mac_rlc_data_ind ( } else { LOG_E(RLC, "%s:%d:%s: fatal: no RB found (channel ID %d)\n", __FILE__, __LINE__, __FUNCTION__, channel_idP); - exit(1); + // exit(1); } nr_rlc_manager_unlock(nr_rlc_ue_manager); @@ -251,7 +268,8 @@ mac_rlc_status_resp_t mac_rlc_status_ind( + buf_stat.retx_size + buf_stat.tx_size; } else { - if (get_softmodem_params()->phy_test == 0) LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); + if (!(frameP%128)) //to supress this warning message + LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); ret.bytes_in_buffer = 0; } @@ -320,7 +338,6 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( return ret; } -int oai_emulation; rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, @@ -432,7 +449,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) exit(1); rb_found: - LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d", + LOG_I(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d\n", __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); memblock = get_free_mem_block(size, __func__); @@ -461,6 +478,44 @@ rb_found: T(T_ENB_RLC_UL, T_INT(0 /*ctxt_pP->module_id*/), T_INT(ue->rnti), T_INT(rb_id), T_INT(size)); + + const ngran_node_t type = RC.nrrrc[0 /*ctxt_pP->module_id*/]->node_type; + AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU, + "Can't be CU, bad node type %d\n", type); + + // if (NODE_IS_DU(type) && is_srb == 0) { + // LOG_D(RLC, "call proto_agent_send_pdcp_data_ind() \n"); + // proto_agent_send_pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock); + // return; + // } + + if (NODE_IS_DU(type) && is_srb == 1) { + MessageDef *msg; + if (ccch_flag) { + /* for rfsim, because UE send RRCSetupRequest in SRB1 */ + LOG_I(RLC, "[MSG] RRC Setup Request\n"); + msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_INITIAL_UL_RRC_MESSAGE); + F1AP_INITIAL_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = 0; + F1AP_INITIAL_UL_RRC_MESSAGE(msg).mcc = RC.nrrrc[0]->configuration.mcc[0]; + F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc = RC.nrrrc[0]->configuration.mnc[0]; + F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; + F1AP_INITIAL_UL_RRC_MESSAGE(msg).nr_cellid = RC.nrrrc[0]->nr_cellid; + F1AP_INITIAL_UL_RRC_MESSAGE(msg).crnti = ue->rnti; + F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf; + F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container_length = size; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0), msg); + ccch_flag = 0; + return; + } + + msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); + F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; + F1AP_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); + return; + } } if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) { @@ -584,14 +639,15 @@ rb_found: #endif } -static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s) +static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig) { nr_rlc_entity_t *nr_rlc_am; nr_rlc_ue_t *ue; - struct LTE_SRB_ToAddMod__rlc_Config *r = s->rlc_Config; - struct LTE_SRB_ToAddMod__logicalChannelConfig *l = s->logicalChannelConfig; + struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config; + struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig; int srb_id = s->srb_Identity; + int channel_id = rlc_BearerConfig->logicalChannelIdentity; int logical_channel_group; int t_status_prohibit; @@ -602,25 +658,21 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s) int t_reassembly; int sn_field_length; + LOG_I(RLC,"Trying to add SRB %d\n",srb_id); if (srb_id != 1 && srb_id != 2) { LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n", - __FILE__, __LINE__, __FUNCTION__, srb_id); + __FILE__, __LINE__, __FUNCTION__, srb_id); exit(1); } - switch (l->present) { - case LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue: - logical_channel_group = *l->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup; - break; - case LTE_SRB_ToAddMod__logicalChannelConfig_PR_defaultValue: - /* default value from 36.331 9.2.1 */ - logical_channel_group = 0; - break; - default: - LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + if (channel_id != srb_id) { + LOG_E(RLC, "%s:%d:%s: todo, remove this limitation\n", + __FILE__, __LINE__, __FUNCTION__); exit(1); } + logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup; + /* TODO: accept other values? */ if (logical_channel_group != 0) { LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); @@ -628,29 +680,22 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s) } switch (r->present) { - case LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue: { - struct LTE_RLC_Config__am *am; - if (r->choice.explicitValue.present != LTE_RLC_Config_PR_am) { - LOG_E(RLC, "%s:%d:%s: fatal error, must be RLC AM\n", - __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - am = &r->choice.explicitValue.choice.am; + case NR_RLC_Config_PR_am: { + struct NR_RLC_Config__am *am; + am = r->choice.am; + t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly); t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit); t_poll_retransmit = decode_t_poll_retransmit(am->ul_AM_RLC.t_PollRetransmit); poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU); poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte); max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold); + if (*am->dl_AM_RLC.sn_FieldLength != *am->ul_AM_RLC.sn_FieldLength) { + LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength); break; } - case LTE_SRB_ToAddMod__rlc_Config_PR_defaultValue: - /* default values from 36.331 9.2.1 */ - t_status_prohibit = 0; - t_poll_retransmit = 45; - poll_pdu = -1; - poll_byte = -1; - max_retx_threshold = 4; - break; default: LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -659,7 +704,7 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s) nr_rlc_manager_lock(nr_rlc_ue_manager); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); if (ue->srb[srb_id-1] != NULL) { - LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI %x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI 0x%x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); } else { /* hack: hardcode values for NR */ t_poll_retransmit = 45; @@ -680,8 +725,7 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s) sn_field_length); nr_rlc_ue_add_srb_rlc_entity(ue, srb_id, nr_rlc_am); - LOG_D(RLC, "%s:%d:%s: added srb %d to ue %d\n", - __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + LOG_I(RLC, "%s:%d:%s: added srb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); } nr_rlc_manager_unlock(nr_rlc_ue_manager); } @@ -722,7 +766,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ /* TODO: accept other values? */ if (logical_channel_group != 1) { LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); + //exit(1); } switch (r->present) { @@ -763,7 +807,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ sn_field_length); nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_am); - LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); + LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } nr_rlc_manager_unlock(nr_rlc_ue_manager); } @@ -831,7 +875,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ sn_field_length); nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_um); - LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); + LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } nr_rlc_manager_unlock(nr_rlc_ue_manager); } @@ -850,7 +894,7 @@ static void add_drb(int rnti, struct NR_DRB_ToAddMod *s, struct NR_RLC_BearerCon __FILE__, __LINE__, __FUNCTION__); exit(1); } - LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti); + LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI 0x%x\n", __FILE__, __FUNCTION__, __LINE__, rnti); } /* Dummy function due to dependency from LTE libraries */ @@ -866,7 +910,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP } rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, - const LTE_SRB_ToAddModList_t * const srb2add_listP, + const NR_SRB_ToAddModList_t * const srb2add_listP, const NR_DRB_ToAddModList_t * const drb2add_listP, const NR_DRB_ToReleaseList_t * const drb2release_listP, const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, @@ -874,6 +918,7 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt { int rnti = ctxt_pP->rnti; int i; + int j; if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*|| ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 || @@ -896,13 +941,34 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt if (srb2add_listP != NULL) { for (i = 0; i < srb2add_listP->list.count; i++) { - add_srb(rnti, srb2add_listP->list.array[i]); + if (rlc_bearer2add_list != NULL) { + for(j = 0; j < rlc_bearer2add_list->list.count; j++){ + if(rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){ + if(rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity){ + if(srb2add_listP->list.array[i]->srb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.srb_Identity){ + add_rlc_srb(rnti, srb2add_listP->list.array[i], rlc_bearer2add_list->list.array[j]); + } + } + } + } + } + } } - if (drb2add_listP != NULL) { + if ((drb2add_listP != NULL) && (rlc_bearer2add_list != NULL)) { for (i = 0; i < drb2add_listP->list.count; i++) { - add_drb(rnti, drb2add_listP->list.array[i], rlc_bearer2add_list->list.array[i]); + if (rlc_bearer2add_list != NULL) { + for(j = 0; j < rlc_bearer2add_list->list.count; j++){ + if(rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){ + if(rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){ + if(drb2add_listP->list.array[i]->drb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.drb_Identity){ + add_drb(rnti, drb2add_listP->list.array[i], rlc_bearer2add_list->list.array[j]); + } + } + } + } + } } } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 26dee0590b38ef030fae4251d74932178aa896cd..1a4c7789f8496625165fc9854c6ce0698597602e 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -42,8 +42,8 @@ struct NR_RLC_Config; struct NR_LogicalChannelConfig; -void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig); +void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR rb_type); void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config_pr); -void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChannelConfig); \ No newline at end of file +void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChannelConfig); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c index 8c46628333d45dfec2d64cf6b3010e4a511e623e..dc2baa18391103fd14b10a8b5c08a5672fd764f1 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c @@ -85,7 +85,7 @@ nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int rnti) if (m->ue_list[i]->rnti == rnti) return m->ue_list[i]; - LOG_D(RLC, "%s:%d:%s: new UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, rnti); + LOG_D(RLC, "%s:%d:%s: new UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti); m->ue_count++; m->ue_list = realloc(m->ue_list, sizeof(nr_rlc_ue_t *) * m->ue_count); diff --git a/openair2/LAYER2/nr_rlc/tests/run_tests.sh b/openair2/LAYER2/nr_rlc/tests/run_tests.sh index bf1b343d7ec6150aabfe81f7c88b87e7e013a5e3..a98f6b5d0fffe9f530e0ee49d06bedb9413ed11b 100755 --- a/openair2/LAYER2/nr_rlc/tests/run_tests.sh +++ b/openair2/LAYER2/nr_rlc/tests/run_tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_count=14 +test_count=15 for i in `seq $test_count` do diff --git a/openair2/LAYER2/nr_rlc/tests/test15.h b/openair2/LAYER2/nr_rlc/tests/test15.h new file mode 100644 index 0000000000000000000000000000000000000000..8ce9f97896c318e67fe36e72a1603c3b8c46c401 --- /dev/null +++ b/openair2/LAYER2/nr_rlc/tests/test15.h @@ -0,0 +1,19 @@ +/* + * am test (SN field size 18): + * test "range" in NACK, generate a case where so_start > so_end + * (so so_start and so_end are not from the same PDU) + */ + +TIME, 1, + GNB_AM, 100000, 100000, 45, 35, 0, -1, -1, 8, 18, + UE_AM, 100000, 100000, 45, 35, 0, -1, -1, 8, 18, + GNB_PDU_SIZE, 40, + UE_PDU_SIZE, 80, + GNB_SDU, 0, 50, + GNB_SDU, 1, 50, + GNB_SDU, 2, 50, +TIME, 2, + UE_RECV_FAILS, 1, +TIME, 4, + UE_RECV_FAILS, 0, +TIME, -1 diff --git a/openair2/LAYER2/nr_rlc/tests/test15.txt.gz b/openair2/LAYER2/nr_rlc/tests/test15.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..e615a59a5faa88571ac77198d4f53f979163309c Binary files /dev/null and b/openair2/LAYER2/nr_rlc/tests/test15.txt.gz differ diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 919d577a18f3a091e91096c42e78a8583baa6193..9f04cdce5020cfb0d622907207c2814a78619407 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -265,7 +265,6 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( return ret; } -int oai_emulation; rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, @@ -1032,3 +1031,15 @@ void rlc_tick(int frame, int subframe) rlc_current_time_last_subframe = subframe; } } + +void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP){ + +} + diff --git a/openair2/NETWORK_DRIVER/UE_IP/netlink.c b/openair2/NETWORK_DRIVER/UE_IP/netlink.c index 658ae19aba91cc2718710f59f691ca58ba327a28..b3829c51d1018e9d73266226f41ae387cb30857e 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/netlink.c +++ b/openair2/NETWORK_DRIVER/UE_IP/netlink.c @@ -39,6 +39,7 @@ #include "local.h" #include "proto_extern.h" +MODULE_LICENSE("OAI"); #define OAI_IP_DRIVER_NETLINK_ID 31 #define NL_DEST_PID 1 diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index b183b32aab4971c6d58d1b1c70566301bbe5676c..321e1d638f097a8de8b7a4ecb590495eed4b8900 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -41,9 +41,8 @@ #define MAX_IF_MODULES 100 //#define UL_HARQ_PRINT -NR_IF_Module_t *if_inst[MAX_IF_MODULES]; -NR_Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; - +static NR_IF_Module_t *nr_if_inst[MAX_IF_MODULES]; +static NR_Sched_Rsp_t NR_Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); @@ -56,7 +55,7 @@ extern uint16_t sl_ahead; void handle_nr_rach(NR_UL_IND_t *UL_info) { if (UL_info->rach_ind.number_of_pdus>0) { - LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); + LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); int npdus = UL_info->rach_ind.number_of_pdus; for(int i = 0; i < npdus; i++) { UL_info->rach_ind.number_of_pdus--; @@ -96,6 +95,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu); break; } + case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: { const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &uci_list[i].pucch_pdu_format_2_3_4; handle_nr_uci_pucch_2_3_4(mod_id, frame, slot, uci_pdu); @@ -107,7 +107,8 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) UL_info->uci_ind.num_ucis = 0; // mark corresponding PUCCH resources as free - // NOTE: we just assume it is BWP ID 1, to be revised for multiple BWPs + // NOTE: we just assume it is BWP ID 0 and 1, to be revised for multiple BWPs + RC.nrmac[mod_id]->pucch_index_used[0][slot] = 0; RC.nrmac[mod_id]->pucch_index_used[1][slot] = 0; } @@ -178,8 +179,8 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { #endif module_id_t module_id = UL_info->module_id; int CC_id = UL_info->CC_id; - NR_Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id]; - NR_IF_Module_t *ifi = if_inst[module_id]; + NR_Sched_Rsp_t *sched_info = &NR_Sched_INFO[module_id][CC_id]; + NR_IF_Module_t *ifi = nr_if_inst[module_id]; gNB_MAC_INST *mac = RC.nrmac[module_id]; LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rach_pdus:%d rx_ind:%d crcs:%d]\n", UL_info->frame,UL_info->slot, @@ -253,17 +254,17 @@ NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { AssertFatal(Mod_id<MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES); LOG_I(PHY,"Installing callbacks for IF_Module - UL_indication\n"); - if (if_inst[Mod_id]==NULL) { - if_inst[Mod_id] = (NR_IF_Module_t*)malloc(sizeof(NR_IF_Module_t)); - memset((void*)if_inst[Mod_id],0,sizeof(NR_IF_Module_t)); + if (nr_if_inst[Mod_id]==NULL) { + nr_if_inst[Mod_id] = (NR_IF_Module_t*)malloc(sizeof(NR_IF_Module_t)); + memset((void*)nr_if_inst[Mod_id],0,sizeof(NR_IF_Module_t)); - LOG_I(MAC,"Allocating shared L1/L2 interface structure for instance %d @ %p\n",Mod_id,if_inst[Mod_id]); + LOG_I(MAC,"Allocating shared L1/L2 interface structure for instance %d @ %p\n",Mod_id,nr_if_inst[Mod_id]); - if_inst[Mod_id]->CC_mask=0; - if_inst[Mod_id]->NR_UL_indication = NR_UL_indication; - AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0, - "allocation of if_inst[%d]->if_mutex fails\n",Mod_id); + nr_if_inst[Mod_id]->CC_mask=0; + nr_if_inst[Mod_id]->NR_UL_indication = NR_UL_indication; + AssertFatal(pthread_mutex_init(&nr_if_inst[Mod_id]->if_mutex,NULL)==0, + "allocation of nr_if_inst[%d]->if_mutex fails\n",Mod_id); } - return if_inst[Mod_id]; + return nr_if_inst[Mod_id]; } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 51d279b7d1b5c8730a0dd4fa65b51d0cd27f1734..5b020b59885f4dcc8e9bbda162cca39b43425cf6 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -47,7 +47,11 @@ const char *dl_indication_type[] = {"MIB", "SIB", "DLSCH", "DCI", "RAR"}; static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES]; // L2 Abstraction Layer -int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id){ +int handle_bcch_bch(module_id_t module_id, int cc_id, + unsigned int gNB_index, uint8_t *pduP, + unsigned int additional_bits, + uint32_t ssb_index, uint32_t ssb_length, + uint16_t ssb_start_subcarrier, uint16_t cell_id){ return nr_ue_decode_mib(module_id, cc_id, @@ -55,7 +59,8 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, ui additional_bits, ssb_length, // Lssb = 64 is not support ssb_index, - pduP, + pduP, + ssb_start_subcarrier, cell_id); } @@ -90,7 +95,10 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ret = nr_ue_scheduler(NULL, ul_info); - if (is_nr_UL_slot(mac->scc, ul_info->slot_tx, mac->frame_type) && get_softmodem_params()->do_ra) + NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon; + + + if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) /*&& get_softmodem_params()->do_ra*/) nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); switch(ret){ @@ -155,14 +163,15 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){ - case FAPI_NR_RX_PDU_TYPE_MIB: + case FAPI_NR_RX_PDU_TYPE_SSB: 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; + (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pdu, + (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.additional_bits, + (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_index, + (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_length, + (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_start_subcarrier, + (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB; break; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index e78529d437de1871dcbd31234354184c3e6297a0..449c7bf890b8d55cee422033f69141326bb5e8ef 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -221,7 +221,15 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq); \param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i \param ssb_length corresponding to L1 parameter L_ssb \param cell_id cell id */ -int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id); +int handle_bcch_bch(module_id_t module_id, + int cc_id, + unsigned int gNB_index, + uint8_t *pduP, + unsigned int additional_bits, + uint32_t ssb_index, + uint32_t ssb_length, + uint16_t ssb_start_subcarrier, + uint16_t cell_id); // TODO check /**\brief handle BCCH-DL-SCH message from dl_indication diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index d98c603d78444f2951f2a47bf6413506a959ad83..38a742bf74d9889667beff112d808db9dc8c7c71 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -7,8 +7,8 @@ #include "nfapi/oai_integration/vendor_ext.h" #define MAX_IF_MODULES 100 -IF_Module_t *if_inst[MAX_IF_MODULES]; -Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; +static IF_Module_t *if_inst[MAX_IF_MODULES]; +static Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 21740016b11a6ff3e141f8675df5b3f7903a47f7..c212075934871c6b6a1994244eb0c490585f090a 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -54,6 +54,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; extern uint16_t sf_ahead; +static eth_params_t stub_eth_params; void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 547fc2dfc432ac3fe1758cfa5d51798d1928532b..bdf8872371e5e7f6b752a407f33f24d7ffc37497 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -26,16 +26,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu_list; extern nfapi_dl_config_request_t* dl_config_req; extern nfapi_ul_config_request_t* ul_config_req; extern nfapi_hi_dci0_request_t* hi_dci0_req; - -int tx_req_num_elems; - -//below 2 difinitions move to lte-ue.c to add initialization when difinition. -//int next_ra_frame; -//module_id_t next_Mod_id; -eth_params_t stub_eth_params; - - - +extern int tx_req_num_elems; // This function should return all the sched_response config messages which concern a specific UE. Inside this // function we should somehow make the translation of config message's rnti to Mod_ID. diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index d9682b466f2f98148bc920ac221c26d63a93097a..cd99ddfedc32524f051d34fe6385e67d0c02242f 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -316,7 +316,9 @@ mac_rrc_data_ind( UE_id, rntiP, sduP, - sdu_lenP + sdu_lenP, + NULL, + 0 ); return(0); } diff --git a/openair2/RRC/LTE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h index 91dc7aafd4396ccec1f11ad2a4dce7e5f03ecdad..2a34971c231f32b851a29951a36acd4efe4f2d38 100644 --- a/openair2/RRC/LTE/defs_NB_IoT.h +++ b/openair2/RRC/LTE/defs_NB_IoT.h @@ -148,7 +148,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s { //Measurement Report not supported in NB-IoT #define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 255 +#define RRC_BUF_SIZE 8192 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 diff --git a/openair2/RRC/LTE/plmn_data.h b/openair2/RRC/LTE/plmn_data.h index 97dc94343b613365709d2840c614ec03f3f73388..701bcaf764c1bf2b8abae392c2e5d25895472d5c 100644 --- a/openair2/RRC/LTE/plmn_data.h +++ b/openair2/RRC/LTE/plmn_data.h @@ -2231,7 +2231,8 @@ static const plmn_data_t plmn_data[] = { /* 310 900 Mid-Rivers Communications Mid-Rivers Wireless Operational */ - {310, 910, "Verizon Wireless", "Verizon USA"} + {310, 910, "Verizon Wireless", "Verizon USA"}, + {0,0,"",""} /* 310 920 Get Mobile Inactive 310 930 Copper Valley Wireless Inactive diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index c57cec6ba5eaba879b2c3874d2d3b4a088834e8e..e3d28d8a0ff7fe301671dbfb61a9d4a193d3b955 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -330,7 +330,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) { preconfigpool->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0; // 40 ms SL Period preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; - preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(1,5); + preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(5,1); preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = 5; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = 0; // last 36 subframes for PSCCH @@ -338,7 +338,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) { preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[1] = 0xFF; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[2] = 0xFF; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[3] = 0xFF; - preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[5] = 0xFF; + preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[4] = 0xFF; preconfigpool->dataHoppingConfig_r12.hoppingParameter_r12 = 0; preconfigpool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1; preconfigpool->dataHoppingConfig_r12.rb_Offset_r12 = 0; diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 4f55f94121f1b63c0e64978de42b9cd6aba1652a..66155416629149d9d15294c45da01abb72447bdf 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -67,6 +67,8 @@ #define MAX_NUM_NEIGH_CELLs 6 /* maximum neighbouring cells number */ +#define MAX_NUM_GNB_CELLs 1 /* maximum gNB cells number */ + #define UE_STATE_NOTIFICATION_INTERVAL 50 #define IPV4_ADDR "%u.%u.%u.%u" @@ -327,7 +329,7 @@ typedef enum SL_TRIGGER_e { #define MAX_MEAS_ID 6 #define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 255 +#define RRC_BUF_SIZE 8192 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 @@ -804,8 +806,13 @@ typedef struct eNB_RRC_INST_s { int num_neigh_cells_cc[MAX_NUM_CCs]; uint32_t neigh_cells_id[MAX_NUM_NEIGH_CELLs][MAX_NUM_CCs]; + // gNB cells connected to this eNB + int num_gnb_cells; + int num_gnb_cells_cc[MAX_NUM_GNB_CELLs]; + uint32_t gnb_cells_id[MAX_NUM_GNB_CELLs][MAX_NUM_CCs]; + // Nr scc freq band and SSB absolute frequency - uint32_t nr_neigh_freq_band[MAX_NUM_NEIGH_CELLs][MAX_NUM_CCs]; + uint32_t nr_gnb_freq_band[MAX_NUM_GNB_CELLs][MAX_NUM_CCs]; int nr_scg_ssb_freq; // other RAN parameters diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 526ce129b1e43302ab8e5161e4282c0baba224e9..881e5b8ad1575e651f4976c169881021769097fd 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -87,6 +87,7 @@ #include "pdcp.h" #include "gtpv1u_eNB_task.h" +#include <openair3/ocp-gtpu/gtp_itf.h> #include "intertask_interface.h" @@ -1283,7 +1284,7 @@ rrc_eNB_generate_UECapabilityEnquiry( T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); int16_t eutra_band = RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0]; - uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_neigh_freq_band[0][0]; + uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0]; size = do_UECapabilityEnquiry( ctxt_pP, buffer, @@ -1333,7 +1334,7 @@ rrc_eNB_generate_NR_UECapabilityEnquiry( T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); int16_t eutra_band = RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0]; - uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_neigh_freq_band[0][0]; + uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0]; size = do_NR_UECapabilityEnquiry( ctxt_pP, buffer, @@ -4968,7 +4969,7 @@ void rrc_eNB_handover_ue_context_release( ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, ctxt_pP->module_id, msg_delete_tunnels_p); struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id); @@ -6557,10 +6558,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); /* For pre-ci tests */ - LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", + LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete, reconfiguring DRB %d/LCID %d\n", ctxt_pP->module_id, ctxt_pP->frame, - oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); @@ -6585,7 +6585,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n", ctxt_pP->module_id, ctxt_pP->module_id, (long int)((ue_context_pP->local_uid * LTE_maxDRB) + DRB_configList->list.array[i]->drb_Identity)); - ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; + ue_module_id = 0; // Was oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; rb_conf_ipv4(0, //add ue_module_id, //cx ctxt_pP->module_id, //inst @@ -7588,8 +7588,8 @@ is_en_dc_supported( ) //----------------------------------------------------------------------------- { - /* to be refined - check that the eNB is connected to a gNB, check that - * the bands supported by the UE include the band of the gNB + /* to be refined - check that the bands supported by the UE include + * the band of the gNB */ #define NCE nonCriticalExtension return c != NULL @@ -8289,8 +8289,13 @@ rrc_eNB_decode_dcch( ue_context_p->ue_context.UE_Capability = 0; } - if (dec_rval.code == RC_OK) - ue_context_p->ue_context.does_nr = is_en_dc_supported(ue_context_p->ue_context.UE_Capability); + if (dec_rval.code == RC_OK) { + /* do NR only if at least one gNB connected */ + if (RC.rrc[ctxt_pP->module_id]->num_gnb_cells != 0) + ue_context_p->ue_context.does_nr = is_en_dc_supported(ue_context_p->ue_context.UE_Capability); + else + ue_context_p->ue_context.does_nr = 0; + } if (EPC_MODE_ENABLED) { rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, @@ -8563,16 +8568,16 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { } F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; - F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->configuration.mcc[0]; - F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->configuration.mnc[0]; - F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->configuration.mnc_digit_length[0]; - F1AP_SETUP_RESP (msg_p).nr_cellid[cu_cell_ind] = rrc->nr_cellid; - F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i]; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0]; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0]; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0]; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i]; int num_SI= 0; if (rrc->carrier[0].SIB23) { - F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23; - F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container[num_SI] = rrc->carrier[0].SIB23; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container_length[num_SI] = rrc->carrier[0].sizeof_SIB23; //printf("SI %d size %d: ", 0, F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]); //for (int n = 0; n < F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]; n++) // printf("%02x ", F1AP_SETUP_RESP(msg_p).SI_container[0][num_SI][n]); @@ -8580,7 +8585,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { num_SI++; } - F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].num_SI = num_SI; cu_cell_ind++; found_cell=1; F1AP_SETUP_RESP (msg_p).num_cells_to_activate = cu_cell_ind; @@ -9029,22 +9034,22 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { } void rrc_eNB_process_ENDC_x2_setup_request(int mod_id, x2ap_ENDC_setup_req_t *m) { - if (RC.rrc[mod_id]->num_neigh_cells > MAX_NUM_NEIGH_CELLs) { - LOG_E(RRC, "Error: number of neighbouring cells is exceeded \n"); + if (RC.rrc[mod_id]->num_gnb_cells >= MAX_NUM_GNB_CELLs) { + LOG_E(RRC, "Error: number of gNB cells is exceeded\n"); return; } if (m->num_cc > MAX_NUM_CCs) { - LOG_E(RRC, "Error: number of neighbouring cells carriers is exceeded \n"); + LOG_E(RRC, "Error: number of gNB cells carriers is exceeded \n"); return; } - RC.rrc[mod_id]->num_neigh_cells++; - RC.rrc[mod_id]->num_neigh_cells_cc[RC.rrc[mod_id]->num_neigh_cells-1] = m->num_cc; + RC.rrc[mod_id]->num_gnb_cells++; + RC.rrc[mod_id]->num_gnb_cells_cc[RC.rrc[mod_id]->num_gnb_cells-1] = m->num_cc; for (int i=0; i<m->num_cc; i++) { - RC.rrc[mod_id]->neigh_cells_id[RC.rrc[mod_id]->num_neigh_cells-1][i] = m->Nid_cell[i]; - RC.rrc[mod_id]->nr_neigh_freq_band[RC.rrc[mod_id]->num_neigh_cells-1][i] = m->servedNrCell_band[i]; + RC.rrc[mod_id]->gnb_cells_id[RC.rrc[mod_id]->num_gnb_cells-1][i] = m->Nid_cell[i]; + RC.rrc[mod_id]->nr_gnb_freq_band[RC.rrc[mod_id]->num_gnb_cells-1][i] = m->servedNrCell_band[i]; } } diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index e974a28f680b84bcbe9c80c9d19165bc2fd9c151..6683d91556fe2f26a12c67610bf18e58101ff365 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -40,6 +40,7 @@ # include "common/ran_context.h" +#include <openair3/ocp-gtpu/gtp_itf.h> extern RAN_CONTEXT_t RC; @@ -92,7 +93,6 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( } } - //------------------------------------------------------------------------------ boolean_t gtpv_data_req( @@ -113,64 +113,152 @@ gtpv_data_req( return FALSE; } LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %ld", ctxt_pP->rnti, sdu_sizeP, rb_idP); - { - MessageDef *message_p; - // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). - uint8_t *message_buffer; - - if(task_id == TASK_DATA_FORWARDING){ - - LOG_I(GTPU,"gtpv_data_req task_id = TASK_DATA_FORWARDING\n"); - - message_buffer = itti_malloc (TASK_GTPV1_U, TASK_DATA_FORWARDING, sdu_sizeP); - - memcpy (message_buffer, buffer_pP, sdu_sizeP); - - message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_IND); - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).frame = ctxt_pP->frame; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).enb_flag = ctxt_pP->enb_flag; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rb_id = rb_idP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).muip = muiP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).confirmp = confirmP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_size = sdu_sizeP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_p = message_buffer; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).mode = modeP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rnti = ctxt_pP->rnti; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).eNB_index = ctxt_pP->eNB_index; - - itti_send_msg_to_task (TASK_DATA_FORWARDING, ctxt_pP->instance, message_p); - return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. - }else if(task_id == TASK_END_MARKER){ - - LOG_I(GTPU,"gtpv_data_req task_id = TASK_END_MARKER\n"); - - message_buffer = itti_malloc (TASK_GTPV1_U, TASK_END_MARKER, sdu_sizeP); - - memcpy (message_buffer, buffer_pP, sdu_sizeP); - - message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_IND); - GTPV1U_ENB_END_MARKER_IND (message_p).frame = ctxt_pP->frame; - GTPV1U_ENB_END_MARKER_IND (message_p).enb_flag = ctxt_pP->enb_flag; - GTPV1U_ENB_END_MARKER_IND (message_p).rb_id = rb_idP; - GTPV1U_ENB_END_MARKER_IND (message_p).muip = muiP; - GTPV1U_ENB_END_MARKER_IND (message_p).confirmp = confirmP; - GTPV1U_ENB_END_MARKER_IND (message_p).sdu_size = sdu_sizeP; - GTPV1U_ENB_END_MARKER_IND (message_p).sdu_p = message_buffer; - GTPV1U_ENB_END_MARKER_IND (message_p).mode = modeP; - GTPV1U_ENB_END_MARKER_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_END_MARKER_IND (message_p).rnti = ctxt_pP->rnti; - GTPV1U_ENB_END_MARKER_IND (message_p).eNB_index = ctxt_pP->eNB_index; - - itti_send_msg_to_task (TASK_END_MARKER, ctxt_pP->instance, message_p); - return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. - } + MessageDef *message_p; + // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). + uint8_t *message_buffer; + + if(task_id == TASK_DATA_FORWARDING){ + + LOG_I(GTPU,"gtpv_data_req task_id = TASK_DATA_FORWARDING\n"); + + message_buffer = itti_malloc (TASK_GTPV1_U, TASK_DATA_FORWARDING, sdu_sizeP); + + memcpy (message_buffer, buffer_pP, sdu_sizeP); + + message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_IND); + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).frame = ctxt_pP->frame; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).enb_flag = ctxt_pP->enb_flag; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rb_id = rb_idP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).muip = muiP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).confirmp = confirmP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_size = sdu_sizeP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_p = message_buffer; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).mode = modeP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).module_id = ctxt_pP->module_id; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rnti = ctxt_pP->rnti; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).eNB_index = ctxt_pP->eNB_index; + + itti_send_msg_to_task (TASK_DATA_FORWARDING, ctxt_pP->instance, message_p); + return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. + } else if (task_id == TASK_END_MARKER){ + + LOG_I(GTPU,"gtpv_data_req task_id = TASK_END_MARKER\n"); + + message_buffer = itti_malloc (TASK_GTPV1_U, TASK_END_MARKER, sdu_sizeP); + + memcpy (message_buffer, buffer_pP, sdu_sizeP); + + message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_IND); + GTPV1U_ENB_END_MARKER_IND (message_p).frame = ctxt_pP->frame; + GTPV1U_ENB_END_MARKER_IND (message_p).enb_flag = ctxt_pP->enb_flag; + GTPV1U_ENB_END_MARKER_IND (message_p).rb_id = rb_idP; + GTPV1U_ENB_END_MARKER_IND (message_p).muip = muiP; + GTPV1U_ENB_END_MARKER_IND (message_p).confirmp = confirmP; + GTPV1U_ENB_END_MARKER_IND (message_p).sdu_size = sdu_sizeP; + GTPV1U_ENB_END_MARKER_IND (message_p).sdu_p = message_buffer; + GTPV1U_ENB_END_MARKER_IND (message_p).mode = modeP; + GTPV1U_ENB_END_MARKER_IND (message_p).module_id = ctxt_pP->module_id; + GTPV1U_ENB_END_MARKER_IND (message_p).rnti = ctxt_pP->rnti; + GTPV1U_ENB_END_MARKER_IND (message_p).eNB_index = ctxt_pP->eNB_index; + + itti_send_msg_to_task (TASK_END_MARKER, ctxt_pP->instance, message_p); + return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. } - return TRUE; - + LOG_E(RRC, "Impossible state\n"); + return FALSE; } -//#endif +boolean_t gtpv_data_req_new ( + protocol_ctxt_t *ctxt, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) { + int task; + + if (sdu_buffer_sizeP==0) + task=TASK_END_MARKER; + else + task=TASK_DATA_FORWARDING; + + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt->module_id], ctxt->rnti); + if(ue_context_p == NULL || ue_context_p->ue_context.handover_info == NULL || + ue_context_p->ue_context.Status != RRC_HO_EXECUTION) { + LOG_E(RRC,"incoming GTP-U for X2 in non HO context\n"); + return false; + } + + /* in the source enb, UE in RRC_HO_EXECUTION mode */ + // We have 2*2=4 cases (data or end marker) * (from slave, from EPC) + if (ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { + LOG_I(GTPU, "source receive END MARKER\n"); + /* set handover state */ + //ue_context_p->ue_context.handover_info->state = HO_END_MARKER; + MessageDef *msg; + // Configure end marker + msg = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_REQ); + GTPV1U_ENB_END_MARKER_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + sdu_buffer_sizeP); + memcpy(>PV1U_ENB_END_MARKER_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], sdu_buffer_pP, sdu_buffer_sizeP); + GTPV1U_ENB_END_MARKER_REQ(msg).length = sdu_buffer_sizeP; + GTPV1U_ENB_END_MARKER_REQ(msg).rnti = ctxt->rnti; + GTPV1U_ENB_END_MARKER_REQ(msg).rab_id = rb_idP; + GTPV1U_ENB_END_MARKER_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX; + LOG_I(GTPU, "Send End Marker to GTPV1-U at frame %d and subframe %d \n", ctxt->frame,ctxt->subframe); + itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(ctxt->module_id), msg); + return NW_GTPV1U_OK; + } + + /* target enb */ + // We have 2*2=4 cases (data or end marker) * (from source, from EPC) + if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { + // It should come from remote eNB + // case end marker by EPC is not possible ? + if (task==TASK_END_MARKER) { + LOG_I(GTPU, "target end receive END MARKER\n"); + // We close the HO, nothing to send to remote ? + ue_context_p->ue_context.handover_info->state = HO_END_MARKER; + gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; + memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); + delete_tunnel_req.rnti = ctxt->rnti; + gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req, GTPV1U_TARGET_ENB); + return true; + } else { + /* data packet */ + LOG_I(GTPU, "Received a message data forwarding length %d\n", sdu_buffer_sizeP); + // Is it from remote ENB + // We have to push it to the UE ? + if(ue_context_p->ue_context.handover_info->state != HO_COMPLETE) { + int result = pdcp_data_req( + ctxt, + srb_flagP, + rb_idP, + muiP, // mui + confirmP, // confirm + sdu_buffer_sizeP, + sdu_buffer_pP, + modeP, + sourceL2Id, + destinationL2Id + ); + ue_context_p->ue_context.handover_info->forwarding_state = FORWARDING_NO_EMPTY; + return result; + } else { /* It is from from epc message */ + /* in the source enb, UE in RRC_HO_EXECUTION mode */ + MessageDef *msg; + // ????? + return true; + } + } + } + LOG_E(RRC,"This function should return before the end\n"); + return false; +} + void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( module_id_t enb_mod_idP, @@ -181,21 +269,16 @@ void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( LOG_W(RRC, "[eNB] In %s: invalid UE\n", __func__); return; } + gtpv1u_enb_delete_tunnel_req_t tmp={0}; - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL, 0, - "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", - ue_context_pP->ue_context.eNB_ue_s1ap_id); - - MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).rnti = ue_context_pP->ue_context.rnti; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).from_gnb = 0; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).num_erab = ue_context_pP->ue_context.nb_of_e_rabs; + tmp.rnti = ue_context_pP->ue_context.rnti; + tmp.from_gnb = 0; + tmp.num_erab = ue_context_pP->ue_context.nb_of_e_rabs; for (int e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) { const rb_id_t gtp_ebi = ue_context_pP->ue_context.enb_gtp_ebi[e_rab]; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).eps_bearer_id[e_rab] = gtp_ebi; + tmp.eps_bearer_id[e_rab] = gtp_ebi; } - itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg); + gtpv1u_delete_s1u_tunnel(enb_mod_idP,&tmp); } diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 0e6d5b580f910b0fe031f4b3ff2cec0a75d492a7..f64a109f75899de9409984c41b6d7f487e61b62e 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -48,11 +48,12 @@ #include "pdcp_primitives.h" #include "UTIL/OSA/osa_defs.h" -#include "msc.h" +#include <common/utils/msc/msc.h> #include "LTE_UERadioAccessCapabilityInformation.h" #include "gtpv1u_eNB_task.h" +#include <openair3/ocp-gtpu/gtp_itf.h> #include "RRC/LTE/rrc_eNB_GTPV1U.h" #include "TLVDecoder.h" @@ -1787,7 +1788,7 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms } } - itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, instance, msg_delete_tunnels_p); //S1AP_E_RAB_RELEASE_RESPONSE rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); } diff --git a/openair2/RRC/NAS/nas_config.c b/openair2/RRC/NAS/nas_config.c index 2eb439b9e9891fbd0076cbb2a9f02fbe73c83e5f..dc12e968307622f22f62b1d980f3eb28a47ee22e 100644 --- a/openair2/RRC/NAS/nas_config.c +++ b/openair2/RRC/NAS/nas_config.c @@ -61,9 +61,9 @@ void nas_getparams(void) { /* configuration parameters for netlink, includes network parameters when running in noS1 mode */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ - {"NetworkPrefix", NASHLP_NETPREFIX, 0, strptr:&baseNetAddress, defstrval:"10.0", TYPE_STRING, 0 }, + {"NetworkPrefix", NASHLP_NETPREFIX, 0, strptr:&baseNetAddress, defstrval:"60.60", TYPE_STRING, 0 }, {"NetworkMask", NASHLP_NETMASK, 0, strptr:&netMask, defstrval:"255.255.255.0", TYPE_STRING, 0 }, - {"BroadcastAddr", NASHLP_BROADCASTADDR, 0, strptr:&broadcastAddr, defstrval:"10.0.255.255", TYPE_STRING, 0 }, + {"BroadcastAddr", NASHLP_BROADCASTADDR, 0, strptr:&broadcastAddr, defstrval:"60.60.255.255", TYPE_STRING, 0 }, }; config_get( nasoptions,sizeof(nasoptions)/sizeof(paramdef_t),"nas.noS1"); } diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 58c595a3d009ff0397cf1a1605858501860df8b9..a67eef2a643f4cf67bd82a46f31107a1cb81bae9 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -42,6 +42,7 @@ #include "NR_MIB.h" #include "NR_BCCH-BCH-Message.h" +#include "rrc_gNB_UE_context.h" extern RAN_CONTEXT_t RC; @@ -163,12 +164,12 @@ nr_rrc_data_req( //------------------------------------------------------------------------------ { if(sdu_sizeP == 255) { - LOG_I(RRC,"sdu_sizeP == 255"); + LOG_I(NR_RRC,"sdu_sizeP == 255"); return FALSE; } MSC_LOG_TX_MESSAGE( - ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE, + ctxt_pP->enb_flag ? MSC_RRC_GNB : MSC_RRC_UE, ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE, buffer_pP, sdu_sizeP, @@ -181,11 +182,11 @@ nr_rrc_data_req( // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). uint8_t *message_buffer; message_buffer = itti_malloc ( - ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, + ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); + message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; @@ -193,7 +194,7 @@ nr_rrc_data_req( RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP; RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP; RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; - //memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP); + //memcpy (NR_RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP); RRC_DCCH_DATA_REQ (message_p).mode = modeP; RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id; RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti; @@ -202,12 +203,12 @@ nr_rrc_data_req( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->instance, message_p); - LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n"); + LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n"); /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads * Ideally, PDCP would not neet to be triggered like this but react to ITTI * messages automatically */ - if (ctxt_pP->enb_flag && NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) + if (ctxt_pP->enb_flag && NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) pdcp_run(ctxt_pP); return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. @@ -217,29 +218,22 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, const frame_t frameP, const rb_id_t Srb_id, + const rnti_t rnti, const uint8_t Nb_tb, uint8_t *const buffer_pP ){ - asn_enc_rval_t enc_rval; - uint8_t Sdu_size = 0; - uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); - #ifdef DEBUG_RRC LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); #endif - rrc_gNB_carrier_data_t *carrier; - NR_BCCH_BCH_Message_t *mib; - NR_SRB_INFO *srb_info; - char payload_size, *payload_pP; - - carrier = &RC.nrrrc[Mod_idP]->carrier; - mib = &carrier->mib; - srb_info = &carrier->Srb0; - - /* MIBCH */ + // MIBCH if ((Srb_id & RAB_OFFSET) == MIBCH) { + asn_enc_rval_t enc_rval; + uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); + rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[Mod_idP]->carrier; + NR_BCCH_BCH_Message_t *mib = &carrier->mib; + // Currently we are getting the pdcch_ConfigSIB1 from the configuration file. // Uncomment this function for a dynamic pdcch_ConfigSIB1. //channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1 @@ -269,7 +263,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, return (3); } - /* TODO BCCH SIB1 SIBs */ + // TODO BCCH SIB1 SIBs if ((Srb_id & RAB_OFFSET ) == BCCH) { memcpy(&buffer_pP[0], RC.nrrrc[Mod_idP]->carrier.SIB1, @@ -278,29 +272,91 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1; } - /* CCCH */ + // CCCH if( (Srb_id & RAB_OFFSET ) == CCCH) { - //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); - //if (ue_context_p == NULL) return(0); - //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); - // srb_info=&ue_p->Srb0; + char *payload_pP; + uint8_t Sdu_size = 0; + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_idP], rnti); + + LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); - payload_size = srb_info->Tx_buffer.payload_size; + AssertFatal(ue_context_p!=NULL,"failed to get ue_context\n"); + char payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size; // check if data is there for MAC if (payload_size > 0) { - payload_pP = srb_info->Tx_buffer.Payload; - LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP); + payload_pP = ue_context_p->ue_context.Srb0.Tx_buffer.Payload; + LOG_D(NR_RRC,"[gNB %d] CCCH has %d bytes (dest: %p, src %p)\n", Mod_idP, payload_size, buffer_pP, payload_pP); // Fill buffer memcpy((void *)buffer_pP, (void*)payload_pP, payload_size); Sdu_size = payload_size; - srb_info->Tx_buffer.payload_size = 0; + ue_context_p->ue_context.Srb0.Tx_buffer.payload_size = 0; } return Sdu_size; } return(0); -} \ No newline at end of file +} + +int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, + const int CC_id, + const frame_t frameP, + const sub_frame_t sub_frameP, + const int UE_id, + const rnti_t rntiP, + const rb_id_t srb_idP, + const uint8_t *sduP, + const sdu_size_t sdu_lenP, + const boolean_t brOption) { + + if (NODE_IS_DU(RC.nrrrc[module_idP]->node_type)) { + LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n", + module_idP, srb_idP, sdu_lenP, UE_id, rntiP); + + // Generate DUtoCURRCContainer + // call do_RRCSetup like full procedure and extract masterCellGroup + NR_CellGroupConfig_t cellGroupConfig; + NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon; + uint8_t sdu2[100]; + memset(&cellGroupConfig,0,sizeof(cellGroupConfig)); + fill_initial_cellGroupConfig(rntiP,&cellGroupConfig,scc); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, + NULL, + (void *)&cellGroupConfig, + sdu2, + 100); + + int sdu2_len = (enc_rval.encoded+7)/8; + if (enc_rval.encoded == -1) { + LOG_I(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name); + exit(-1); + } + /* do ITTI message */ + DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( + module_idP, + CC_id, + UE_id, + rntiP, + sduP, + sdu_lenP, + sdu2, + sdu2_len + ); + return(0); + } + + protocol_ctxt_t ctxt; + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0); + + if((srb_idP & RAB_OFFSET) == CCCH) { + LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP); + ctxt.brOption = brOption; + if (sdu_lenP > 0) { + nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, NULL, CC_id); + } + } + + return 0; +} diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c old mode 100644 new mode 100755 index 82855365c8aee1f76ca97135b637bb9d67f3f24a..921322fbdf0901b8e85882a62f56a398f7d4e931 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -70,6 +70,7 @@ #include "NR_RRCReconfigurationComplete-IEs.h" #include "NR_DLInformationTransfer.h" #include "NR_RRCReestablishmentRequest.h" +#include "NR_UE-CapabilityRequestFilterNR.h" #include "PHY/defs_nr_common.h" #if defined(NR_Rel16) #include "NR_SCS-SpecificCarrier.h" @@ -308,12 +309,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, // TODO : Add support for more than one PLMN int num_plmn = 1; // int num_plmn = configuration->num_plmn; - struct NR_PLMN_Identity nr_plmn[num_plmn]; - NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3]; - NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3]; - memset(nr_plmn,0,sizeof(nr_plmn)); - memset(nr_mcc_digit,0,sizeof(nr_mcc_digit)); - memset(nr_mnc_digit,0,sizeof(nr_mnc_digit)); + struct NR_PLMN_Identity *nr_plmn = CALLOC(1, sizeof(struct NR_PLMN_Identity) * num_plmn); + NR_MCC_MNC_Digit_t (*nr_mcc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3); + NR_MCC_MNC_Digit_t (*nr_mnc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);; + memset(nr_plmn,0,sizeof(struct NR_PLMN_Identity) * num_plmn); + memset(nr_mcc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3); + memset(nr_mnc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3); NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); carrier->siblock1 = sib1_message; @@ -326,7 +327,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, // cellSelectionInfo sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo)); - sib1->cellSelectionInfo->q_RxLevMin = -50; + sib1->cellSelectionInfo->q_RxLevMin = -65; // cellAccessRelatedInfo struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo)); @@ -418,7 +419,8 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i]; ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo); } - sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + //sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 86; for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) { ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); } @@ -443,7 +445,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ss1->nrofCandidates = calloc(1,sizeof(*ss1->nrofCandidates)); ss1->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; ss1->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - ss1->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + ss1->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; ss1->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; ss1->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; ss1->searchSpaceType = calloc(1,sizeof(*ss1->searchSpaceType)); @@ -561,14 +563,14 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap: sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap; break; - /* - groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1. - The first/leftmost bit corresponds to the SS/PBCH index 0-7, the second bit corresponds to SS/PBCH block 8-15, and so on. - Value 0 in the bitmap indicates that the SSBs according to inOneGroup are absent. Value 1 indicates that the SS/PBCH blocks are transmitted in accordance with inOneGroup. - inOneGroup: When maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1, all 8 bit are valid; - The first/ leftmost bit corresponds to the first SS/PBCH block index in the group (i.e., to SSB index 0, 8, and so on); the second bit corresponds to the second SS/PBCH block index in the group - (i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. - */ + /* + groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1. + The first/leftmost bit corresponds to the SS/PBCH index 0-7, the second bit corresponds to SS/PBCH block 8-15, and so on. + Value 0 in the bitmap indicates that the SSBs according to inOneGroup are absent. Value 1 indicates that the SS/PBCH blocks are transmitted in accordance with inOneGroup. + inOneGroup: When maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1, all 8 bit are valid; + The first/ leftmost bit corresponds to the first SS/PBCH block index in the group (i.e., to SSB index 0, 8, and so on); the second bit corresponds to the second SS/PBCH block index in the group + (i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. + */ case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap: sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.size = 1; sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.bits_unused = 0; @@ -657,6 +659,56 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, return((enc_rval.encoded+7)/8); } +uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, + gNB_RrcConfigurationReq *configuration) { + asn_enc_rval_t enc_rval; + SystemInformation_IEs__sib_TypeAndInfo__Member *sib2 = NULL; + SystemInformation_IEs__sib_TypeAndInfo__Member *sib3 = NULL; + + NR_BCCH_DL_SCH_Message_t *sib_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); + sib_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1; + sib_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1)); + sib_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation; + sib_message->message.choice.c1->choice.systemInformation = CALLOC(1,sizeof(struct NR_SystemInformation)); + + struct NR_SystemInformation *sib = sib_message->message.choice.c1->choice.systemInformation; + sib->criticalExtensions.present = NR_SystemInformation__criticalExtensions_PR_systemInformation; + sib->criticalExtensions.choice.systemInformation = CALLOC(1, sizeof(struct NR_SystemInformation_IEs)); + + struct NR_SystemInformation_IEs *ies = sib->criticalExtensions.choice.systemInformation; + sib2 = CALLOC(1, sizeof(SystemInformation_IEs__sib_TypeAndInfo__Member)); + sib2->present = NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2; + sib2->choice.sib2 = CALLOC(1, sizeof(struct NR_SIB2)); + sib2->choice.sib2->cellReselectionInfoCommon.q_Hyst = NR_SIB2__cellReselectionInfoCommon__q_Hyst_dB1; + sib2->choice.sib2->cellReselectionServingFreqInfo.threshServingLowP = 2; // INTEGER (0..31) + sib2->choice.sib2->cellReselectionServingFreqInfo.cellReselectionPriority = 2; // INTEGER (0..7) + sib2->choice.sib2->intraFreqCellReselectionInfo.q_RxLevMin = -50; // INTEGER (-70..-22) + sib2->choice.sib2->intraFreqCellReselectionInfo.s_IntraSearchP = 2; // INTEGER (0..31) + sib2->choice.sib2->intraFreqCellReselectionInfo.t_ReselectionNR = 2; // INTEGER (0..7) + sib2->choice.sib2->intraFreqCellReselectionInfo.deriveSSB_IndexFromCell = true; + ASN_SEQUENCE_ADD(&ies->sib_TypeAndInfo.list, sib2); + + sib3 = CALLOC(1, sizeof(SystemInformation_IEs__sib_TypeAndInfo__Member)); + sib3->present = NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3; + sib3->choice.sib3 = CALLOC(1, sizeof(struct NR_SIB3)); + ASN_SEQUENCE_ADD(&ies->sib_TypeAndInfo.list, sib3); + + //encode SIB to data + // carrier->SIB23 = (uint8_t *) malloc16(128); + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message, + NULL, + (void *)sib_message, + carrier->SIB23, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + + if (enc_rval.encoded==-1) { + return(-1); + } + + return((enc_rval.encoded+7)/8); +} void do_RLC_BEARER(uint8_t Mod_id, int CC_id, @@ -925,29 +977,335 @@ uint8_t do_RRCReject(uint8_t Mod_id, return((enc_rval.encoded+7)/8); } +void fill_initial_SpCellConfig(rnti_t rnti, + NR_SpCellConfig_t *SpCellConfig, + NR_ServingCellConfigCommon_t *scc) { + + SpCellConfig->servCellIndex = NULL; + SpCellConfig->reconfigurationWithSync = NULL; + SpCellConfig->rlmInSyncOutOfSyncThreshold = NULL; + SpCellConfig->rlf_TimersAndConstants = NULL; + SpCellConfig->spCellConfigDedicated = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated)); + SpCellConfig->spCellConfigDedicated->uplinkConfig = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->uplinkConfig)); + NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP)); + SpCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP; + initialUplinkBWP->pucch_Config = calloc(1,sizeof(*initialUplinkBWP->pucch_Config)); + initialUplinkBWP->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup; + NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config)); + initialUplinkBWP->pucch_Config->choice.setup=pucch_Config; + pucch_Config->resourceSetToAddModList = calloc(1,sizeof(*pucch_Config->resourceSetToAddModList)); + pucch_Config->resourceSetToReleaseList = NULL; + NR_PUCCH_ResourceSet_t *pucchresset0=calloc(1,sizeof(*pucchresset0)); + pucchresset0->pucch_ResourceSetId = 0; + NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0)); + *pucchresset0id0=0; + ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0); + pucchresset0->maxPayloadSize=NULL; + ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0); + + pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList)); + pucch_Config->resourceToReleaseList = NULL; + // configure one single PUCCH0 opportunity for initial connection procedure + // one symbol (13) + NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0)); + pucchres0->pucch_ResourceId=0; + pucchres0->startingPRB=0; + pucchres0->intraSlotFrequencyHopping=NULL; + pucchres0->secondHopPRB=NULL; + pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0; + pucchres0->format.choice.format0=calloc(1,sizeof(*pucchres0->format.choice.format0)); + pucchres0->format.choice.format0->initialCyclicShift=0; + pucchres0->format.choice.format0->nrofSymbols=1; + pucchres0->format.choice.format0->startingSymbolIndex=13; + ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0); + + // configure Scheduling request + // 40 slot period + pucch_Config->schedulingRequestResourceToAddModList = calloc(1,sizeof(*pucch_Config->schedulingRequestResourceToAddModList)); + NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig = calloc(1,sizeof(*schedulingRequestResourceConfig)); + schedulingRequestResourceConfig->schedulingRequestResourceId = 1; + schedulingRequestResourceConfig->schedulingRequestID= 0; + schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset)); + schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40; + // note: make sure that there is no issue here. Later choose the RNTI accordingly. + // Here we would be limited to 8 UEs on this resource (2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 8,9,18,19,28,29,38,39). + // This should be a temporary resource until the first RRCReconfiguration gives new pucch resources. + // Check for above configuration and exit for now if it is not the case + AssertFatal(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing==NR_SubcarrierSpacing_kHz30, + "SCS != 30kHz\n"); + AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity==NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5, + "TDD period != 5ms : %ld\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); + + schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = 10*((rnti>>1)&3) + (rnti&2); + schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource)); + *schedulingRequestResourceConfig->resource = 0; + ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig); + + SpCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->initialDownlinkBWP)); + NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP; + bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp_Dedicated->pdcch_Config)); + bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup; + bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp_Dedicated->pdcch_Config->choice.setup)); + + bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = calloc(1,sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); + + NR_SearchSpace_t *ss2 = calloc(1,sizeof(*ss2)); + + ss2->searchSpaceId=2; + ss2->controlResourceSetId=calloc(1,sizeof(*ss2->controlResourceSetId)); + *ss2->controlResourceSetId=0; + ss2->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss2->monitoringSlotPeriodicityAndOffset)); + ss2->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + ss2->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0; + ss2->duration=NULL; + ss2->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss2->monitoringSymbolsWithinSlot)); + ss2->monitoringSymbolsWithinSlot->buf = calloc(1,2); + ss2->monitoringSymbolsWithinSlot->size = 2; + ss2->monitoringSymbolsWithinSlot->bits_unused = 2; + ss2->monitoringSymbolsWithinSlot->buf[0]=0x80; + ss2->monitoringSymbolsWithinSlot->buf[1]=0x0; + ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates)); + ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType)); + ss2->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + ss2->searchSpaceType->choice.ue_Specific = calloc(1,sizeof(*ss2->searchSpaceType->choice.ue_Specific)); + ss2->searchSpaceType->choice.ue_Specific->dci_Formats=NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0; + + ASN_SEQUENCE_ADD(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, + ss2); + + SpCellConfig->spCellConfigDedicated->tag_Id=0; +} + +void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup) { + + NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL; + NR_RLC_Config_t *rlc_Config = NULL; + NR_LogicalChannelConfig_t *logicalChannelConfig = NULL; + + long *logicalChannelGroup = NULL; + + cellGroupConfig->cellGroupId = 0; + + /* Rlc Bearer Config */ + /* TS38.331 9.2.1 Default SRB configurations */ + cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); + rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t)); + rlc_BearerConfig->logicalChannelIdentity = 2; + rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer)); + rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity; + rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 2; + rlc_BearerConfig->reestablishRLC = NULL; + //if (0) { + rlc_Config = calloc(1, sizeof(NR_RLC_Config_t)); + rlc_Config->present = NR_RLC_Config_PR_am; + rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am)); + rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); + *(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12; + rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms35; + rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms0; + rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); + *(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12; + rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45; + rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity; + rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity; + rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8; + //} + rlc_BearerConfig->rlc_Config = rlc_Config; + + logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t)); + logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters)); + logicalChannelConfig->ul_SpecificParameters->priority = 3; + logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5; + logicalChannelGroup = CALLOC(1, sizeof(long)); + *logicalChannelGroup = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup; + logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID)); + *logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0; + //} + rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig; + + ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); + ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); + + /*DRB Configuration*/ + rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t)); + 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->choice.drb_Identity = 1; + rlc_BearerConfig->reestablishRLC = NULL; + //if (0) { + rlc_Config = calloc(1, sizeof(NR_RLC_Config_t)); + rlc_Config->present = NR_RLC_Config_PR_am; + rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am)); + rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); + *(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18; + rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms80; + rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms10; + rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); + *(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18; + rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms80; + rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_p64; + rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_kB125; + rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t4; + //} + rlc_BearerConfig->rlc_Config = rlc_Config; + logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t)); + logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters)); + logicalChannelConfig->ul_SpecificParameters->priority = 13; + logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; + logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100; + logicalChannelGroup = CALLOC(1, sizeof(long)); + *logicalChannelGroup = 1; + logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup; + logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID)); + *logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0; + + rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig; + + ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); + ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); + + cellGroupConfig->rlc_BearerToReleaseList = NULL; + +} + +void fill_initial_cellGroupConfig(rnti_t rnti, + NR_CellGroupConfig_t *cellGroupConfig, + NR_ServingCellConfigCommon_t *scc) { + + NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL; + NR_RLC_Config_t *rlc_Config = NULL; + NR_LogicalChannelConfig_t *logicalChannelConfig = NULL; + NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL; + NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig = NULL; + long *logicalChannelGroup = NULL; + + cellGroupConfig->cellGroupId = 0; + + /* Rlc Bearer Config */ + /* TS38.331 9.2.1 Default SRB configurations */ + cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); + rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t)); + rlc_BearerConfig->logicalChannelIdentity = 1; + rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer)); + rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity; + rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1; + rlc_BearerConfig->reestablishRLC = NULL; + //if (0) { + rlc_Config = calloc(1, sizeof(NR_RLC_Config_t)); + rlc_Config->present = NR_RLC_Config_PR_am; + rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am)); + rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); + *(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12; + rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms35; + rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms0; + rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); + *(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12; + rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45; + rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity; + rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity; + rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8; + //} + rlc_BearerConfig->rlc_Config = rlc_Config; + + + //if (0) { + logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t)); + logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters)); + logicalChannelConfig->ul_SpecificParameters->priority = 1; + logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + logicalChannelGroup = CALLOC(1, sizeof(long)); + *logicalChannelGroup = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup; + logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID)); + *logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0; + logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0; + //} + rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig; + + ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); + + cellGroupConfig->rlc_BearerToReleaseList = NULL; + + /* mac CellGroup Config */ + if (1) { + mac_CellGroupConfig = calloc(1, sizeof(*mac_CellGroupConfig)); + mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig)); + mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList)); + struct NR_SchedulingRequestToAddMod *schedulingrequestlist; + schedulingrequestlist = CALLOC(1,sizeof(*schedulingrequestlist)); + schedulingrequestlist->schedulingRequestId = 0; + schedulingrequestlist->sr_ProhibitTimer = CALLOC(1,sizeof(*schedulingrequestlist->sr_ProhibitTimer)); + *(schedulingrequestlist->sr_ProhibitTimer) = 0; + schedulingrequestlist->sr_TransMax = 0; + ASN_SEQUENCE_ADD(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist); + mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config)); + mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10; + mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80; + mac_CellGroupConfig->tag_Config = calloc(1, sizeof(*mac_CellGroupConfig->tag_Config)); + mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL; + mac_CellGroupConfig->tag_Config->tag_ToAddModList = calloc(1,sizeof(*mac_CellGroupConfig->tag_Config->tag_ToAddModList)); + struct NR_TAG *tag=calloc(1,sizeof(*tag)); + tag->tag_Id = 0; + tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity; + ASN_SEQUENCE_ADD(&mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag); + mac_CellGroupConfig->phr_Config = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config)); + mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup; + mac_CellGroupConfig->phr_Config->choice.setup = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config->choice.setup)); + mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf10; + mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10; + mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1; + } + cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig; + + physicalCellGroupConfig = calloc(1,sizeof(*physicalCellGroupConfig)); + physicalCellGroupConfig->p_NR_FR1 = calloc(1,sizeof(*physicalCellGroupConfig->p_NR_FR1)); + *physicalCellGroupConfig->p_NR_FR1 = 20; + physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; + cellGroupConfig->physicalCellGroupConfig = physicalCellGroupConfig; + + cellGroupConfig->spCellConfig = calloc(1,sizeof(*cellGroupConfig->spCellConfig)); + + fill_initial_SpCellConfig(rnti,cellGroupConfig->spCellConfig,scc); + + cellGroupConfig->sCellToAddModList = NULL; + cellGroupConfig->sCellToReleaseList = NULL; +} + //------------------------------------------------------------------------------ -uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, - rrc_gNB_ue_context_t *const ue_context_pP, - int CC_id, +uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, const uint8_t transaction_id, - NR_SRB_ToAddModList_t **SRB_configList) + OCTET_STRING_t *masterCellGroup_from_DU, + NR_ServingCellConfigCommon_t *scc) //------------------------------------------------------------------------------ { - asn_enc_rval_t enc_rval;; + asn_enc_rval_t enc_rval; NR_DL_CCCH_Message_t dl_ccch_msg; NR_RRCSetup_t *rrcSetup; NR_RRCSetup_IEs_t *ie; NR_SRB_ToAddMod_t *SRB1_config = NULL; NR_PDCP_Config_t *pdcp_Config = NULL; NR_CellGroupConfig_t *cellGroupConfig = NULL; - NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL; - NR_RLC_Config_t *rlc_Config = NULL; - NR_LogicalChannelConfig_t *logicalChannelConfig = NULL; - NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL; - char masterCellGroup_buf[1000]; - long *logicalChannelGroup = NULL; + + AssertFatal(ue_context_pP != NULL,"ue_context_p is null\n"); + gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + NR_SRB_ToAddModList_t **SRB_configList = &ue_p->SRB_configList; + + memset((void *)&dl_ccch_msg, 0, sizeof(NR_DL_CCCH_Message_t)); dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1; @@ -962,6 +1320,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ie = rrcSetup->criticalExtensions.choice.rrcSetup; /****************************** radioBearerConfig ******************************/ + /* Configure SRB1 */ if (*SRB_configList) { free(*SRB_configList); @@ -981,100 +1340,63 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ie->radioBearerConfig.drb_ToAddModList = NULL; ie->radioBearerConfig.drb_ToReleaseList = NULL; ie->radioBearerConfig.securityConfig = NULL; - + /****************************** masterCellGroup ******************************/ /* TODO */ - cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); - cellGroupConfig->cellGroupId = 0; - - /* Rlc Bearer Config */ - /* TS38.331 9.2.1 Default SRB configurations */ - cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); - rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t)); - rlc_BearerConfig->logicalChannelIdentity = 1; - rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer)); - rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity; - rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1; - rlc_BearerConfig->reestablishRLC = NULL; - rlc_Config = calloc(1, sizeof(NR_RLC_Config_t)); - rlc_Config->present = NR_RLC_Config_PR_am; - rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am)); - rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); - *(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12; - rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms35; - rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms0; - rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); - *(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12; - rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45; - rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity; - rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity; - rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8; - rlc_BearerConfig->rlc_Config = rlc_Config; - logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t)); - logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters)); - logicalChannelConfig->ul_SpecificParameters->priority = 1; - logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - logicalChannelGroup = CALLOC(1, sizeof(long)); - *logicalChannelGroup = 0; - logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup; - rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig; - ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); - - cellGroupConfig->rlc_BearerToReleaseList = NULL; - cellGroupConfig->sCellToAddModList = NULL; - cellGroupConfig->sCellToReleaseList = NULL; - - /* mac CellGroup Config */ - mac_CellGroupConfig = calloc(1, sizeof(NR_MAC_CellGroupConfig_t)); - mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config)); - mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10; - mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80; - mac_CellGroupConfig->phr_Config = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config)); - mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup; - mac_CellGroupConfig->phr_Config->choice.setup = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config->choice.setup)); - mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf10; - mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10; - mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1; - cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig; - - // cellGroupConfig.physicalCellGroupConfig; - - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, - NULL, - (void *)cellGroupConfig, - masterCellGroup_buf, - 100); - - if(enc_rval.encoded == -1) { + if (masterCellGroup_from_DU) { + memcpy(&ie->masterCellGroup,masterCellGroup_from_DU,sizeof(*masterCellGroup_from_DU)); + // decode masterCellGroup OCTET_STRING received from DU and place in ue context + uper_decode(NULL, + &asn_DEF_NR_CellGroupConfig, //might be added prefix later + (void **)&cellGroupConfig, + (uint8_t *)masterCellGroup_from_DU->buf, + masterCellGroup_from_DU->size, 0, 0); + + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); + } + else { + cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); + fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,cellGroupConfig,scc); + + ue_p->masterCellGroup = cellGroupConfig; + + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, + NULL, + (void *)cellGroupConfig, + masterCellGroup_buf, + 1000); + + if(enc_rval.encoded == -1) { LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + enc_rval.failed_type->name, enc_rval.encoded); return -1; - } - - if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) { + } + + if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) { LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n"); return -1; + } } if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message, - NULL, - (void *)&dl_ccch_msg, - buffer, - 100); - + NULL, + (void *)&dl_ccch_msg, + buffer, + 1000); + if(enc_rval.encoded == -1) { - LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } - + LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8); + } uint8_t do_NR_SecurityModeCommand( @@ -1104,9 +1426,9 @@ uint8_t do_NR_SecurityModeCommand( dl_dcch_msg.message.choice.c1->choice.securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm = integrityProtAlgorithm; - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { +// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg); - } +// } enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, @@ -1145,6 +1467,11 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, const uint8_t Transaction_id) //------------------------------------------------------------------------------ { + NR_UE_CapabilityRequestFilterNR_t *sa_band_filter; + NR_FreqBandList_t *sa_band_list; + NR_FreqBandInformation_t *sa_band_info; + NR_FreqBandInformationNR_t *sa_band_infoNR; + NR_DL_DCCH_Message_t dl_dcch_msg; NR_UE_CapabilityRAT_Request_t *ue_capabilityrat_request; @@ -1161,6 +1488,35 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, memset(ue_capabilityrat_request,0,sizeof(NR_UE_CapabilityRAT_Request_t)); ue_capabilityrat_request->rat_Type = NR_RAT_Type_nr; + sa_band_infoNR = (NR_FreqBandInformationNR_t*)calloc(1,sizeof(NR_FreqBandInformationNR_t)); + sa_band_infoNR->bandNR = 78; + sa_band_info = (NR_FreqBandInformation_t*)calloc(1,sizeof(NR_FreqBandInformation_t)); + sa_band_info->present = NR_FreqBandInformation_PR_bandInformationNR; + sa_band_info->choice.bandInformationNR = sa_band_infoNR; + + sa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t)); + ASN_SEQUENCE_ADD(&sa_band_list->list, sa_band_info); + + sa_band_filter = (NR_UE_CapabilityRequestFilterNR_t*)calloc(1,sizeof(NR_UE_CapabilityRequestFilterNR_t)); + sa_band_filter->frequencyBandListFilter = sa_band_list; + + OCTET_STRING_t req_freq; + unsigned char req_freq_buf[1024]; + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_CapabilityRequestFilterNR, + NULL, + (void *)sa_band_filter, + req_freq_buf, + 1024); + + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_UE_CapabilityRequestFilterNR, (void *)sa_band_filter); + } + + req_freq.buf = req_freq_buf; + req_freq.size = (enc_rval.encoded+7)/8; + + ue_capabilityrat_request->capabilityRequestFilter = &req_freq; + ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list, ue_capabilityrat_request); @@ -1246,12 +1602,14 @@ uint16_t do_RRCReconfiguration( NR_MeasConfig_t *meas_config, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, - NR_MAC_CellGroupConfig_t *mac_CellGroupConfig) + NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, + NR_CellGroupConfig_t *cellGroupConfig) //------------------------------------------------------------------------------ { NR_DL_DCCH_Message_t dl_dcch_msg; asn_enc_rval_t enc_rval; NR_RRCReconfiguration_IEs_t *ie; + unsigned char masterCellGroup_buf[1000]; memset(&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t)); dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; @@ -1294,20 +1652,41 @@ uint16_t do_RRCReconfiguration( // lateNonCriticalExtension ie->lateNonCriticalExtension = NULL; // nonCriticalExtension - ie->nonCriticalExtension = calloc(1, sizeof(NR_RRCReconfiguration_v1530_IEs_t)); - ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList; + + if (cellGroupConfig || dedicatedNAS_MessageList) + ie->nonCriticalExtension = calloc(1, sizeof(NR_RRCReconfiguration_v1530_IEs_t)); + if(cellGroupConfig!=NULL){ + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, + NULL, + (void *)cellGroupConfig, + masterCellGroup_buf, + 1000); + if(enc_rval.encoded == -1) { + LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; + } + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); + ie->nonCriticalExtension->masterCellGroup = calloc(1,sizeof(OCTET_STRING_t)); + + ie->nonCriticalExtension->masterCellGroup->buf = masterCellGroup_buf; + ie->nonCriticalExtension->masterCellGroup->size = (enc_rval.encoded+7)/8; + } + + if (dedicatedNAS_MessageList) + ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList; dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie; - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg); - } + //} enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, (void *)&dl_dcch_msg, buffer, - 100); + 1000); if(enc_rval.encoded == -1) { LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", @@ -1506,7 +1885,8 @@ do_NR_DLInformationTransfer( encoded = uper_encode_to_new_buffer (&asn_DEF_NR_DL_DCCH_Message, NULL, (void *) &dl_dcch_msg, (void **)buffer); AssertFatal(encoded > 0,"ASN1 message encoding failed (%s, %ld)!\n", "DLInformationTransfer", encoded); - LOG_D(NR_RRC,"DLInformationTransfer Encoded %zd bytes\n", encoded); + LOG_I(NR_RRC,"DLInformationTransfer Encoded %zd bytes\n", encoded); + for (int i=0;i<encoded;i++) printf("%02x ",(*buffer)[i]); return encoded; } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index bfc4942138ef96e11dbaa9a114b9fa4240369543..4dd6fd939f79b27e149a1889a3c7666df224f626 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -65,6 +65,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, gNB_RrcConfigurationReq *configuration ); +uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, + gNB_RrcConfigurationReq *configuration); + void do_RLC_BEARER(uint8_t Mod_id, int CC_id, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList, @@ -86,12 +89,21 @@ void do_SpCellConfig(gNB_RRC_INST *rrc, uint8_t do_RRCReject(uint8_t Mod_id, uint8_t *const buffer); -uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, - rrc_gNB_ue_context_t *const ue_context_pP, - int CC_id, +void fill_initial_SpCellConfig(rnti_t rnti, + NR_SpCellConfig_t *SpCellConfig, + NR_ServingCellConfigCommon_t *scc); + +void fill_initial_cellGroupConfig(rnti_t rnti, + NR_CellGroupConfig_t *cellGroupConfig, + NR_ServingCellConfigCommon_t *scc); + +void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup); + +uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, const uint8_t transaction_id, - NR_SRB_ToAddModList_t **SRB_configList); + OCTET_STRING_t *masterCellGroup_from_DU, + NR_ServingCellConfigCommon_t *scc); uint8_t do_NR_SecurityModeCommand( const protocol_ctxt_t *const ctxt_pP, uint8_t *const buffer, @@ -117,7 +129,8 @@ uint16_t do_RRCReconfiguration( NR_MeasConfig_t *meas_config, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, - NR_MAC_CellGroupConfig_t *mac_CellGroupConfig); + NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, + NR_CellGroupConfig_t *cellGroupConfig); uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 36d9bdee60c44f18ed419aa729ca5881685ffd6c..1483693ac6f1f85337dbfd47f14900e1d91f823f 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -66,6 +66,7 @@ #include "NR_CellGroupConfig.h" #include "NR_ServingCellConfigCommon.h" #include "NR_EstablishmentCause.h" +#include "NR_SIB1.h" //------------------- #include "intertask_interface.h" @@ -127,7 +128,7 @@ typedef enum UE_STATE_NR_e { #define MAX_MEAS_ID 6 #define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 255 +#define RRC_BUF_SIZE 8192 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 @@ -300,6 +301,7 @@ typedef struct gNB_RRC_UE_s { int UE_MRDC_Capability_size; NR_CellGroupConfig_t *secondaryCellGroup; + NR_CellGroupConfig_t *masterCellGroup; NR_RRCReconfiguration_t *reconfig; NR_RadioBearerConfig_t *rb_config; @@ -425,12 +427,24 @@ typedef struct { uint8_t *SIB1; uint8_t sizeof_SIB1; + uint8_t *SIB23; + uint8_t sizeof_SIB23; + uint8_t *ServingCellConfigCommon; uint8_t sizeof_servingcellconfigcommon; + int physCellId; + NR_BCCH_BCH_Message_t mib; + NR_BCCH_BCH_Message_t *mib_DU; + NR_BCCH_DL_SCH_Message_t *siblock1_DU; + NR_SIB1_t *sib1; + NR_SIB2_t *sib2; + NR_SIB3_t *sib3; + NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23 int ssb_SubcarrierOffset; int pdsch_AntennaPorts; + int pusch_AntennaPorts; int pusch_TargetSNRx10; int pucch_TargetSNRx10; NR_BCCH_DL_SCH_Message_t *siblock1; @@ -440,7 +454,6 @@ typedef struct { NR_SRB_INFO SI; NR_SRB_INFO Srb0; int initial_csi_index[MAX_NR_RRC_UE_CONTEXTS]; - int physCellId; int p_gNB; } rrc_gNB_carrier_data_t; @@ -460,6 +473,9 @@ typedef struct { //---NR---(completely change)--------------------- typedef struct gNB_RRC_INST_s { + ngran_node_t node_type; + uint32_t node_id; + char *node_name; int module_id; eth_params_t eth_params_s; rrc_gNB_carrier_data_t carrier; @@ -471,6 +487,12 @@ typedef struct gNB_RRC_INST_s { hash_table_t *initial_id2_ngap_ids; hash_table_t *ngap_id2_ngap_ids ; + /// NR cell id + uint64_t nr_cellid; + + // RRC configuration + gNB_RrcConfigurationReq configuration; + // other PLMN parameters /// Mobile country code int mcc; @@ -487,6 +509,10 @@ typedef struct gNB_RRC_INST_s { int srb1_timer_reordering; int srb1_timer_status_prohibit; int srs_enable[MAX_NUM_CCs]; + uint16_t sctp_in_streams; + uint16_t sctp_out_streams; + int cell_info_configured; + pthread_mutex_t cell_info_mutex; // security configuration (preferred algorithms) nr_security_configuration_t security; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 6d876a0eefacbfa7dcb94474849e2a40fa186025..72165e97c910cdd462d4f105e14ca282dd819085 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -51,6 +51,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, const frame_t frameP, const rb_id_t Srb_id, + const rnti_t rnti, const uint8_t Nb_tb, uint8_t *const buffer_pP ); @@ -79,17 +80,19 @@ void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellC void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0); 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_ServingCellConfig_t *servingcellconfigdedicated, + NR_CellGroupConfig_t *secondaryCellGroup, + int scg_id, + int servCellIndex, + int n_physical_antenna_ports, + int initial_csi_index); 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_ServingCellConfig_t *servingcellconfigdedicated, + NR_RRCReconfiguration_IEs_t *reconfig, + NR_CellGroupConfig_t *secondaryCellGroup, + int n_physical_antenna_ports, + int initial_csi_index); void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, int eps_bearer_id, int rb_id, @@ -101,6 +104,14 @@ int generate_CG_Config(gNB_RRC_INST *rrc, NR_RRCReconfiguration_t *reconfig, NR_RadioBearerConfig_t *rbconfig); +void +rrc_gNB_generate_RRCSetup( + const protocol_ctxt_t *const ctxt_pP, + rrc_gNB_ue_context_t *const ue_context_pP, + OCTET_STRING_t *masterCellGroup_from_DU, + NR_ServingCellConfigCommon_t *scc, + const int CC_id); + int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m); void @@ -156,6 +167,25 @@ int nr_rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP); +int8_t nr_mac_rrc_data_ind( + const module_id_t module_idP, + const int CC_id, + const frame_t frameP, + const sub_frame_t sub_frameP, + const int UE_id, + const rnti_t rntiP, + const rb_id_t srb_idP, + const uint8_t *sduP, + const sdu_size_t sdu_lenP, + const boolean_t brOption +); + +int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, + const uint8_t *buffer, + int buffer_length, + OCTET_STRING_t *du_to_cu_rrc_container, + const int CC_id); + void rrc_gNB_generate_dedicatedRRCReconfiguration_release( const protocol_ctxt_t *const ctxt_pP, @@ -163,3 +193,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( uint8_t xid, uint32_t nas_length, uint8_t *nas_buffer); + +void +rrc_gNB_generate_dedicatedRRCReconfiguration( + const protocol_ctxt_t *const ctxt_pP, + rrc_gNB_ue_context_t *ue_context_pP); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 6d430d722370c71d0c0351e0a87fade5d2f49d2d..5278cea675b54229cb0dcd05ac616b1b64e890d7 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -55,6 +55,7 @@ #include "NR_RRCSetupRequest-IEs.h" #include "NR_RRCSetupComplete-IEs.h" #include "NR_RRCReestablishmentRequest-IEs.h" +#include "NR_MIB.h" #include "rlc.h" #include "rrc_eNB_UE_context.h" @@ -116,7 +117,8 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con const NR_DRB_ToAddModList_t * const drb2add_listP, const NR_DRB_ToReleaseList_t * const drb2release_listP, const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, - struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_srb_bearer2add_list, + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_drb_bearer2add_list); static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn); @@ -213,26 +215,44 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - rrc->carrier.MIB = (uint8_t *) malloc16(4); - rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + rrc->carrier.MIB = (uint8_t *) malloc16(4); + rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); + } - if(get_softmodem_params()->sa) { + if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration); } + if (!NODE_IS_DU(rrc->node_type)) { + rrc->carrier.SIB23 = (uint8_t *) malloc16(100); + AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB"); + rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier, configuration); + LOG_I(NR_RRC,"do_SIB23_NR, size %d \n ", rrc->carrier.sizeof_SIB23); + AssertFatal(rrc->carrier.sizeof_SIB23 != 255,"FATAL, RC.nrrrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); + } + LOG_I(NR_RRC,"Done init_NR_SI\n"); - rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_TargetSNRx10, - rrc->carrier.pucch_TargetSNRx10, - (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon, - 0, - 0, // WIP hardcoded rnti - (NR_CellGroupConfig_t *)NULL - ); - if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa > 0) { + if (NODE_IS_MONOLITHIC(rrc->node_type)){ + rrc_mac_config_req_gNB(rrc->module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon, + 0, + 0, // WIP hardcoded rnti + (NR_CellGroupConfig_t *)NULL + ); + } + + /* set flag to indicate that cell information is configured. This is required + * in DU to trigger F1AP_SETUP procedure */ + pthread_mutex_lock(&rrc->cell_info_mutex); + rrc->cell_info_configured=1; + pthread_mutex_unlock(&rrc->cell_info_mutex); + + 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"); @@ -277,13 +297,16 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration parse_CG_ConfigInfo(rrc,CG_ConfigInfo,NULL); } else { struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc); + ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig)); + ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd; LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); - rrc_add_nsa_user(rrc,ue_context_p,NULL); + if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) { + 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]; @@ -307,9 +330,10 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->carrier.servingcellconfigcommon = configuration->scc; rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset; rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts; - rrc->carrier.pusch_TargetSNRx10 = configuration->pusch_TargetSNRx10; - rrc->carrier.pucch_TargetSNRx10 = configuration->pucch_TargetSNRx10; - /// System Information INIT + rrc->carrier.pusch_AntennaPorts = configuration->pusch_AntennaPorts; + /// System Information INIT + pthread_mutex_init(&rrc->cell_info_mutex,NULL); + rrc->cell_info_configured = 0; LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); init_NR_SI(rrc, configuration); rrc_init_nr_global_param(); @@ -358,14 +382,17 @@ rrc_gNB_get_next_transaction_identifier( //----------------------------------------------------------------------------- void rrc_gNB_generate_RRCSetup( - const protocol_ctxt_t *const ctxt_pP, - rrc_gNB_ue_context_t *const ue_context_pP, - const int CC_id + const protocol_ctxt_t *const ctxt_pP, + rrc_gNB_ue_context_t *const ue_context_pP, + OCTET_STRING_t *masterCellGroup_from_DU, + NR_ServingCellConfigCommon_t *scc, + const int CC_id ) //----------------------------------------------------------------------------- { LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup \n"); NR_SRB_ToAddModList_t **SRB_configList = NULL; + MessageDef *message_p; // T(T_GNB_RRC_SETUP, // T_INT(ctxt_pP->module_id), @@ -373,55 +400,131 @@ rrc_gNB_generate_RRCSetup( // T_INT(ctxt_pP->subframe), // T_INT(ctxt_pP->rnti)); gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - SRB_configList = &ue_p->SRB_configList; - ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP, - ue_context_pP, - CC_id, - (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, - rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), - SRB_configList); + ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, + (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, + rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), + masterCellGroup_from_DU, + scc); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(ue_p->Srb0.Tx_buffer.Payload), ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRC Setup\n"); + gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; + switch (rrc->node_type) { + case ngran_gNB_CU: + // create an ITTI message + /* TODO: F1 IDs ar missing in RRC */ + nr_rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_pP->ue_context.SRB_configList, + NULL, + NULL, + 0xff, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; + F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti; + F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; + F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; + F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + + break; + + case ngran_gNB_DU: + // nothing to do for DU + AssertFatal(1==0,"nothing to do for DU\n"); + break; - LOG_D(NR_RRC, - PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", - PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); - - // rrc_mac_config_req_eNB + case ngran_gNB: + { + // rrc_mac_config_req_gNB - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, // LG WARNING - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCSetup UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); - LOG_I(NR_RRC, - PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", - PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_p->Srb0.Tx_buffer.payload_size); - // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE - ue_context_pP->ue_context.ue_release_timer = 1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - ue_context_pP->ue_context.ue_release_timer_thres = 1000; - /* init timers */ - // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; #ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, + LOG_I(NR_RRC, + PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", + PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), ue_p->Srb0.Tx_buffer.payload_size); - memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_CCCH_DATA_IND); - GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; - itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, + ue_p->Srb0.Tx_buffer.payload_size); + memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_CCCH_DATA_IND); + GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; + itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); +#else + LOG_D(NR_RRC, + PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", + PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); + MSC_LOG_TX_MESSAGE( + MSC_RRC_GNB, + MSC_RRC_UE, + ue_p->Srb0.Tx_buffer.Header, // LG WARNING + ue_p->Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCSetup UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + ue_p->Srb0.Tx_buffer.payload_size); + LOG_I(NR_RRC, + PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", + PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_p->Srb0.Tx_buffer.payload_size); + // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE + ue_context_pP->ue_context.ue_release_timer = 1; + // remove UE after 10 frames after RRCConnectionRelease is triggered + ue_context_pP->ue_context.ue_release_timer_thres = 1000; + /* init timers */ + // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; + + // configure MAC + rrc_mac_config_req_gNB(rrc->module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + NULL, + 0, + ue_context_pP->ue_context.rnti, + ue_context_pP->ue_context.masterCellGroup + ); + nr_rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_pP->ue_context.SRB_configList, + NULL, + NULL, + NULL, + ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList, + NULL); + nr_rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_pP->ue_context.SRB_configList, + NULL, + NULL, + 0xff, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList); #endif + } + break; + + default: + LOG_W(NR_RRC, "Unknown node type %d\n", rrc->node_type); + break; + } } //----------------------------------------------------------------------------- @@ -436,17 +539,17 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( NR_SRB_ToAddModList_t **SRB_configList = NULL; rrc_gNB_ue_context_t *ue_context_pP = NULL; gNB_RRC_INST *rrc_instance_p = RC.nrrrc[ctxt_pP->module_id]; + NR_ServingCellConfigCommon_t *scc=rrc_instance_p->carrier.servingcellconfigcommon; ue_context_pP = rrc_gNB_get_next_free_ue_context(ctxt_pP, rrc_instance_p, 0); gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; SRB_configList = &ue_p->SRB_configList; - ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP, - ue_context_pP, - CC_id, - (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, - rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), - SRB_configList); + ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, + (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, + rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), + NULL, + scc); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(ue_p->Srb0.Tx_buffer.Payload), @@ -460,43 +563,42 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( rrc_mac_config_req_gNB(rrc_instance_p->module_id, rrc_instance_p->carrier.ssb_SubcarrierOffset, rrc_instance_p->carrier.pdsch_AntennaPorts, - rrc_instance_p->carrier.pusch_TargetSNRx10, - rrc_instance_p->carrier.pucch_TargetSNRx10, + rrc_instance_p->carrier.pusch_AntennaPorts, (NR_ServingCellConfigCommon_t *)rrc_instance_p->carrier.servingcellconfigcommon, 0, ue_context_pP->ue_context.rnti, (NR_CellGroupConfig_t *)NULL - ); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, // LG WARNING - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCSetup UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); - LOG_I(NR_RRC, + ); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_GNB, + MSC_RRC_UE, + ue_p->Srb0.Tx_buffer.Header, // LG WARNING + ue_p->Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCSetup UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + ue_p->Srb0.Tx_buffer.payload_size); + LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), ue_p->Srb0.Tx_buffer.payload_size); - // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE - ue_context_pP->ue_context.ue_release_timer = 1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - ue_context_pP->ue_context.ue_release_timer_thres = 1000; - /* init timers */ - // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; + // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE + ue_context_pP->ue_context.ue_release_timer = 1; + // remove UE after 10 frames after RRCConnectionRelease is triggered + ue_context_pP->ue_context.ue_release_timer_thres = 1000; + /* init timers */ + // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; #ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, - ue_p->Srb0.Tx_buffer.payload_size); - memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_CCCH_DATA_IND); - GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; - itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); + MessageDef *message_p; + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, + ue_p->Srb0.Tx_buffer.payload_size); + memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_CCCH_DATA_IND); + GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; + itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #endif } @@ -510,6 +612,8 @@ rrc_gNB_generate_RRCReject( { LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n"); gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + MessageDef *message_p; + ue_p->Srb0.Tx_buffer.payload_size = do_RRCReject(ctxt_pP->module_id, (uint8_t *)ue_p->Srb0.Tx_buffer.Payload); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, @@ -529,17 +633,47 @@ rrc_gNB_generate_RRCReject( PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), ue_p->Srb0.Tx_buffer.payload_size); + switch (RC.nrrrc[ctxt_pP->module_id]->node_type) { + case ngran_gNB_CU: + // create an ITTI message + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; + F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti; + F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; + F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; + F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + break; + + case ngran_gNB_DU: + // nothing to do for DU + AssertFatal(1==0,"nothing to do for DU\n"); + break; + + case ngran_gNB: + { #ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, - ue_p->Srb0.Tx_buffer.payload_size); - memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_CCCH_DATA_IND); - GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; - itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, + ue_p->Srb0.Tx_buffer.payload_size); + memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_CCCH_DATA_IND); + GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; + itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #endif + // rrc_mac_config_req_gNB + } + break; + + default : + LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type); + } } //----------------------------------------------------------------------------- @@ -557,6 +691,7 @@ rrc_gNB_process_RRCSetupComplete( LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); ue_context_pP->ue_context.Srb1.Active = 1; + ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1; ue_context_pP->ue_context.Status = NR_RRC_CONNECTED; if (AMF_MODE_ENABLED) { @@ -576,13 +711,13 @@ rrc_gNB_generate_defaultRRCReconfiguration( { uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; - NR_SRB_ToAddModList_t **SRB_configList2 = NULL; + /*NR_SRB_ToAddModList_t **SRB_configList2 = NULL; NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; NR_DRB_ToAddModList_t **DRB_configList = NULL; NR_DRB_ToAddModList_t **DRB_configList2 = NULL; NR_SRB_ToAddMod_t *SRB2_config = NULL; NR_DRB_ToAddMod_t *DRB_config = NULL; - NR_SDAP_Config_t *sdap_config = NULL; + NR_SDAP_Config_t *sdap_config = NULL;*/ struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList = NULL; NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL; @@ -591,7 +726,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( /******************** Radio Bearer Config ********************/ /* Configure SRB2 */ - SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; + /*SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; if (*SRB_configList2) { free(*SRB_configList2); } @@ -600,10 +735,10 @@ rrc_gNB_generate_defaultRRCReconfiguration( SRB2_config = CALLOC(1, sizeof(*SRB2_config)); SRB2_config->srb_Identity = 2; ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);*/ /* Configure DRB */ - DRB_configList = &ue_context_pP->ue_context.DRB_configList; + /*DRB_configList = &ue_context_pP->ue_context.DRB_configList; if (*DRB_configList) { free(*DRB_configList); } @@ -631,7 +766,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( DRB_config->pdcp_Config = calloc(1, sizeof(*DRB_config->pdcp_Config)); DRB_config->pdcp_Config->drb = calloc(1,sizeof(*DRB_config->pdcp_Config->drb)); DRB_config->pdcp_Config->drb->discardTimer = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->discardTimer)); - *DRB_config->pdcp_Config->drb->discardTimer = NR_PDCP_Config__drb__discardTimer_ms30; + *DRB_config->pdcp_Config->drb->discardTimer = NR_PDCP_Config__drb__discardTimer_infinity; DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL)); *DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL)); @@ -649,7 +784,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( DRB_config->pdcp_Config->ext1 = NULL; ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); - ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); + ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);*/ dedicatedNAS_MessageList = CALLOC(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList)); @@ -671,13 +806,14 @@ rrc_gNB_generate_defaultRRCReconfiguration( memset(buffer, 0, RRC_BUF_SIZE); size = do_RRCReconfiguration(ctxt_pP, buffer, xid, - *SRB_configList2, - *DRB_configList, + NULL,//*SRB_configList2, + NULL,//*DRB_configList, NULL, NULL, NULL, NULL, dedicatedNAS_MessageList, + NULL, NULL); free(ue_context_pP->ue_context.nas_pdu.buffer); @@ -688,7 +824,38 @@ rrc_gNB_generate_defaultRRCReconfiguration( ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(NR_RRC, "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + switch (RC.nrrrc[ctxt_pP->module_id]->node_type) { + case ngran_gNB_CU: + nr_rrc_data_req(ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + // rrc_pdcp_config_asn1_req + + break; + + case ngran_gNB_DU: + // nothing to do for DU + AssertFatal(1==0,"nothing to do for DU\n"); + break; + + case ngran_gNB: + { +#ifdef ITTI_SIM + MessageDef *message_p; + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, size); + memcpy (message_buffer, buffer, size); + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_DCCH_DATA_IND); + GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; + GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_DCCH_DATA_IND (message_p).size = size; + itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); +#else + LOG_D(NR_RRC, "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, @@ -696,7 +863,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( rrc_gNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, + MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_RRC_UE, buffer, size, @@ -705,27 +872,247 @@ rrc_gNB_generate_defaultRRCReconfiguration( ue_context_pP->ue_context.rnti, rrc_gNB_mui, size); + nr_rrc_data_req(ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + // rrc_pdcp_config_asn1_req +#endif + // rrc_rlc_config_asn1_req + } + break; + + default : + LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type); + } +} + +//----------------------------------------------------------------------------- +void +rrc_gNB_generate_dedicatedRRCReconfiguration( + const protocol_ctxt_t *const ctxt_pP, + rrc_gNB_ue_context_t *ue_context_pP +) +//----------------------------------------------------------------------------- +{ + NR_DRB_ToAddMod_t *DRB_config = NULL; + NR_SRB_ToAddMod_t *SRB2_config = NULL; + NR_SDAP_Config_t *sdap_config = NULL; + NR_DRB_ToAddModList_t **DRB_configList = NULL; + NR_DRB_ToAddModList_t **DRB_configList2 = NULL; + NR_SRB_ToAddModList_t **SRB_configList2 = NULL; + NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; + struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList + *dedicatedNAS_MessageList = NULL; + NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL; + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int qos_flow_index = 0; + NR_QFI_t qfi = 0; + int pdu_sessions_done = 0; + int i; + NR_CellGroupConfig_t *cellGroupConfig; + + uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id); + + /* Configure SRB2 */ + SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; + if (*SRB_configList2) { + free(*SRB_configList2); + } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); + memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB2_config->srb_Identity = 2; + ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + + DRB_configList = &ue_context_pP->ue_context.DRB_configList; + if (*DRB_configList) { + free(*DRB_configList); + } + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); + memset(*DRB_configList, 0, sizeof(**DRB_configList)); + + DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { + free(*DRB_configList2); + } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); + memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); + + dedicatedNAS_MessageList = CALLOC(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList)); + + for (i = 0; i < ue_context_pP->ue_context.setup_pdu_sessions; i++) { + if (pdu_sessions_done >= ue_context_pP->ue_context.nb_of_pdusessions) { + break; + } + + if (ue_context_pP->ue_context.pdusession[i].status >= PDU_SESSION_STATUS_DONE) { + continue; + } + + DRB_config = CALLOC(1, sizeof(*DRB_config)); + DRB_config->drb_Identity = i+1; + DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation)); + DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config; + // sdap_Config + sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t)); + memset(sdap_config, 0, sizeof(NR_SDAP_Config_t)); + sdap_config->pdu_Session = ue_context_pP->ue_context.pdusession[i].param.pdusession_id; + sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_absent; + sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_present; + sdap_config->defaultDRB = TRUE; + sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd)); + memset(sdap_config->mappedQoS_FlowsToAdd, 0, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd)); + + for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[i].param.nb_qos; qos_flow_index++) { + qfi = ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].qfi; + ASN_SEQUENCE_ADD(&sdap_config->mappedQoS_FlowsToAdd->list, &qfi); + } + sdap_config->mappedQoS_FlowsToRelease = NULL; + DRB_config->cnAssociation->choice.sdap_Config = sdap_config; + + // pdcp_Config + DRB_config->reestablishPDCP = NULL; + DRB_config->recoverPDCP = NULL; + DRB_config->pdcp_Config = calloc(1, sizeof(*DRB_config->pdcp_Config)); + DRB_config->pdcp_Config->drb = calloc(1,sizeof(*DRB_config->pdcp_Config->drb)); + DRB_config->pdcp_Config->drb->discardTimer = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->discardTimer)); + *DRB_config->pdcp_Config->drb->discardTimer = NR_PDCP_Config__drb__discardTimer_infinity; + DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL)); + *DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; + DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL)); + *DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits; + DRB_config->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed; + DRB_config->pdcp_Config->drb->headerCompression.choice.notUsed = 0; + + DRB_config->pdcp_Config->drb->integrityProtection = NULL; + DRB_config->pdcp_Config->drb->statusReportRequired = NULL; + DRB_config->pdcp_Config->drb->outOfOrderDelivery = NULL; + DRB_config->pdcp_Config->moreThanOneRLC = NULL; + + DRB_config->pdcp_Config->t_Reordering = calloc(1, sizeof(*DRB_config->pdcp_Config->t_Reordering)); + *DRB_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms750; + DRB_config->pdcp_Config->ext1 = NULL; + + // Reference TS23501 Table 5.7.4-1: Standardized 5QI to QoS characteristics mapping + for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[i].param.nb_qos; qos_flow_index++) { + switch (ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].fiveQI) { + case 1: //100ms + case 2: //150ms + case 3: //50ms + case 4: //300ms + case 5: //100ms + case 6: //300ms + case 7: //100ms + case 8: //300ms + case 9: //300ms Video (Buffered Streaming)TCP-based (e.g., www, e-mail, chat, ftp, p2p file sharing, progressive video, etc.) + // TODO + break; + + default: + LOG_E(NR_RRC,"not supported 5qi %d\n", ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].fiveQI); + ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_FAILED; + ue_context_pP->ue_context.pdusession[i].xid = xid; + pdu_sessions_done++; + free(DRB_config); + continue; + } + } + + ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); + ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); + + ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_DONE; + ue_context_pP->ue_context.pdusession[i].xid = xid; + + if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t)); + memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedNAS_Message, + (char *)ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedNAS_MessageList->list, dedicatedNAS_Message); + + LOG_I(NR_RRC,"add NAS info with size %d (pdusession id %d)\n",ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length, i); + } else { + // TODO + LOG_E(NR_RRC,"no NAS info (pdusession id %d)\n", i); + } + } + + /* If list is empty free the list and reset the address */ + if (dedicatedNAS_MessageList->list.count == 0) { + free(dedicatedNAS_MessageList); + dedicatedNAS_MessageList = NULL; + } + + memset(buffer, 0, RRC_BUF_SIZE); + cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); + fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup); + size = do_RRCReconfiguration(ctxt_pP, buffer, + xid, + *SRB_configList2, + *DRB_configList, + NULL, + NULL, + NULL, + NULL, + dedicatedNAS_MessageList, + NULL, + cellGroupConfig); + LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { + if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer = NULL; + } + } + + LOG_I(NR_RRC, + "[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCReconfiguration (bytes %d, UE RNTI %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + LOG_D(NR_RRC, + "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_gNB_mui, ctxt_pP->module_id, DCCH); + MSC_LOG_TX_MESSAGE( + MSC_RRC_GNB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" dedicated RRCReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_gNB_mui, + size); + #ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, size); - memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_DCCH_DATA_IND); - GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; - GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_DCCH_DATA_IND (message_p).size = size; - itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); + MessageDef *message_p; + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size); + memcpy (message_buffer, buffer, size); + message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_DCCH_DATA_IND); + GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; + GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_DCCH_DATA_IND (message_p).size = size; + itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else - nr_rrc_data_req(ctxt_pP, - DCCH, - rrc_gNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + nr_rrc_data_req( + ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); #endif - // rrc_pdcp_config_asn1_req - // rrc_rlc_config_asn1_req } //----------------------------------------------------------------------------- @@ -784,6 +1171,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( NULL, NULL, dedicatedNAS_MessageList, + NULL, NULL); ue_context_pP->ue_context.pdu_session_release_command_flag = 1; @@ -878,25 +1266,31 @@ rrc_gNB_process_RRCReconfigurationComplete( ue_context_pP->ue_context.rnti); #ifndef ITTI_SIM + LOG_I(NR_RRC,"Configuring PDCP DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); + nr_rrc_pdcp_config_asn1_req(ctxt_pP, SRB_configList, // NULL, DRB_configList, DRB_Release_configList2, - 0xff, // already configured during the securitymodecommand + 0, // already configured during the securitymodecommand kRRCenc, kRRCint, kUPenc, NULL, NULL, NULL, - NULL); + ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList); /* Refresh SRBs/DRBs */ - nr_rrc_rlc_config_asn1_req(ctxt_pP, + if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + LOG_I(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); + nr_rrc_rlc_config_asn1_req(ctxt_pP, SRB_configList, // NULL, DRB_configList, DRB_Release_configList2, NULL, + ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList, NULL); + } #endif /* Set the SRB active in UE context */ @@ -904,6 +1298,7 @@ rrc_gNB_process_RRCReconfigurationComplete( for (int i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { if (SRB_configList->list.array[i]->srb_Identity == 1) { ue_context_pP->ue_context.Srb1.Active = 1; + ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1; } else if (SRB_configList->list.array[i]->srb_Identity == 2) { ue_context_pP->ue_context.Srb2.Active = 1; ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2; @@ -1285,6 +1680,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( NULL, NULL, // MeasObj_list, NULL, + NULL, NULL); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); @@ -1319,15 +1715,15 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( rrc_gNB_mui, size); #ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, size); - memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_DCCH_DATA_IND); - GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; - GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_DCCH_DATA_IND (message_p).size = size; - itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); + MessageDef *message_p; + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, size); + memcpy (message_buffer, buffer, size); + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_DCCH_DATA_IND); + GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; + GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_DCCH_DATA_IND (message_p).size = size; + itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else nr_rrc_data_req( ctxt_pP, @@ -1346,6 +1742,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, const uint8_t *buffer, int buffer_length, + OCTET_STRING_t *du_to_cu_rrc_container, const int CC_id) { module_id_t Idx; @@ -1383,7 +1780,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, break; case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest: - LOG_I(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %x)\n", ctxt_pP->rnti); + LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %x)\n", ctxt_pP->rnti); ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti); if (ue_context_p != NULL) { rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p); @@ -1470,9 +1867,9 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_E(RRC, "%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); } - if (ue_context_p != NULL) { - ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence = TRUE; - ue_context_p->ue_context.ng_5G_S_TMSI_Part1 = s_tmsi_part1; + if (ue_context_p != NULL) { + ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence = TRUE; + ue_context_p->ue_context.ng_5G_S_TMSI_Part1 = s_tmsi_part1; } } } else { @@ -1490,15 +1887,18 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, CC_id); break; } - } - if (ue_context_p != NULL) { ue_context_p->ue_context.establishment_cause = rrcSetupRequest->establishmentCause; - } - rrc_gNB_generate_RRCSetup(ctxt_pP, - rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), - CC_id); + rrc_gNB_generate_RRCSetup(ctxt_pP, + rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), + du_to_cu_rrc_container, + gnb_rrc_inst->carrier.servingcellconfigcommon, + CC_id); + + // FIXME: Check the best place to perform this DRB configuration + //nr_DRB_preconfiguration(ctxt_pP->rnti); + } break; case NR_UL_CCCH_MessageType__c1_PR_rrcResumeRequest: @@ -1785,6 +2185,8 @@ rrc_gNB_decode_dcch( LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); + for (int i=0;i<sdu_sizeP;i++) printf("%02x ",Rx_sdu[i]); + printf("\n"); dec_rval = uper_decode( NULL, &asn_DEF_NR_UL_DCCH_Message, @@ -1793,7 +2195,7 @@ rrc_gNB_decode_dcch( sdu_sizeP, 0, 0); - // xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg); + xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg); { for (i = 0; i < sdu_sizeP; i++) { @@ -2247,6 +2649,119 @@ rrc_gNB_decode_dcch( return 0; } +void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { + LOG_I(NR_RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); + int cu_cell_ind = 0; + MessageDef *msg_p = NULL,*msg_p2=NULL; + + for (int i = 0; i < f1_setup_req->num_cells_available; i++) { + int found_cell=0; + for (int j=0; j<RC.nb_nr_inst; j++) { + gNB_RRC_INST *rrc = RC.nrrrc[j]; + + if (rrc->configuration.mcc[0] == f1_setup_req->mcc[i] && + rrc->configuration.mnc[0] == f1_setup_req->mnc[i] && + rrc->nr_cellid == f1_setup_req->nr_cellid[i]) { + // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) + rrc->carrier.MIB = malloc(f1_setup_req->mib_length[i]); + rrc->carrier.sizeof_MIB = f1_setup_req->mib_length[i]; + LOG_W(NR_RRC, "instance %d mib length %d\n", i, f1_setup_req->mib_length[i]); + LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]); + memcpy((void *)rrc->carrier.MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]); + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_NR_BCCH_BCH_Message, + (void **)&rrc->carrier.mib_DU, + f1_setup_req->mib[i], + f1_setup_req->mib_length[i]); + AssertFatal(dec_rval.code == RC_OK, + "[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n", + j, + dec_rval.consumed ); + NR_BCCH_BCH_Message_t *mib = &rrc->carrier.mib; + NR_BCCH_BCH_Message_t *mib_DU = rrc->carrier.mib_DU; + mib->message.present = NR_BCCH_BCH_MessageType_PR_mib; + mib->message.choice.mib = CALLOC(1,sizeof(struct NR_MIB)); + memset(mib->message.choice.mib,0,sizeof(struct NR_MIB)); + memcpy(mib->message.choice.mib, mib_DU->message.choice.mib, sizeof(struct NR_MIB)); + + rrc->carrier.SIB1 = malloc(f1_setup_req->sib1_length[i]); + rrc->carrier.sizeof_SIB1 = f1_setup_req->sib1_length[i]; + memcpy((void *)rrc->carrier.SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]); + dec_rval = uper_decode_complete(NULL, + &asn_DEF_NR_BCCH_DL_SCH_Message, + (void **)&rrc->carrier.siblock1_DU, + f1_setup_req->sib1[i], + f1_setup_req->sib1_length[i]); + AssertFatal(dec_rval.code == RC_OK, + "[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n", + j, + dec_rval.consumed ); + + // Parse message and extract SystemInformationBlockType1 field + NR_BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier.siblock1_DU; + AssertFatal(bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1, + "bcch_message->message.present != NR_BCCH_DL_SCH_MessageType_PR_c1\n"); + AssertFatal(bcch_message->message.choice.c1->present == NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1, + "bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); + rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; + rrc->carrier.physCellId = f1_setup_req->nr_pci[i]; + if (cu_cell_ind == 0) { + // prepare F1_SETUP_RESPONSE + GNB_CU_CONFIGURATION_UPDATE + if (msg_p == NULL) { + msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP); + } + if (msg_p2 == NULL) { + msg_p2 = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); + } + + F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; + F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0; + + } + + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i]; + int num_SI= 0; + + if (rrc->carrier.SIB23) { + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].SI_container[2] = rrc->carrier.SIB23; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].SI_container_length[2] = rrc->carrier.sizeof_SIB23; + num_SI++; + } + + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI; + cu_cell_ind++; + found_cell=1; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind; + // send + break; + } else {// setup_req mcc/mnc match rrc internal list element + LOG_W(NR_RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d rrc->nr_cellid/f1_setup_req->nr_cellid %ld/%ld \n", + j, rrc->configuration.mcc[0], f1_setup_req->mcc[i], + rrc->configuration.mnc[0], f1_setup_req->mnc[i], + rrc->nr_cellid, f1_setup_req->nr_cellid[i]); + } + }// for (int j=0;j<RC.nb_inst;j++) + + if (found_cell == 0) { + AssertFatal(1 == 0, "No cell found\n"); + } + else { + // send ITTI message to F1AP-CU task + itti_send_msg_to_task (TASK_CU_F1, 0, msg_p); + + itti_send_msg_to_task (TASK_CU_F1, 0, msg_p2); + + } + + // handle other failure cases + }//for (int i=0;i<f1_setup_req->num_cells_available;i++) +} + void rrc_gNB_process_release_request(const module_id_t gnb_mod_idP, x2ap_ENDC_sgnb_release_request_t *m) { gNB_RRC_INST *rrc = RC.nrrrc[gnb_mod_idP]; @@ -2308,17 +2823,18 @@ void *rrc_gnb_task(void *args_p) { /* Messages from MAC */ case NR_RRC_MAC_CCCH_DATA_IND: - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index, - GNB_FLAG_YES, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti, - msg_p->ittiMsgHeader.lte_time.frame, - msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(NR_RRC,"Decoding CCCH : inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - instance, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, - &ctxt, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index, + GNB_FLAG_YES, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", + ctxt.rnti, + instance, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, + &ctxt, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) { LOG_I(NR_RRC, "CCCH message has size %d > %d\n", @@ -2327,9 +2843,14 @@ void *rrc_gnb_task(void *args_p) { } nr_rrc_gNB_decode_ccch(&ctxt, - (uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id); + (uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id); + if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) { + free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf); + free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container); + } break; /* Messages from PDCP */ @@ -2340,6 +2861,11 @@ void *rrc_gnb_task(void *args_p) { NR_RRC_DCCH_DATA_IND(msg_p).rnti, msg_p->ittiMsgHeader.lte_time.frame, msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(NR_RRC,"Decoding DCCH : ue %d, inst %ld, ctxt %p, size %d\n", + ctxt.rnti, + instance, + &ctxt, + NR_RRC_DCCH_DATA_IND(msg_p).sdu_size); LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(&ctxt), NR_RRC_DCCH_DATA_IND(msg_p).dcch_index, @@ -2348,6 +2874,8 @@ void *rrc_gnb_task(void *args_p) { NR_RRC_DCCH_DATA_IND(msg_p).dcch_index, NR_RRC_DCCH_DATA_IND(msg_p).sdu_p, NR_RRC_DCCH_DATA_IND(msg_p).sdu_size); + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), NR_RRC_DCCH_DATA_IND(msg_p).sdu_p); + break; case NGAP_DOWNLINK_NAS: @@ -2426,6 +2954,14 @@ 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 F1AP task */ + case F1AP_SETUP_REQ: + AssertFatal(NODE_IS_CU(RC.nrrrc[instance]->node_type), + "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); + LOG_I(NR_RRC,"[gNB %ld] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); + rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); + break; + /* Messages from X2AP */ case X2AP_ENDC_SGNB_ADDITION_REQ: LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); @@ -2477,12 +3013,13 @@ void *rrc_gnb_task(void *args_p) { void rrc_gNB_generate_SecurityModeCommand( const protocol_ctxt_t *const ctxt_pP, - rrc_gNB_ue_context_t *const ue_context_pP + rrc_gNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { uint8_t buffer[100]; uint8_t size; + T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); NR_IntegrityProtAlgorithm_t integrity_algorithm = (NR_IntegrityProtAlgorithm_t)ue_context_pP->ue_context.integrity_algorithm; @@ -2497,24 +3034,45 @@ rrc_gNB_generate_SecurityModeCommand( PROTOCOL_NR_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(NR_RRC, + + switch (RC.nrrrc[ctxt_pP->module_id]->node_type) { + case ngran_gNB_CU: + // create an ITTI message + memcpy(ue_context_pP->ue_context.Srb1.Srb_info.Tx_buffer.Payload, buffer, size); + ue_context_pP->ue_context.Srb1.Srb_info.Tx_buffer.payload_size = size; + + LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n"); + nr_rrc_data_req(ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + break; + + case ngran_gNB_DU: + // nothing to do for DU + AssertFatal(1==0,"nothing to do for DU\n"); + break; + + case ngran_gNB: + LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_gNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); - - LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n"); + MSC_LOG_TX_MESSAGE( + MSC_RRC_GNB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_gNB_mui, + size); #ifdef ITTI_SIM MessageDef *message_p; uint8_t *message_buffer; @@ -2526,15 +3084,20 @@ rrc_gNB_generate_SecurityModeCommand( GNB_RRC_DCCH_DATA_IND (message_p).size = size; itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else + LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n"); nr_rrc_data_req(ctxt_pP, - DCCH, - rrc_gNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); #endif + break; + default : + LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type); + } } void @@ -2546,32 +3109,52 @@ rrc_gNB_generate_UECapabilityEnquiry( { uint8_t buffer[100]; uint8_t size; + T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); size = do_NR_SA_UECapabilityEnquiry( ctxt_pP, buffer, rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id)); - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate NR UECapabilityEnquiry (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + LOG_I(NR_RRC, + PROTOCOL_NR_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate NR UECapabilityEnquiry (bytes %d)\n", + PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (NR UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + switch (RC.nrrrc[ctxt_pP->module_id]->node_type) { + case ngran_gNB_CU: + nr_rrc_data_req( + ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + break; + + case ngran_gNB_DU: + // nothing to do for DU + AssertFatal(1==0,"nothing to do for DU\n"); + break; + + case ngran_gNB: + // rrc_mac_config_req_gNB + LOG_D(NR_RRC, + PROTOCOL_NR_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (NR UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", + PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_gNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcNRUECapabilityEnquiry UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); + MSC_LOG_TX_MESSAGE( + MSC_RRC_GNB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcNRUECapabilityEnquiry UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_gNB_mui, + size); #ifdef ITTI_SIM MessageDef *message_p; uint8_t *message_buffer; @@ -2584,14 +3167,19 @@ rrc_gNB_generate_UECapabilityEnquiry( itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else nr_rrc_data_req( - ctxt_pP, - DCCH, - rrc_gNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); #endif + break; + + default : + LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type); + } } //----------------------------------------------------------------------------- diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index c6778729ec47d1daf78fa467f1e6dc3935068679..dc9a53acc2e1adcec90ceca1524fa42bdd48f6fe 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -57,6 +57,7 @@ #include "RRC/NR/MESSAGES/asn1_msg.h" #include "NR_UERadioAccessCapabilityInformation.h" #include "NR_UE-CapabilityRAT-ContainerList.h" +#include "f1ap_messages_types.h" extern RAN_CONTEXT_t RC; @@ -303,25 +304,45 @@ nr_rrc_pdcp_config_security( uint8_t *kRRCenc = NULL; uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; + uint8_t *k_kdf = NULL; pdcp_t *pdcp_p = NULL; static int print_keys= 1; hashtable_rc_t h_rc; hash_key_t key; #ifndef PHYSIM - /* Derive the keys from kgnb */ - if (SRB_configList != NULL) { - nr_derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, - ue_context_pP->ue_context.kgnb, - &kUPenc); - } + /* Derive the keys from kgnb */ + if (SRB_configList != NULL) { + k_kdf = NULL; + nr_derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.kgnb, + &k_kdf); + /* kUPenc: last 128 bits of key derivation function which returns 256 bits */ + kUPenc = malloc(16); + if (kUPenc == NULL) exit(1); + memcpy(kUPenc, k_kdf+16, 16); + free(k_kdf); + } - nr_derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, - ue_context_pP->ue_context.kgnb, - &kRRCenc); - nr_derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, - ue_context_pP->ue_context.kgnb, - &kRRCint); + k_kdf = NULL; + nr_derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.kgnb, + &k_kdf); + /* kRRCenc: last 128 bits of key derivation function which returns 256 bits */ + kRRCenc = malloc(16); + if (kRRCenc == NULL) exit(1); + memcpy(kRRCenc, k_kdf+16, 16); + free(k_kdf); + + k_kdf = NULL; + nr_derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, + ue_context_pP->ue_context.kgnb, + &k_kdf); + /* kRRCint: last 128 bits of key derivation function which returns 256 bits */ + kRRCint = malloc(16); + if (kRRCint == NULL) exit(1); + memcpy(kRRCint, k_kdf+16, 16); + free(k_kdf); #endif if (!IS_SOFTMODEM_IQPLAYER) { SET_LOG_DUMP(DEBUG_SECURITY) ; @@ -337,28 +358,18 @@ nr_rrc_pdcp_config_security( } } - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); - h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); - - if (h_rc == HASH_TABLE_OK) { - pdcp_config_set_security( - ctxt_pP, - pdcp_p, - DCCH, - DCCH+2, - (send_security_mode_command == TRUE) ? - 0 | (ue_context_pP->ue_context.integrity_algorithm << 4) : - (ue_context_pP->ue_context.ciphering_algorithm ) | - (ue_context_pP->ue_context.integrity_algorithm << 4), - kRRCenc, - kRRCint, - kUPenc); - } else { - LOG_E(NR_RRC, - PROTOCOL_NR_RRC_CTXT_UE_FMT"Could not get PDCP instance for SRB DCCH %u\n", - PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH); - } + pdcp_config_set_security( + ctxt_pP, + NULL, /* pdcp_pP not used anymore in NR */ + DCCH, + DCCH+2, + (send_security_mode_command == TRUE) ? + 0 | (ue_context_pP->ue_context.integrity_algorithm << 4) : + (ue_context_pP->ue_context.ciphering_algorithm ) | + (ue_context_pP->ue_context.integrity_algorithm << 4), + kRRCenc, + kRRCint, + kUPenc); } //------------------------------------------------------------------------------ @@ -424,62 +435,63 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( NGAP_NAS_FIRST_REQ(message_p).selected_plmn_identity = selected_plmn_identity; if (rrcSetupComplete->registeredAMF != NULL) { - NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF; - NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami; - - if (r_amf->plmn_Identity != NULL) { - if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) { - /* Use first indicated PLMN MCC if it is defined */ - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity]; - LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", - ctxt_pP->module_id, - NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc, - ue_context_pP->ue_context.rnti); + NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF; + NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami; + + if (r_amf->plmn_Identity != NULL) { + if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) { + /* Use first indicated PLMN MCC if it is defined */ + NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity]; + LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", + ctxt_pP->module_id, + NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc, + ue_context_pP->ue_context.rnti); + } + + if (r_amf->plmn_Identity->mnc.list.count > 0) { + /* Use first indicated PLMN MNC if it is defined */ + NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity]; + LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n", + ctxt_pP->module_id, + NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc, + ue_context_pP->ue_context.rnti); + } + } else { + /* TODO */ } - if (r_amf->plmn_Identity->mnc.list.count > 0) { - /* Use first indicated PLMN MNC if it is defined */ - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity]; - LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n", + /* amf_Identifier */ + uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier); + NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id = amf_Id >> 16; + NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id; + NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer; + + ue_context_pP->ue_context.ue_guami.mcc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc; + ue_context_pP->ue_context.ue_guami.mnc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc; + ue_context_pP->ue_context.ue_guami.mnc_len = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc_len; + ue_context_pP->ue_context.ue_guami.amf_region_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id; + ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id; + ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer; + + MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB, + MSC_NGAP_AMF, + (const char *)&message_p->ittiMsg.ngap_nas_first_req, + sizeof(ngap_nas_first_req_t), + MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x", + MSC_AS_TIME_ARGS(ctxt_pP), + ctxt_pP->module_id, + ctxt_pP->rnti); + LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n", ctxt_pP->module_id, - NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc, + NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id, + NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_region_id, ue_context_pP->ue_context.rnti); - } - } else { - /* TODO */ - } - - /* amf_Identifier */ - uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier); - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id = amf_Id >> 16; - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id; - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer; - - ue_context_pP->ue_context.ue_guami.mcc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc; - ue_context_pP->ue_context.ue_guami.mnc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc; - ue_context_pP->ue_context.ue_guami.mnc_len = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc_len; - ue_context_pP->ue_context.ue_guami.amf_region_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id; - ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id; - ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer; - - MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)&message_p->ittiMsg.ngap_nas_first_req, - sizeof(ngap_nas_first_req_t), - MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->module_id, - ctxt_pP->rnti); - LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n", - ctxt_pP->module_id, - NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id, - NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_region_id, - ue_context_pP->ue_context.rnti); } itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, message_p); } + //------------------------------------------------------------------------------ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( @@ -626,6 +638,10 @@ rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP( } static NR_CipheringAlgorithm_t rrc_gNB_select_ciphering(uint16_t algorithms) { + + return NR_CipheringAlgorithm_nea0; + + if (algorithms & NGAP_ENCRYPTION_NEA3_MASK) { return NR_CipheringAlgorithm_nea3; } @@ -638,10 +654,13 @@ static NR_CipheringAlgorithm_t rrc_gNB_select_ciphering(uint16_t algorithms) { return NR_CipheringAlgorithm_nea1; } - return NR_CipheringAlgorithm_nea0; } static e_NR_IntegrityProtAlgorithm rrc_gNB_select_integrity(uint16_t algorithms) { + + //only NIA2 supported for now + return NR_IntegrityProtAlgorithm_nia2; + if (algorithms & NGAP_INTEGRITY_NIA3_MASK) { return NR_IntegrityProtAlgorithm_nia3; } @@ -669,7 +688,7 @@ rrc_gNB_process_security( /* Save security parameters */ ue_context_pP->ue_context.security_capabilities = *security_capabilities_pP; // translation - LOG_D(NR_RRC, + LOG_I(NR_RRC, "[gNB %d] NAS security_capabilities.encryption_algorithms %u AS ciphering_algorithm %lu NAS security_capabilities.integrity_algorithms %u AS integrity_algorithm %u\n", ctxt_pP->module_id, ue_context_pP->ue_context.security_capabilities.nRencryption_algorithms, @@ -718,6 +737,8 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( struct rrc_gNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; memset(&ctxt, 0, sizeof(protocol_ctxt_t)); + MessageDef *message_p; + ue_initial_id = NGAP_DOWNLINK_NAS (msg_p).ue_initial_id; gNB_ue_ngap_id = NGAP_DOWNLINK_NAS (msg_p).gNB_ue_ngap_id; ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, ue_initial_id, gNB_ue_ngap_id); @@ -784,8 +805,28 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( /* * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. */ + switch (RC.nrrrc[ctxt.module_id]->node_type) { + case ngran_gNB_CU: + /* Transfer data to PDCP */ + nr_rrc_data_req ( + &ctxt, + ue_context_p->ue_context.Srb2.Active == 1 ? ue_context_p->ue_context.Srb2.Srb_info.Srb_id : ue_context_p->ue_context.Srb1.Srb_info.Srb_id, + (*rrc_gNB_mui)++, + SDU_CONFIRM_NO, + length, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + break; + + case ngran_gNB_DU: + // nothing to do for DU + AssertFatal(1==0,"nothing to do for DU\n"); + break; + + case ngran_gNB: + { + // rrc_mac_config_req_gNB #ifdef ITTI_SIM - MessageDef *message_p; uint8_t *message_buffer; message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, length); memcpy (message_buffer, buffer, length); @@ -796,16 +837,22 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( itti_send_msg_to_task (TASK_RRC_UE_SIM, instance, message_p); LOG_I(NR_RRC, "Send DL NAS message \n"); #else - /* Transfer data to PDCP */ - nr_rrc_data_req ( - &ctxt, - ue_context_p->ue_context.Srb2.Srb_info.Srb_id, - (*rrc_gNB_mui)++, - SDU_CONFIRM_NO, - length, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + /* Transfer data to PDCP */ + nr_rrc_data_req ( + &ctxt, + ue_context_p->ue_context.Srb2.Active == 1 ? ue_context_p->ue_context.Srb2.Srb_info.Srb_id : ue_context_p->ue_context.Srb1.Srb_info.Srb_id, + (*rrc_gNB_mui)++, + SDU_CONFIRM_NO, + length, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); #endif + } + break; + + default : + LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt.module_id]->node_type); + } return (0); } } @@ -1015,8 +1062,9 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ( ue_context_p->ue_context.setup_pdu_sessions += nb_pdusessions_tosetup; // TEST - ue_context_p->ue_context.pdusession[0].status = PDU_SESSION_STATUS_DONE; - rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(&ctxt, ue_context_p, 0); + // ue_context_p->ue_context.pdusession[0].status = PDU_SESSION_STATUS_DONE; + // rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(&ctxt, ue_context_p, 0); + rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p); return(0); } } diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 4e09f46c36a352924f61ea9d1afadd552b2d5c44..de2f2ca624a9743913e1f0719c7d8c811119a212 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -39,6 +39,7 @@ #include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h" #include "executables/softmodem-common.h" #include <openair2/RRC/NR/rrc_gNB_UE_context.h> +#include <openair3/ocp-gtpu/gtp_itf.h> #include "UTIL/OSA/osa_defs.h" extern boolean_t nr_rrc_pdcp_config_asn1_req( @@ -62,7 +63,8 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con const NR_DRB_ToAddModList_t * const drb2add_listP, const NR_DRB_ToReleaseList_t * const drb2release_listP, const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, - struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_srb_bearer2add_list, + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_drb_bearer2add_list); void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_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; @@ -238,11 +240,21 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ cipher_algo, NR_SecurityConfig__keyToUse_secondary); } - fill_default_reconfig(carrier->servingcellconfigcommon, + if (ue_context_p->ue_context.spCellConfig) { + fill_default_reconfig(carrier->servingcellconfigcommon, + ue_context_p->ue_context.spCellConfig->spCellConfigDedicated, reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, carrier->pdsch_AntennaPorts, carrier->initial_csi_index[rrc->Nb_ue]); + } else { + fill_default_reconfig(carrier->servingcellconfigcommon, + NULL, + 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)); @@ -333,15 +345,25 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ rrc->Nb_ue++; // configure MAC and RLC - rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_TargetSNRx10, - rrc->carrier.pucch_TargetSNRx10, - NULL, - 1, // add_ue flag - ue_context_p->ue_id_rnti, - ue_context_p->ue_context.secondaryCellGroup); + if (NODE_IS_DU(rrc->node_type)) { + rrc_mac_config_req_gNB(rrc->module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + rrc->carrier.servingcellconfigcommon, + 1, // add_ue flag + ue_context_p->ue_id_rnti, + ue_context_p->ue_context.secondaryCellGroup); + } else { + rrc_mac_config_req_gNB(rrc->module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + NULL, + 1, // add_ue flag + ue_context_p->ue_id_rnti, + ue_context_p->ue_context.secondaryCellGroup); + } if(m == NULL){ LOG_W(RRC, "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %x, frame %d, subframe %d eNB_index %d \n", &ctxt, @@ -371,6 +393,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ue_context_p->ue_context.rb_config->drb_ToAddModList, ue_context_p->ue_context.rb_config->drb_ToReleaseList, (LTE_PMCH_InfoList_r9_t *) NULL, + NULL, ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); @@ -414,7 +437,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { ue_context->ue_context.gnb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, rrc->module_id, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, rrc->module_id, msg_delete_tunnels_p); /* remove context */ rrc_gNB_remove_ue_context(&ctxt, rrc, ue_context); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 2798cf000831bed8116244cc0560b7eb7fb9229a..c193af5b310ff4363828b9d6bc0354c4e49fad48 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -31,6 +31,7 @@ #define RRC_GNB_NSA_C #include "NR_ServingCellConfigCommon.h" +#include "NR_ServingCellConfig.h" #include "NR_RRCReconfiguration.h" #include "NR_RRCReconfiguration-IEs.h" #include "NR_CellGroupConfig.h" @@ -53,9 +54,7 @@ void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfi bwp->bwp_Id = 0; bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); - memcpy((void*)&bwp->bwp_Common, - &servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP, - sizeof(bwp->bwp_Common)); + *bwp->bwp_Common = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP; bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); @@ -143,6 +142,7 @@ void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) { } void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_ServingCellConfig_t *servingcellconfigdedicated, NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, int servCellIndex, @@ -171,7 +171,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t)); secondaryCellGroup->cellGroupId = scg_id; NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); - nr_rlc_bearer_init(RLC_BearerConfig); + nr_rlc_bearer_init(RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); else @@ -222,60 +222,42 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco *secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex; secondaryCellGroup->spCellConfig->reconfigurationWithSync=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->reconfigurationWithSync)); secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon=servingcellconfigcommon; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=0x1234;//(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff); 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; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); - 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)); - 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->resources.present = NR_CFRA__resources_PR_ssb; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; - struct NR_CFRA_SSB_Resource *ssbElem[8]; - ssbElem[0] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[0]->ssb = 0; - ssbElem[0]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[0]); -#if 0 - ssbElem[1] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[1]->ssb = 1; - ssbElem[1]->ra_PreambleIndex = 62; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[1]); - ssbElem[2] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[2]->ssb = 2; - ssbElem[2]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[2]); - ssbElem[3] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[3]->ssb = 3; - ssbElem[3]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[3]); - ssbElem[4] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[4]->ssb = 4; - ssbElem[4]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[4]); - ssbElem[5] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[5]->ssb = 5; - ssbElem[5]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[5]); - ssbElem[6] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[6]->ssb = 6; - ssbElem[6]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[6]); - ssbElem[7] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[7]->ssb = 7; - ssbElem[7]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[7]); -#endif - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; + + // For 2-step contention-free random access procedure + if(get_softmodem_params()->sa == 0) { + 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; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); + 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)); + 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->resources.present = NR_CFRA__resources_PR_ssb; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; + + int n_ssb = 0; + struct NR_CFRA_SSB_Resource *ssbElem[64]; + for (int i=0;i<64;i++) { + if ((bitmap>>(63-i))&0x01){ + ssbElem[n_ssb] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[n_ssb]->ssb = i; + ssbElem[n_ssb]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[n_ssb]); + n_ssb++; + } + } + + 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)); @@ -285,7 +267,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco 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 = NR_RLF_TimersAndConstants__ext1__t311_ms30000; secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); + if (servingcellconfigdedicated) { + secondaryCellGroup->spCellConfig->spCellConfigDedicated = servingcellconfigdedicated; + } else { + 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; @@ -460,9 +446,15 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco #endif secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); + + NR_BWP_Downlink_t *bwp = NULL; + if (servingcellconfigdedicated) { + bwp=servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[0]; + } else { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); - NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp)); + bwp=calloc(1,sizeof(*bwp)); + } bwp->bwp_Id=1; bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); // copy common BWP size from initial BWP except for bandwdith @@ -548,7 +540,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); - + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0; @@ -577,8 +569,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi); } - bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); - + if (!servingcellconfigdedicated) { + bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); + } bwp->bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config)); bwp->bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup; bwp->bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup)); @@ -626,113 +619,30 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL; - bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + if (!servingcellconfigdedicated) { + bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); - 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 = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + } + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;//calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)); bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; - + if (!servingcellconfigdedicated) { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; + } bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; - //bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); - -#if 0 bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); - NR_TCI_State_t*tcid0=calloc(1,sizeof(*tcid0)); - tcid0->tci_StateId=0; - tcid0->qcl_Type1.cell=NULL; - tcid0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid0->qcl_Type1.bwp_Id)); - *tcid0->qcl_Type1.bwp_Id=1; - tcid0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid0->qcl_Type1.referenceSignal.choice.csi_rs = 2; - tcid0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid0); - - NR_TCI_State_t*tcid1=calloc(1,sizeof(*tcid1)); - tcid1->tci_StateId=0; - tcid1->qcl_Type1.cell=NULL; - tcid1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid1->qcl_Type1.bwp_Id)); - *tcid1->qcl_Type1.bwp_Id=1; - tcid1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid1->qcl_Type1.referenceSignal.choice.csi_rs = 6; - tcid1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid1); - - NR_TCI_State_t*tcid2=calloc(1,sizeof(*tcid2)); - tcid2->tci_StateId=2; - tcid2->qcl_Type1.cell=NULL; - tcid2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid2->qcl_Type1.bwp_Id)); - *tcid2->qcl_Type1.bwp_Id=1; - tcid2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid2->qcl_Type1.referenceSignal.choice.csi_rs = 10; - tcid2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid2); - - NR_TCI_State_t*tcid3=calloc(1,sizeof(*tcid3)); - tcid3->tci_StateId=3; - tcid3->qcl_Type1.cell=NULL; - tcid3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid3->qcl_Type1.bwp_Id)); - *tcid3->qcl_Type1.bwp_Id=1; - tcid3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid3->qcl_Type1.referenceSignal.choice.csi_rs = 14; - tcid3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid3); - - NR_TCI_State_t*tcid4=calloc(1,sizeof(*tcid4)); - tcid4->tci_StateId=4; - tcid4->qcl_Type1.cell=NULL; - tcid4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid4->qcl_Type1.bwp_Id)); - *tcid4->qcl_Type1.bwp_Id=1; - tcid4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid4->qcl_Type1.referenceSignal.choice.csi_rs = 18; - tcid4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid4); - - NR_TCI_State_t*tcid5=calloc(1,sizeof(*tcid5)); - tcid5->tci_StateId=5; - tcid5->qcl_Type1.cell=NULL; - tcid5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid5->qcl_Type1.bwp_Id)); - *tcid5->qcl_Type1.bwp_Id=1; - tcid5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid5->qcl_Type1.referenceSignal.choice.csi_rs = 22; - tcid5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid5); - - NR_TCI_State_t*tcid6=calloc(1,sizeof(*tcid6)); - tcid6->tci_StateId=6; - tcid6->qcl_Type1.cell=NULL; - tcid6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid6->qcl_Type1.bwp_Id)); - *tcid6->qcl_Type1.bwp_Id=1; - tcid6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid6->qcl_Type1.referenceSignal.choice.csi_rs = 26; - tcid6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid6); - - NR_TCI_State_t*tcid7=calloc(1,sizeof(*tcid7)); - tcid7->tci_StateId=7; - tcid7->qcl_Type1.cell=NULL; - tcid7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid7->qcl_Type1.bwp_Id)); - *tcid7->qcl_Type1.bwp_Id=1; - tcid7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid7->qcl_Type1.referenceSignal.choice.csi_rs = 30; - tcid7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid7); -#endif - - n_ssb = 0; NR_TCI_State_t *tcid[64]; for (int i=0;i<64;i++) { @@ -828,8 +738,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2; #endif - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp); - + if (!servingcellconfigdedicated) { + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp); + } secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=1; @@ -837,26 +748,38 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = 1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig)); + + if (!servingcellconfigdedicated) { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig)); + } NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP; initialUplinkBWP->pucch_Config = NULL; initialUplinkBWP->pusch_Config = calloc(1,sizeof(*initialUplinkBWP->pusch_Config)); initialUplinkBWP->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - NR_PUSCH_Config_t *pusch_Config = calloc(1,sizeof(*pusch_Config)); + NR_PUSCH_Config_t *pusch_Config = NULL; + if (servingcellconfigdedicated) { + pusch_Config = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup; + } else { + pusch_Config = calloc(1,sizeof(*pusch_Config)); + } initialUplinkBWP->pusch_Config->choice.setup = pusch_Config; pusch_Config->txConfig=calloc(1,sizeof(*pusch_Config->txConfig)); *pusch_Config->txConfig= NR_PUSCH_Config__txConfig_codebook; pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); + if (!servingcellconfigdedicated) { + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); + } NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; NR_DMRS_UplinkConfig->dmrs_Type = NULL; NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = calloc(1,sizeof(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)); *NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0; - NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; + if (!servingcellconfigdedicated) { + NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; + } NR_DMRS_UplinkConfig->maxLength=NULL; NR_DMRS_UplinkConfig->transformPrecodingDisabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingDisabled)); NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0 = NULL; @@ -903,7 +826,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pusch_Config->tp_pi2BPSK=NULL; /*------------------------------TRANSFORM PRECODING- -----------------------------------------------------------------------*/ - + uint8_t transform_precoding = NR_PUSCH_Config__transformPrecoder_disabled; // TBD: configure this from .conf file, Dedicated params cannot yet be configured in .conf file. @@ -918,20 +841,20 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder != NULL) transform_precoding = NR_PUSCH_Config__transformPrecoder_enabled; } - else + else transform_precoding = *pusch_Config->transformPrecoder; - - + + if (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled ) { /* Enable DMRS uplink config for transform precoding enabled */ NR_DMRS_UplinkConfig->transformPrecodingEnabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingEnabled)); NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity = NULL; - NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping = NULL; NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping = NULL; - NR_DMRS_UplinkConfig->transformPrecodingEnabled->ext1 = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->ext1 = NULL; LOG_I(RRC,"TRANSFORM PRECODING ENABLED......\n"); - + } /*----------------------------------------------------------------------------------------------------------------------------*/ @@ -992,8 +915,13 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0); secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)); - NR_BWP_Uplink_t *ubwp = calloc(1,sizeof(*ubwp)); + NR_BWP_Uplink_t *ubwp = NULL; + if (servingcellconfigdedicated) { + ubwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; + } else { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)); + ubwp = calloc(1,sizeof(*ubwp)); + } ubwp->bwp_Id=1; ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common)); // copy bwp_Common from Initial UL BWP except for bandwidth @@ -1006,7 +934,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ubwp->bwp_Common->pusch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; ubwp->bwp_Common->pucch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; - ubwp->bwp_Dedicated = calloc(1,sizeof(*ubwp->bwp_Dedicated)); + if (!servingcellconfigdedicated) { + ubwp->bwp_Dedicated = calloc(1,sizeof(*ubwp->bwp_Dedicated)); + } ubwp->bwp_Dedicated->pucch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pucch_Config)); ubwp->bwp_Dedicated->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup; NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config)); @@ -1136,11 +1066,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->p0_Set->list,p00); pucch_Config->pucch_PowerControl->pathlossReferenceRSs = NULL; - // copy pusch_Config from dedicated initialBWP - ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); - ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; - + if (!servingcellconfigdedicated) { + // copy pusch_Config from dedicated initialBWP + ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); + ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; + ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; + } ubwp->bwp_Dedicated->configuredGrantConfig = NULL; ubwp->bwp_Dedicated->srs_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->srs_Config)); ubwp->bwp_Dedicated->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; @@ -1148,7 +1079,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); + if (!servingcellconfigdedicated) { + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); + } secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = 1; @@ -1300,7 +1233,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->servingCellMO=NULL; } + void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_ServingCellConfig_t *servingcellconfigdedicated, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, int n_physical_antenna_ports, @@ -1311,7 +1246,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon // radioBearerConfig reconfig->radioBearerConfig=NULL; // secondaryCellGroup - fill_default_secondaryCellGroup(servingcellconfigcommon,secondaryCellGroup,1,1,n_physical_antenna_ports,initial_csi_index); + fill_default_secondaryCellGroup(servingcellconfigcommon,servingcellconfigdedicated,secondaryCellGroup,1,1,n_physical_antenna_ports,initial_csi_index); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); char scg_buffer[1024]; @@ -1347,7 +1282,7 @@ void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, drb_ToAddMod->pdcp_Config = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config)); drb_ToAddMod->pdcp_Config->drb = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb)); drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer)); - *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_ms30; + *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_infinity; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL)); *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL)); diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index e21859ded88949799a20436b2e64eab801e0fc46..1be3fb6225d0b007dae73468c40da07bed7bc051 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -42,17 +42,71 @@ nr_mac_rrc_data_ind_ue( const module_id_t module_id, const int CC_id, const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len){ + sdu_size_t sdu_size = 0; switch(channel){ case NR_BCCH_BCH: AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n"); break; + case NR_BCCH_DL_SCH: - AssertFatal( nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len, 0, 0) == 0, "UE decode BCCH-DL-SCH error!\n"); + if (pdu_len>0) { + LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET, + gNB_index); + + MessageDef *message_p; + int msg_sdu_size = BCCH_SDU_SIZE; + + if (pdu_len > msg_sdu_size) { + LOG_E(NR_RRC, "SDU larger than NR-BCCH-DL-SCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = pdu_len; + } + + message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_BCCH_DATA_IND); + memset(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, pduP, sdu_size); + NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; + NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index; + itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); + } + break; + + case CCCH: + if (pdu_len>0) { + LOG_I(NR_RRC,"[UE %d] Received SDU for CCCH on SRB %u from gNB %d\n",module_id,channel & RAB_OFFSET,gNB_index); + + MessageDef *message_p; + int msg_sdu_size = CCCH_SDU_SIZE; + + if (pdu_len > msg_sdu_size) { + LOG_E(NR_RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = pdu_len; + } + + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, NR_RRC_MAC_CCCH_DATA_IND); + memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, pduP, sdu_size); + NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; //frameP + NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP + NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; + NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = gNB_index; + NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP + itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p); + } break; + default: break; } @@ -75,12 +129,13 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, //NR_UE_rrc_inst[Mod_idP].Info[gNB_id].T300_active = 1; //NR_UE_rrc_inst[Mod_idP].Info[gNB_id].T300_cnt = 0; - LOG_D(NR_RRC, "nr_mac_rrc_data_req_ue: Payload size = %i\n", NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size); + LOG_I(NR_RRC, "nr_mac_rrc_data_req_ue: Payload size = %i\n", NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size); memcpy(buffer_pP, (uint8_t*)NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.Payload, NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size); for(int i = 0; i<NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size; i++) { - LOG_D(NR_RRC,"(%i): %i\n", i, buffer_pP[i]); + //LOG_I(NR_RRC,"(%i): %i\n", i, buffer_pP[i]); + printf("%02x ",buffer_pP[i]); } - + printf("\n"); return NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size; case DCCH: @@ -109,11 +164,12 @@ rrc_data_req_ue( // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). uint8_t *message_buffer; message_buffer = itti_malloc ( - ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, - ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, + TASK_RRC_UE, + TASK_PDCP_UE, sdu_sizeP); + LOG_I(RRC,"Sending RRC message for SRB %ld, sdu_size %d\n",rb_idP,sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); + message_p = itti_alloc_new_message ( TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index f373d7423007fa9e159f615e4ac9de8e312159e2..6c693e08c2b8673a43e1e1780ec3380fe450677e 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -67,11 +67,13 @@ #include "RRC/NAS/nas_config.h" #include "RRC/NAS/rb_config.h" #include "SIMULATION/TOOLS/sim.h" // for taus +#include <executables/softmodem-common.h> -#if ITTI_SIM +#if defined(ITTI_SIM) || defined(RFSIM_NAS) #include "nr_nas_msg_sim.h" #endif +NR_UE_RRC_INST_t *NR_UE_rrc_inst; /* NAS Attach request with IMSI */ static const char nr_nas_attach_req_imsi[] = { 0x07, 0x41, @@ -127,7 +129,6 @@ nr_rrc_ue_generate_rrcReestablishmentComplete( ); mui_t nr_rrc_mui=0; -uint8_t first_rrcreconfigurationcomplete = 0; static Rrc_State_NR_t nr_rrc_get_state (module_id_t ue_mod_idP) { return NR_UE_rrc_inst[ue_mod_idP].nrRrcState; @@ -200,7 +201,6 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con const NR_DRB_ToReleaseList_t * const drb2release_listP, const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); - // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) int8_t nr_rrc_ue_decode_secondary_cellgroup_config( const module_id_t module_id, @@ -227,8 +227,8 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config( return -1; } - if(NR_UE_rrc_inst[module_id].cell_group_config == NULL){ - NR_UE_rrc_inst[module_id].cell_group_config = cell_group_config; + if(NR_UE_rrc_inst[module_id].scell_group_config == NULL){ + NR_UE_rrc_inst[module_id].scell_group_config = cell_group_config; nr_rrc_ue_process_scg_config(module_id,cell_group_config); }else{ nr_rrc_ue_process_scg_config(module_id,cell_group_config); @@ -481,7 +481,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){ RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations); } - if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1 || get_softmodem_params()->sa == 1) { + if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1) { // read in files for RRCReconfiguration and RBconfig FILE *fd; char filename[1024]; @@ -552,48 +552,40 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len ){ - int i; NR_BCCH_BCH_Message_t *bcch_message = NULL; - NR_MIB_t *mib = NR_UE_rrc_inst[module_id].mib; - - if(mib != NULL){ - SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)mib, 1 ); - } - + - //for(i=0; i<buffer_len; ++i){ - // printf("[RRC] MIB PDU : %d\n", bufferP[i]); - //} + if (NR_UE_rrc_inst[module_id].mib != NULL) + SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 ); + else LOG_I(NR_RRC,"Configuring MAC for first MIB reception\n"); - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_NR_BCCH_BCH_Message, + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_NR_BCCH_BCH_Message, (void **)&bcch_message, (const void *)bufferP, buffer_len ); - + if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { - printf("NR_BCCH_BCH decode error\n"); - for (i=0; i<buffer_len; i++){ - printf("%02x ",bufferP[i]); - } - printf("\n"); - // free the memory - SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 ); - return -1; + LOG_I(NR_RRC,"NR_BCCH_BCH decode error\n"); + // free the memory + SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 ); + return -1; } else { - // link to rrc instance - mib = bcch_message->message.choice.mib; - //memcpy( (void *)mib, - // (void *)&bcch_message->message.choice.mib, - // sizeof(NR_MIB_t) ); - - nr_rrc_mac_config_req_ue( 0, 0, 0, mib, NULL); - } - + // link to rrc instance + SEQUENCE_free( &asn_DEF_NR_MIB, (void *)NR_UE_rrc_inst[module_id].mib, 1 ); + NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib; + //memcpy( (void *)mib, + // (void *)&bcch_message->message.choice.mib, + // sizeof(NR_MIB_t) ); + + nr_rrc_mac_config_req_ue( 0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL); + } + return 0; } + const char siWindowLength[10][5] = {"5s", "10s", "20s", "40s", "80s", "160s", "320s", "640s", "1280s","ERR"};// {"1ms","2ms","5ms","10ms","15ms","20ms","40ms","80ms","ERR"}; const short siWindowLength_int[9] = {5,10,20,40,80,160,320,640,1280};//{1,2,5,10,15,20,40,80}; @@ -1147,7 +1139,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message( NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index]; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN ); - if (((NR_UE_rrc_inst[module_id].Info[gNB_index].SIStatus&1) == 1) && // SIB1 received + if (((NR_UE_rrc_inst[module_id].Info[gNB_index].SIStatus&1) == 1) && sib1->si_SchedulingInfo &&// SIB1 received (NR_UE_rrc_inst[module_id].Info[gNB_index].SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count)) { // to prevent memory bloating VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); @@ -1185,7 +1177,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message( if(sib1 != NULL){ SEQUENCE_free(&asn_DEF_NR_SIB1, (void *)sib1, 1 ); } - + NR_UE_rrc_inst[module_id].Info[gNB_index].SIStatus|=1; sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; if (*(int64_t*)sib1 != 1) { NR_UE_rrc_inst[module_id].sib1[gNB_index] = sib1; @@ -1194,15 +1186,21 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message( } LOG_I(NR_RRC, "SIB1 decoded\n"); + /// dump_SIB1(); // FIXME: improve condition for the RA trigger // Check for on-demand not broadcasted SI check_requested_SI_List(module_id, NR_UE_rrc_inst[module_id].requested_SI_List, *sib1); - if( nr_rrc_get_state(module_id) == RRC_STATE_IDLE_NR ) { + if( nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR ) { NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE; // TODO: remove flag after full RA procedures implemented - get_softmodem_params()->do_ra = 1; + // get_softmodem_params()->do_ra = 1; + LOG_I(PHY,"Setting state to NR_RRC_SI_RECEIVED\n"); + nr_rrc_set_state (module_id, NR_RRC_SI_RECEIVED); } - nr_rrc_ue_generate_ra_msg(module_id,gNB_index); + // take ServingCellConfigCommon and configure L1/L2 + NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; + nr_rrc_mac_config_req_ue(module_id,0,0,NULL,sib1->servingCellConfigCommon,NULL,NULL); + nr_rrc_ue_generate_ra_msg(module_id,gNB_index); } else { LOG_E(NR_RRC, "SIB1 not decoded\n"); } @@ -1255,11 +1253,19 @@ nr_rrc_ue_process_masterCellGroup( ) //----------------------------------------------------------------------------- { - NR_CellGroupConfig_t *cellGroupConfig = (NR_CellGroupConfig_t *)masterCellGroup; + NR_CellGroupConfig_t *cellGroupConfig=NULL; + uper_decode(NULL, + &asn_DEF_NR_CellGroupConfig, //might be added prefix later + (void **)&cellGroupConfig, + (uint8_t *)masterCellGroup->buf, + masterCellGroup->size, 0, 0); + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); if( cellGroupConfig->spCellConfig != NULL && cellGroupConfig->spCellConfig->reconfigurationWithSync != NULL){ //TODO (perform Reconfiguration with sync according to 5.3.5.5.2) //TODO (resume all suspended radio bearers and resume SCG transmission for all radio bearers, if suspended) + // NSA procedures } + if( cellGroupConfig->rlc_BearerToReleaseList != NULL){ //TODO (perform RLC bearer release as specified in 5.3.5.5.3) @@ -1278,12 +1284,18 @@ nr_rrc_ue_process_masterCellGroup( } if( cellGroupConfig->spCellConfig != NULL){ - if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig) { + if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config && + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig) { memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig,cellGroupConfig->spCellConfig, sizeof(struct NR_SpCellConfig)); } else { - NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig = cellGroupConfig->spCellConfig; + if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config) + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig = cellGroupConfig->spCellConfig; + else + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = cellGroupConfig; } + LOG_I(RRC,"Sending CellGroupConfig to MAC\n"); + nr_rrc_mac_config_req_ue(ctxt_pP->module_id,0,0,NULL,NULL,cellGroupConfig,NULL); //TODO (configure the SpCell as specified in 5.3.5.5.7) } @@ -1311,8 +1323,16 @@ static void rrc_ue_generate_RRCSetupComplete( uint8_t size; const char *nas_msg; int nas_msg_length; + NR_UE_MAC_INST_t *mac = get_mac_inst(0); + + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig) + AssertFatal(1==0,"2 > csi_MeasConfig is not null\n"); + if (AMF_MODE_ENABLED) { -#if ITTI_SIM +#if defined(ITTI_SIM) || defined(RFSIM_NAS) as_nas_info_t initialNasMsg; generateRegistrationRequest(&initialNasMsg); nas_msg = (char*)initialNasMsg.data; @@ -1328,9 +1348,12 @@ static void rrc_ue_generate_RRCSetupComplete( size = do_RRCSetupComplete(ctxt_pP->module_id,buffer,Transaction_id,sel_plmn_id,nas_msg_length,nas_msg); LOG_I(NR_RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d, gNB %d)\n", ctxt_pP->module_id,ctxt_pP->frame, size, gNB_index); - LOG_D(RLC, - "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", + LOG_D(NR_RRC, + "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", ctxt_pP->frame, ctxt_pP->module_id+NB_RN_INST, size, gNB_index, nr_rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH); + + for (int i=0;i<size;i++) printf("%02x ",buffer[i]); + printf("\n"); // ctxt_pP_local.rnti = ctxt_pP->rnti; rrc_data_req_ue( ctxt_pP, @@ -1354,1145 +1377,1071 @@ static void rrc_ue_generate_RRCSetupComplete( } int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB_INFO *const Srb_info, const uint8_t gNB_index ){ - NR_DL_CCCH_Message_t *dl_ccch_msg=NULL; - asn_dec_rval_t dec_rval; - int rval=0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN); - // LOG_D(RRC,"[UE %d] Decoding DL-CCCH message (%d bytes), State %d\n",ue_mod_idP,Srb_info->Rx_buffer.payload_size, - // NR_UE_rrc_inst[ue_mod_idP].Info[gNB_index].State); - dec_rval = uper_decode(NULL, - &asn_DEF_NR_DL_CCCH_Message, - (void **)&dl_ccch_msg, - (uint8_t *)Srb_info->Rx_buffer.Payload, - 100,0,0); - - // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg); - // } - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { - LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); - return -1; - } - - if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) { - if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State == NR_RRC_SI_RECEIVED) { - switch (dl_ccch_msg->message.choice.c1->present) { - case NR_DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(NR_RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = 0; - break; - - case NR_DL_CCCH_MessageType__c1_PR_rrcReject: - LOG_I(NR_RRC, - "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = 0; - break; - - case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: - LOG_I(NR_RRC, - "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti); - - // Get configuration - // Release T300 timer - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0; - - nr_rrc_ue_process_masterCellGroup( - ctxt_pP, - gNB_index, - &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup); - nr_sa_rrc_ue_process_radioBearerConfig( - ctxt_pP, - gNB_index, - &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); - nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); - nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti; - rrc_ue_generate_RRCSetupComplete( - ctxt_pP, - gNB_index, - dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, - NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity); - rval = 0; - break; - - default: - LOG_E(NR_RRC, "[UE%d] Frame %d : Unknown message\n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = -1; - break; - } - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); - return rval; -} -// from NR SRB3 -int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( - const module_id_t module_id, - const uint8_t gNB_index, - const uint8_t *bufferP, - const uint32_t buffer_len ){ - // uper_decode by nr R15 rrc_connection_reconfiguration - - int32_t i; - NR_DL_DCCH_Message_t *nr_dl_dcch_msg = NULL; - MessageDef *msg_p; - - asn_dec_rval_t dec_rval = uper_decode( NULL, - &asn_DEF_NR_DL_DCCH_Message, - (void**)&nr_dl_dcch_msg, - (uint8_t *)bufferP, - buffer_len, 0, 0); - - if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { - for (i=0; i<buffer_len; i++) - printf("%02x ",bufferP[i]); - printf("\n"); - // free the memory - SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 ); - return -1; - } - - if(nr_dl_dcch_msg != NULL){ - switch(nr_dl_dcch_msg->message.present){ - case NR_DL_DCCH_MessageType_PR_c1: - switch(nr_dl_dcch_msg->message.choice.c1->present){ - case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: - nr_rrc_ue_process_rrcReconfiguration(module_id,nr_dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration); - break; - - case NR_DL_DCCH_MessageType__c1_PR_NOTHING: - case NR_DL_DCCH_MessageType__c1_PR_rrcResume: - case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: - msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); - if((nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && - (nr_dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ - nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = - NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; - nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = - NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; - } - itti_send_msg_to_task(TASK_RRC_NRUE,module_id,msg_p); - break; - - case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: - case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: - case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - case NR_DL_DCCH_MessageType__c1_PR_counterCheck: - case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: - case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: - case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: - case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: - case NR_DL_DCCH_MessageType__c1_PR_spare3: - case NR_DL_DCCH_MessageType__c1_PR_spare2: - case NR_DL_DCCH_MessageType__c1_PR_spare1: - default: - // not supported or unused - break; - } - break; - case NR_DL_DCCH_MessageType_PR_NOTHING: - case NR_DL_DCCH_MessageType_PR_messageClassExtension: - default: - // not supported or unused - break; - } - - // release memory allocation - SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 ); - }else{ - // log.. - } - - return 0; -} - - -//----------------------------------------------------------------------------- -void -nr_rrc_ue_process_securityModeCommand( - const protocol_ctxt_t *const ctxt_pP, - NR_SecurityModeCommand_t *const securityModeCommand, - const uint8_t gNB_index -) -//----------------------------------------------------------------------------- -{ - asn_enc_rval_t enc_rval; - NR_UL_DCCH_Message_t ul_dcch_msg; - uint8_t buffer[200]; - int i, securityMode; - LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n", - ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index); - - switch (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) { - case NR_CipheringAlgorithm_nea0: - LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea0\n", - ctxt_pP->module_id); - securityMode= NR_CipheringAlgorithm_nea0; - break; - - case NR_CipheringAlgorithm_nea1: - LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea1\n",ctxt_pP->module_id); - securityMode= NR_CipheringAlgorithm_nea1; - break; - - case NR_CipheringAlgorithm_nea2: - LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea2\n", - ctxt_pP->module_id); - securityMode = NR_CipheringAlgorithm_nea2; - break; - - default: - LOG_I(NR_RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id); - securityMode = NR_CipheringAlgorithm_spare1; - break; - } + NR_DL_CCCH_Message_t *dl_ccch_msg=NULL; + asn_dec_rval_t dec_rval; + int rval=0; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN); + LOG_I(RRC,"[NR UE%d] Decoding DL-CCCH message (%d bytes), State %d\n",ctxt_pP->module_id,Srb_info->Rx_buffer.payload_size, + NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State); + dec_rval = uper_decode(NULL, + &asn_DEF_NR_DL_CCCH_Message, + (void **)&dl_ccch_msg, + (uint8_t *)Srb_info->Rx_buffer.Payload, + 100,0,0); + + //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg); + //} + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { + LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); + return -1; + } - switch (*securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) { - case NR_IntegrityProtAlgorithm_nia1: - LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia1\n",ctxt_pP->module_id); - securityMode |= 1 << 5; - break; + if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) { + if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus > 0) { + switch (dl_ccch_msg->message.choice.c1->present) { + case NR_DL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(NR_RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = 0; + break; + + case NR_DL_CCCH_MessageType__c1_PR_rrcReject: + LOG_I(NR_RRC, + "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCReject \n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = 0; + break; + + case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: + LOG_I(NR_RRC, + "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti); + + // Get configuration + // Release T300 timer + NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0; + + nr_rrc_ue_process_masterCellGroup( + ctxt_pP, + gNB_index, + &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup); + nr_sa_rrc_ue_process_radioBearerConfig( + ctxt_pP, + gNB_index, + &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); + nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); + nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); + NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti; + rrc_ue_generate_RRCSetupComplete( + ctxt_pP, + gNB_index, + dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, + NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity); + rval = 0; + break; + + default: + LOG_E(NR_RRC, "[UE%d] Frame %d : Unknown message\n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = -1; + break; + } + } + } - case NR_IntegrityProtAlgorithm_nia2: - LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia2\n",ctxt_pP->module_id); - securityMode |= 1 << 6; - break; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); + return rval; + } - default: - LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id); - securityMode |= 0x70 ; - break; - } + // from NR SRB3 + int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( + const module_id_t module_id, + const uint8_t gNB_index, + const uint8_t *bufferP, + const uint32_t buffer_len ){ + // uper_decode by nr R15 rrc_connection_reconfiguration + + int32_t i; + NR_DL_DCCH_Message_t *nr_dl_dcch_msg = NULL; + MessageDef *msg_p; + + asn_dec_rval_t dec_rval = uper_decode( NULL, + &asn_DEF_NR_DL_DCCH_Message, + (void**)&nr_dl_dcch_msg, + (uint8_t *)bufferP, + buffer_len, 0, 0); + + if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { + for (i=0; i<buffer_len; i++) + printf("%02x ",bufferP[i]); + printf("\n"); + // free the memory + SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 ); + return -1; + } - LOG_D(NR_RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode); - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm = - securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm; - NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm = - *securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm; - memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t)); - //memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t)); - ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1; - ul_dcch_msg.message.choice.c1 = calloc(1, sizeof(*ul_dcch_msg.message.choice.c1)); + if(nr_dl_dcch_msg != NULL){ + switch(nr_dl_dcch_msg->message.present){ + case NR_DL_DCCH_MessageType_PR_c1: + switch(nr_dl_dcch_msg->message.choice.c1->present){ + case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: + nr_rrc_ue_process_rrcReconfiguration(module_id,nr_dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration); + break; + + case NR_DL_DCCH_MessageType__c1_PR_NOTHING: + case NR_DL_DCCH_MessageType__c1_PR_rrcResume: + case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: + msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); + if((nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && + (nr_dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ + nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = + NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; + nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = + NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; + } + itti_send_msg_to_task(TASK_RRC_NRUE,module_id,msg_p); + break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: + case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + case NR_DL_DCCH_MessageType__c1_PR_counterCheck: + case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: + case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: + case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: + case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: + case NR_DL_DCCH_MessageType__c1_PR_spare3: + case NR_DL_DCCH_MessageType__c1_PR_spare2: + case NR_DL_DCCH_MessageType__c1_PR_spare1: + default: + // not supported or unused + break; + } + break; + case NR_DL_DCCH_MessageType_PR_NOTHING: + case NR_DL_DCCH_MessageType_PR_messageClassExtension: + default: + // not supported or unused + break; + } + + // release memory allocation + SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 ); + }else{ + // log.. + } - if (securityMode >= NO_SECURITY_MODE) { - LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n"); - ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete; - } else { - LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n"); - ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeFailure; - } + return 0; + } - uint8_t *kRRCenc = NULL; - uint8_t *kUPenc = NULL; - uint8_t *kRRCint = NULL; - pdcp_t *pdcp_p = NULL; - hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; - hashtable_rc_t h_rc; - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, - ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); - h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p); - - if (h_rc == HASH_TABLE_OK) { - LOG_D(NR_RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key); - LOG_D(NR_RRC, "driving kRRCenc, kRRCint and kUPenc from KgNB=" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x\n", - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[0], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[1], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[2], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[3], - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[4], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[5], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[6], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[7], - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[8], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[9], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[10], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[11], - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[12], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[13], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[14], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[15], - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[16], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[17], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[18], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[19], - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[20], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[21], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[22], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[23], - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[24], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[25], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[26], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[27], - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[28], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[29], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[30], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[31]); - derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc); - derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint); - derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc); - - if (securityMode != 0xff) { - pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0, - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm - | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), - kRRCenc, kRRCint, kUPenc); - } else { - LOG_I(NR_RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x", - securityMode); - } - } else { - LOG_I(NR_RRC, "Could not get PDCP instance where key=0x%ld\n", key); - } - if (securityModeCommand->criticalExtensions.present == NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand) { - ul_dcch_msg.message.choice.c1->choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_t)); - ul_dcch_msg.message.choice.c1->choice.securityModeComplete->rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; - ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.present = NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete; - ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_IEs_t)); - ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete->nonCriticalExtension =NULL; - LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (gNB %d), rrc_TransactionIdentifier: %ld\n", - ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index, securityModeCommand->rrc_TransactionIdentifier); - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message, - NULL, - (void *)&ul_dcch_msg, - buffer, - 100); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg); + //----------------------------------------------------------------------------- + void + nr_rrc_ue_process_securityModeCommand( + const protocol_ctxt_t *const ctxt_pP, + NR_SecurityModeCommand_t *const securityModeCommand, + const uint8_t gNB_index + ) + //----------------------------------------------------------------------------- + { + asn_enc_rval_t enc_rval; + NR_UL_DCCH_Message_t ul_dcch_msg; + uint8_t buffer[200]; + int i, securityMode; + LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n", + ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index); + + switch (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) { + case NR_CipheringAlgorithm_nea0: + LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea0\n", + ctxt_pP->module_id); + securityMode= NR_CipheringAlgorithm_nea0; + break; + + case NR_CipheringAlgorithm_nea1: + LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea1\n",ctxt_pP->module_id); + securityMode= NR_CipheringAlgorithm_nea1; + break; + + case NR_CipheringAlgorithm_nea2: + LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea2\n", + ctxt_pP->module_id); + securityMode = NR_CipheringAlgorithm_nea2; + break; + + default: + LOG_I(NR_RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id); + securityMode = NR_CipheringAlgorithm_spare1; + break; } + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm = + securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm; + + if (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm != NULL) + { + switch (*securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) { + case NR_IntegrityProtAlgorithm_nia1: + LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia1\n",ctxt_pP->module_id); + securityMode |= 1 << 5; + break; + + case NR_IntegrityProtAlgorithm_nia2: + LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia2\n",ctxt_pP->module_id); + securityMode |= 1 << 6; + break; + + default: + LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id); + securityMode |= 0x70 ; + break; + } + + NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm = + *securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm; - LOG_D(NR_RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); - - for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { - LOG_T(NR_RRC, "%02x.", buffer[i]); - } - - LOG_T(NR_RRC, "\n"); -#ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM, - (enc_rval.encoded + 7) / 8); - memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8); + } - message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND); - GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; - GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8; - itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); -#else - rrc_data_req ( - ctxt_pP, - DCCH, - nr_rrc_mui++, - SDU_CONFIRM_NO, - (enc_rval.encoded + 7) / 8, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); -#endif - } else - LOG_W(NR_RRC,"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand\n", - securityModeCommand->criticalExtensions.present); -} + LOG_D(NR_RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode); + memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t)); + //memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t)); + ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1 = calloc(1, sizeof(*ul_dcch_msg.message.choice.c1)); + + if (securityMode >= NO_SECURITY_MODE) { + LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n"); + ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete; + } else { + LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n"); + ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeFailure; + ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete; + } -//----------------------------------------------------------------------------- -void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { - uint8_t i=0,rv[6]; - - if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) { - // Get RRCConnectionRequest, fill random for now - // Generate random byte stream for contention resolution - for (i=0; i<6; i++) { -#ifdef SMBV - // if SMBV is configured the contention resolution needs to be fix for the connection procedure to succeed - rv[i]=i; -#else - rv[i]=taus()&0xff; -#endif - LOG_T(NR_RRC,"%x.",rv[i]); - } + uint8_t *kRRCenc = NULL; + uint8_t *kUPenc = NULL; + uint8_t *kRRCint = NULL; + pdcp_t *pdcp_p = NULL; + hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; + hashtable_rc_t h_rc; + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, + ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); + h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p); + + if (h_rc == HASH_TABLE_OK) { + LOG_D(NR_RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key); + LOG_D(NR_RRC, "driving kRRCenc, kRRCint and kUPenc from KgNB=" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x\n", + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[0], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[1], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[2], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[3], + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[4], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[5], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[6], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[7], + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[8], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[9], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[10], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[11], + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[12], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[13], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[14], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[15], + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[16], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[17], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[18], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[19], + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[20], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[21], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[22], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[23], + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[24], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[25], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[26], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[27], + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[28], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[29], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[30], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[31]); + derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc); + derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint); + derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc); + + if (securityMode != 0xff) { + pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm + | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + kRRCenc, kRRCint, kUPenc); + } else { + LOG_I(NR_RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x", + securityMode); + } + } else { + LOG_I(NR_RRC, "Could not get PDCP instance where key=0x%ld\n", key); + } - LOG_T(NR_RRC,"\n"); - NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size = - do_RRCSetupRequest( - module_id, - (uint8_t *)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload, - rv); - LOG_I(NR_RRC,"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)\n", - module_id, NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index); - - for (i=0; i<NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) { - LOG_T(NR_RRC,"%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]); + if (securityModeCommand->criticalExtensions.present == NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand) { + ul_dcch_msg.message.choice.c1->choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_t)); + ul_dcch_msg.message.choice.c1->choice.securityModeComplete->rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; + ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.present = NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete; + ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_IEs_t)); + ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete->nonCriticalExtension =NULL; + LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (gNB %d), rrc_TransactionIdentifier: %ld\n", + ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index, securityModeCommand->rrc_TransactionIdentifier); + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message, + NULL, + (void *)&ul_dcch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg); } + log_dump(MAC, buffer, 16, LOG_DUMP_CHAR, "securityModeComplete payload: "); + LOG_D(NR_RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); + + for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { + LOG_T(NR_RRC, "%02x.", buffer[i]); + } + + LOG_T(NR_RRC, "\n"); + #ifdef ITTI_SIM + MessageDef *message_p; + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM, + (enc_rval.encoded + 7) / 8); + memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8); + + message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND); + GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; + GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8; + itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); + #else + rrc_data_req_ue ( + ctxt_pP, + DCCH, + nr_rrc_mui++, + SDU_CONFIRM_NO, + (enc_rval.encoded + 7) / 8, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + #endif + } else + LOG_W(NR_RRC,"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand\n", + securityModeCommand->criticalExtensions.present); + } - LOG_T(NR_RRC,"\n"); - /*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff; - UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */ - -#ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM, - NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); - memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, - NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_CCCH_DATA_IND); - GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; - itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); -#endif - } -} - -//----------------------------------------------------------------------------- -int32_t -nr_rrc_ue_establish_srb1( - module_id_t ue_mod_idP, - frame_t frameP, - uint8_t gNB_index, - NR_SRB_ToAddMod_t *SRB_config -) -//----------------------------------------------------------------------------- -{ - // add descriptor from RRC PDU - NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1; - NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG - NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1; - LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index); - return(0); -} - -//----------------------------------------------------------------------------- -int32_t -nr_rrc_ue_establish_srb2( - module_id_t ue_mod_idP, - frame_t frameP, - uint8_t gNB_index, - NR_SRB_ToAddMod_t *SRB_config -) -//----------------------------------------------------------------------------- -{ - // add descriptor from RRC PDU - NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1; - NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG - NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2; - LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index); - return(0); -} + //----------------------------------------------------------------------------- + void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { + uint8_t i=0,rv[6]; -//----------------------------------------------------------------------------- -int32_t -nr_rrc_ue_establish_drb( - module_id_t ue_mod_idP, - frame_t frameP, - uint8_t gNB_index, - NR_DRB_ToAddMod_t *DRB_config -) -//----------------------------------------------------------------------------- -{ - // add descriptor from RRC PDU - int oip_ifup = 0, ip_addr_offset3 = 0, ip_addr_offset4 = 0; - /* avoid gcc warnings */ - (void)oip_ifup; - (void)ip_addr_offset3; - (void)ip_addr_offset4; - LOG_I(NR_RRC,"[UE %d] Frame %d: processing RRCReconfiguration: reconfiguring DRB %ld\n", - ue_mod_idP, frameP, DRB_config->drb_Identity); - - if(!AMF_MODE_ENABLED) { - ip_addr_offset3 = 0; - ip_addr_offset4 = 1; - LOG_I(OIP, "[UE %d] trying to bring up the OAI interface %d, IP X.Y.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP, - ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1); - oip_ifup = nas_config(ip_addr_offset3+ue_mod_idP+1, // interface_id - UE_NAS_USE_TUN?1:(ip_addr_offset3+ue_mod_idP+1), // third_octet - ip_addr_offset4+ue_mod_idP+1, // fourth_octet - "oip"); // interface suffix (when using kernel module) - - if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB - LOG_I(OIP, "[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n", - ue_mod_idP, - ip_addr_offset3+ue_mod_idP, - (long int)((gNB_index * NR_maxDRB) + DRB_config->drb_Identity)); - rb_conf_ipv4(0,//add - ue_mod_idP,//cx align with the UE index - ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index - (gNB_index * NR_maxDRB) + DRB_config->drb_Identity,//rb - 0,//dscp - ipv4_address(ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1),//saddr - ipv4_address(ip_addr_offset3+ue_mod_idP+1, gNB_index+1));//daddr - LOG_D(NR_RRC,"[UE %d] State = Attached (gNB %d)\n",ue_mod_idP,gNB_index); + if(get_softmodem_params()->sa) { + AMF_MODE_ENABLED = 1; + } + if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) { + // Get RRCConnectionRequest, fill random for now + // Generate random byte stream for contention resolution + for (i=0; i<6; i++) { + #ifdef SMBV + // if SMBV is configured the contention resolution needs to be fix for the connection procedure to succeed + rv[i]=i; + #else + rv[i]=taus()&0xff; + #endif + LOG_T(NR_RRC,"%x.",rv[i]); + } + + LOG_T(NR_RRC,"\n"); + NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size = + do_RRCSetupRequest( + module_id, + (uint8_t *)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload, + rv); + LOG_I(NR_RRC,"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)\n", + module_id, NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index); + + for (i=0; i<NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) { + //LOG_T(NR_RRC,"%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]); + printf("%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]); + + } + + // LOG_T(NR_RRC,"\n"); + printf("\n"); + /*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff; + UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */ + + /* + log_dump(RRC,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size, + LOG_DUMP_CHAR,"RRCSetupRequest :\n"); + rrc_data_req_ue ( + ctxt_pP, + DCCH, + nr_rrc_mui++, + SDU_CONFIRM_NO, + NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size, + (uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, + PDCP_TRANSMISSION_MODE_CONTROL); + */ + + #ifdef ITTI_SIM + MessageDef *message_p; + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM, + NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); + memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, + NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); + message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_CCCH_DATA_IND); + GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; + GNB_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; + itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); + #endif } } - return(0); -} - -//----------------------------------------------------------------------------- -void -nr_rrc_ue_process_measConfig( - const protocol_ctxt_t *const ctxt_pP, - const uint8_t gNB_index, - NR_MeasConfig_t *const measConfig -) -//----------------------------------------------------------------------------- -{ - int i; - long ind; - NR_MeasObjectToAddMod_t *measObj = NULL; - NR_ReportConfigToAddMod_t *reportConfig = NULL; - - if (measConfig->measObjectToRemoveList != NULL) { - for (i = 0; i < measConfig->measObjectToRemoveList->list.count; i++) { - ind = *measConfig->measObjectToRemoveList->list.array[i]; - free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]); - } - } - - if (measConfig->measObjectToAddModList != NULL) { - LOG_I(NR_RRC, "Measurement Object List is present\n"); - for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) { - measObj = measConfig->measObjectToAddModList->list.array[i]; - ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId; - - if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]) { - LOG_D(NR_RRC, "Modifying measurement object %ld\n",ind); - memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1], - (char *)measObj, - sizeof(NR_MeasObjectToAddMod_t)); - } else { - LOG_I(NR_RRC, "Adding measurement object %ld\n", ind); - - if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) { - NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]=measObj; - } - } - } - - LOG_I(NR_RRC, "call rrc_mac_config_req \n"); - // rrc_mac_config_req_ue - } - - if (measConfig->reportConfigToRemoveList != NULL) { - for (i = 0; i < measConfig->reportConfigToRemoveList->list.count; i++) { - ind = *measConfig->reportConfigToRemoveList->list.array[i]; - free(NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]); - } - } - - if (measConfig->reportConfigToAddModList != NULL) { - LOG_I(NR_RRC,"Report Configuration List is present\n"); - for (i = 0; i < measConfig->reportConfigToAddModList->list.count; i++) { - ind = measConfig->reportConfigToAddModList->list.array[i]->reportConfigId; - reportConfig = measConfig->reportConfigToAddModList->list.array[i]; - - if (NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]) { - LOG_I(NR_RRC, "Modifying Report Configuration %ld\n", ind-1); - memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1], - (char *)measConfig->reportConfigToAddModList->list.array[i], - sizeof(NR_ReportConfigToAddMod_t)); - } else { - LOG_D(NR_RRC,"Adding Report Configuration %ld %p \n", ind-1, measConfig->reportConfigToAddModList->list.array[i]); - if (reportConfig->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR) { - NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i]; - } - } - } - } - - if (measConfig->measIdToRemoveList != NULL) { - for (i = 0; i < measConfig->measIdToRemoveList->list.count; i++) { - ind = *measConfig->measIdToRemoveList->list.array[i]; - free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]); - } - } - - if (measConfig->measIdToAddModList != NULL) { - for (i = 0; i < measConfig->measIdToAddModList->list.count; i++) { - ind = measConfig->measIdToAddModList->list.array[i]->measId; - - if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]) { - LOG_D(NR_RRC, "Modifying Measurement ID %ld\n",ind-1); - memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1], - (char *)measConfig->measIdToAddModList->list.array[i], - sizeof(NR_MeasIdToAddMod_t)); - } else { - LOG_D(NR_RRC, "Adding Measurement ID %ld %p\n", ind-1, measConfig->measIdToAddModList->list.array[i]); - NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i]; - } - } - } - - if (measConfig->quantityConfig != NULL) { - if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) { - LOG_D(NR_RRC,"Modifying Quantity Configuration \n"); - memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index], - (char *)measConfig->quantityConfig, - sizeof(NR_QuantityConfig_t)); - } else { - LOG_D(NR_RRC, "Adding Quantity configuration\n"); - NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig; - } - } - - if (measConfig->measGapConfig != NULL) { - if (NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index]) { - memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index], - (char *)measConfig->measGapConfig, - sizeof(NR_MeasGapConfig_t)); - } else { - NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index] = measConfig->measGapConfig; - } - } - - if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) { - NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP; - } else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) { - NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP; - } -} - -//----------------------------------------------------------------------------- -void -nr_sa_rrc_ue_process_radioBearerConfig( - const protocol_ctxt_t *const ctxt_pP, - const uint8_t gNB_index, - NR_RadioBearerConfig_t *const radioBearerConfig -) -//----------------------------------------------------------------------------- -{ - long SRB_id, DRB_id; - int i, cnt; - - if( radioBearerConfig->srb3_ToRelease != NULL){ - if( *radioBearerConfig->srb3_ToRelease == TRUE){ - //TODO (release the PDCP entity and the srb-Identity of the SRB3.) - } - } - - if (radioBearerConfig->srb_ToAddModList != NULL) { - if (radioBearerConfig->securityConfig != NULL) { - if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) { - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm = - radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm; - NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm = - *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm; - } - } - - uint8_t *kRRCenc = NULL; - uint8_t *kRRCint = NULL; - derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm, - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc); - derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm, - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint); - // Refresh SRBs - // nr_rrc_pdcp_config_asn1_req(ctxt_pP, - // radioBearerConfig->srb_ToAddModList, - // NULL, - // NULL, - // NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - // (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), - // kRRCenc, - // kRRCint, - // NULL, - // NULL, - // NULL, - // NULL, - // NULL); - // Refresh SRBs - // nr_rrc_rlc_config_asn1_req(ctxt_pP, - // radioBearerConfig->srb_ToAddModList, - // NULL, - // NULL, - // NULL, - // NULL - // ); - - for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) { - SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity; - LOG_D(NR_RRC,"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)\n", ctxt_pP->module_id, ctxt_pP->frame, cnt, SRB_id); - if (SRB_id == 1) { - if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index]) { - memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index], - radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t)); - } else { - NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt]; - nr_rrc_ue_establish_srb1(ctxt_pP->module_id, - ctxt_pP->frame, - gNB_index, - radioBearerConfig->srb_ToAddModList->list.array[cnt]); - - LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]\n", - ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); - // rrc_mac_config_req_ue - } - } else { - if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index]) { - memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index], - radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t)); - } else { - NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt]; - nr_rrc_ue_establish_srb2(ctxt_pP->module_id, - ctxt_pP->frame, - gNB_index, - radioBearerConfig->srb_ToAddModList->list.array[cnt]); - - LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]\n", - ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); - // rrc_mac_config_req_ue - } - } // srb2 - } - } // srb_ToAddModList - - // Establish DRBs if present - if (radioBearerConfig->drb_ToAddModList != NULL) { - if ((NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) && - (radioBearerConfig->drb_ToAddModList->list.count >= 1)) { - NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t)); - *NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity; - } + //----------------------------------------------------------------------------- + int32_t + nr_rrc_ue_establish_srb1( + module_id_t ue_mod_idP, + frame_t frameP, + uint8_t gNB_index, + NR_SRB_ToAddMod_t *SRB_config + ) + //----------------------------------------------------------------------------- + { + // add descriptor from RRC PDU + NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1; + NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG + NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1; + LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index); + return(0); + } - for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) { - DRB_id = radioBearerConfig->drb_ToAddModList->list.array[cnt]->drb_Identity; - if (NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]) { - memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1], - radioBearerConfig->drb_ToAddModList->list.array[cnt], sizeof(NR_DRB_ToAddMod_t)); - } else { - LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]); - NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1] = radioBearerConfig->drb_ToAddModList->list.array[cnt]; - } - } + //----------------------------------------------------------------------------- + int32_t + nr_rrc_ue_establish_srb2( + module_id_t ue_mod_idP, + frame_t frameP, + uint8_t gNB_index, + NR_SRB_ToAddMod_t *SRB_config + ) + //----------------------------------------------------------------------------- + { + // add descriptor from RRC PDU + NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1; + NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG + NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2; + LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index); + return(0); + } - uint8_t *kUPenc = NULL; - derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm, - NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc); - MSC_LOG_TX_MESSAGE( - MSC_RRC_UE, - MSC_PDCP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->rnti, - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4)); - - // Refresh DRBs - // nr_rrc_pdcp_config_asn1_req(ctxt_pP, - // NULL, - // radioBearerConfig->drb_ToAddModList, - // NULL, - // NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - // (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), - // NULL, - // NULL, - // kUPenc, - // NULL, - // NULL, - // NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, - // NULL); - // Refresh DRBs - // nr_rrc_rlc_config_asn1_req(ctxt_pP, - // NULL, - // radioBearerConfig->drb_ToAddModList, - // NULL, - // NULL, - // NULL - // ); - } // drb_ToAddModList - - if (radioBearerConfig->drb_ToReleaseList != NULL) { - for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) { - DRB_id = *radioBearerConfig->drb_ToReleaseList->list.array[i]; - free(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]); + //----------------------------------------------------------------------------- + int32_t + nr_rrc_ue_establish_drb( + module_id_t ue_mod_idP, + frame_t frameP, + uint8_t gNB_index, + NR_DRB_ToAddMod_t *DRB_config + ) + //----------------------------------------------------------------------------- + { + // add descriptor from RRC PDU + int oip_ifup = 0, ip_addr_offset3 = 0, ip_addr_offset4 = 0; + /* avoid gcc warnings */ + (void)oip_ifup; + (void)ip_addr_offset3; + (void)ip_addr_offset4; + LOG_I(NR_RRC,"[UE %d] Frame %d: processing RRCReconfiguration: reconfiguring DRB %ld\n", + ue_mod_idP, frameP, DRB_config->drb_Identity); + + if(!AMF_MODE_ENABLED) { + ip_addr_offset3 = 0; + ip_addr_offset4 = 1; + LOG_I(OIP, "[UE %d] trying to bring up the OAI interface %d, IP X.Y.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP, + ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1); + oip_ifup = nas_config(ip_addr_offset3+ue_mod_idP+1, // interface_id + UE_NAS_USE_TUN?1:(ip_addr_offset3+ue_mod_idP+1), // third_octet + ip_addr_offset4+ue_mod_idP+1, // fourth_octet + "oip"); // interface suffix (when using kernel module) + + if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB + LOG_I(OIP, "[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n", + ue_mod_idP, + ip_addr_offset3+ue_mod_idP, + (long int)((gNB_index * NR_maxDRB) + DRB_config->drb_Identity)); + rb_conf_ipv4(0,//add + ue_mod_idP,//cx align with the UE index + ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index + (gNB_index * NR_maxDRB) + DRB_config->drb_Identity,//rb + 0,//dscp + ipv4_address(ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1),//saddr + ipv4_address(ip_addr_offset3+ue_mod_idP+1, gNB_index+1));//daddr + LOG_D(NR_RRC,"[UE %d] State = Attached (gNB %d)\n",ue_mod_idP,gNB_index); } } - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED; - LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index); -} - -//----------------------------------------------------------------------------- -void -rrc_ue_process_rrcReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - NR_RRCReconfiguration_t *rrcReconfiguration, - uint8_t gNB_index -) -//----------------------------------------------------------------------------- -{ - LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n", - ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + return(0); + } - NR_RRCReconfiguration_IEs_t *ie = NULL; + //----------------------------------------------------------------------------- + void + nr_rrc_ue_process_measConfig( + const protocol_ctxt_t *const ctxt_pP, + const uint8_t gNB_index, + NR_MeasConfig_t *const measConfig + ) + //----------------------------------------------------------------------------- + { + int i; + long ind; + NR_MeasObjectToAddMod_t *measObj = NULL; + NR_ReportConfigToAddMod_t *reportConfig = NULL; + + if (measConfig->measObjectToRemoveList != NULL) { + for (i = 0; i < measConfig->measObjectToRemoveList->list.count; i++) { + ind = *measConfig->measObjectToRemoveList->list.array[i]; + free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]); + } + } - if (rrcReconfiguration->criticalExtensions.present - == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { - ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; - if (ie->measConfig != NULL) { - LOG_I(NR_RRC, "Measurement Configuration is present\n"); - nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig); - } + if (measConfig->measObjectToAddModList != NULL) { + LOG_I(NR_RRC, "Measurement Object List is present\n"); + for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) { + measObj = measConfig->measObjectToAddModList->list.array[i]; + ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId; + + if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]) { + LOG_D(NR_RRC, "Modifying measurement object %ld\n",ind); + memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1], + (char *)measObj, + sizeof(NR_MeasObjectToAddMod_t)); + } else { + LOG_I(NR_RRC, "Adding measurement object %ld\n", ind); + + if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) { + NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]=measObj; + } + } + } + + LOG_I(NR_RRC, "call rrc_mac_config_req \n"); + // rrc_mac_config_req_ue + } - if (ie->radioBearerConfig != NULL) { - LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); - nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); - } + if (measConfig->reportConfigToRemoveList != NULL) { + for (i = 0; i < measConfig->reportConfigToRemoveList->list.count; i++) { + ind = *measConfig->reportConfigToRemoveList->list.array[i]; + free(NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]); + } + } - /* Check if there is dedicated NAS information to forward to NAS */ - if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) { - int list_count; - uint32_t pdu_length; - uint8_t *pdu_buffer; - MessageDef *msg_p; + if (measConfig->reportConfigToAddModList != NULL) { + LOG_I(NR_RRC,"Report Configuration List is present\n"); + for (i = 0; i < measConfig->reportConfigToAddModList->list.count; i++) { + ind = measConfig->reportConfigToAddModList->list.array[i]->reportConfigId; + reportConfig = measConfig->reportConfigToAddModList->list.array[i]; + + if (NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]) { + LOG_I(NR_RRC, "Modifying Report Configuration %ld\n", ind-1); + memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1], + (char *)measConfig->reportConfigToAddModList->list.array[i], + sizeof(NR_ReportConfigToAddMod_t)); + } else { + LOG_D(NR_RRC,"Adding Report Configuration %ld %p \n", ind-1, measConfig->reportConfigToAddModList->list.array[i]); + if (reportConfig->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR) { + NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i]; + } + } + } + } - for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) { - pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size; - pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf; -#ifdef ITTI_SIM - uint8_t msg_type = 0; - if((pdu_buffer + 1) != NULL){ - if (*(pdu_buffer + 1) > 0 ) { - if((pdu_buffer + 9) != NULL){ - msg_type = *(pdu_buffer + 9); - } else { - LOG_W(NR_RRC, "[UE] Received invalid downlink message\n"); - return; - } - } else { - if((pdu_buffer + 2) != NULL){ - msg_type = *(pdu_buffer + 2); - } else { - LOG_W(NR_RRC, "[UE] Received invalid downlink message\n"); - return; - } - } - } - if(msg_type == REGISTRATION_ACCEPT){ - LOG_I(NR_RRC, "[UE] Received REGISTRATION ACCEPT message\n"); - } -#endif - msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_ESTABLI_CNF); - NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; - NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; - NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; - itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); - } + if (measConfig->measIdToRemoveList != NULL) { + for (i = 0; i < measConfig->measIdToRemoveList->list.count; i++) { + ind = *measConfig->measIdToRemoveList->list.array[i]; + free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]); + } + } - free (ie->nonCriticalExtension->dedicatedNAS_MessageList); - } - } -} + if (measConfig->measIdToAddModList != NULL) { + for (i = 0; i < measConfig->measIdToAddModList->list.count; i++) { + ind = measConfig->measIdToAddModList->list.array[i]->measId; + + if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]) { + LOG_D(NR_RRC, "Modifying Measurement ID %ld\n",ind-1); + memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1], + (char *)measConfig->measIdToAddModList->list.array[i], + sizeof(NR_MeasIdToAddMod_t)); + } else { + LOG_D(NR_RRC, "Adding Measurement ID %ld %p\n", ind-1, measConfig->measIdToAddModList->list.array[i]); + NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i]; + } + } + } -//----------------------------------------------------------------------------- -void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, const uint8_t Transaction_id ) { - uint8_t buffer[32], size; - size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, Transaction_id); - LOG_I(NR_RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, gNB_index); - LOG_D(RLC, - "[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n", - ctxt_pP->frame, - UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), - size, - gNB_index, - nr_rrc_mui, - UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), - DCCH); -#ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,size); - memcpy (message_buffer, buffer, size); + if (measConfig->quantityConfig != NULL) { + if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) { + LOG_D(NR_RRC,"Modifying Quantity Configuration \n"); + memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index], + (char *)measConfig->quantityConfig, + sizeof(NR_QuantityConfig_t)); + } else { + LOG_D(NR_RRC, "Adding Quantity configuration\n"); + NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig; + } + } - message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND); - UE_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; - UE_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; - UE_RRC_DCCH_DATA_IND (message_p).size = size; - itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); + if (measConfig->measGapConfig != NULL) { + if (NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index]) { + memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index], + (char *)measConfig->measGapConfig, + sizeof(NR_MeasGapConfig_t)); + } else { + NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index] = measConfig->measGapConfig; + } + } -#else - rrc_data_req_ue ( - ctxt_pP, - DCCH, - nr_rrc_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); -#endif + if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) { + NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP; + } else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) { + NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP; + } + } -} + //----------------------------------------------------------------------------- + void + nr_sa_rrc_ue_process_radioBearerConfig( + const protocol_ctxt_t *const ctxt_pP, + const uint8_t gNB_index, + NR_RadioBearerConfig_t *const radioBearerConfig + ) + //----------------------------------------------------------------------------- + { + long SRB_id, DRB_id; + int i, cnt; + + if( radioBearerConfig->srb3_ToRelease != NULL){ + if( *radioBearerConfig->srb3_ToRelease == TRUE){ + //TODO (release the PDCP entity and the srb-Identity of the SRB3.) + } + } -// from NR SRB1 -//----------------------------------------------------------------------------- -int -nr_rrc_ue_decode_dcch( - const protocol_ctxt_t *const ctxt_pP, - const srb_id_t Srb_id, - const uint8_t *const Buffer, - const uint8_t gNB_indexP -) -//----------------------------------------------------------------------------- -{ - asn_dec_rval_t dec_rval; - NR_DL_DCCH_Message_t *dl_dcch_msg = NULL; - MessageDef *msg_p; + if (radioBearerConfig->srb_ToAddModList != NULL) { + if (radioBearerConfig->securityConfig != NULL) { + if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) { + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm = + radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm; + NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm = + *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm; + } + } + + uint8_t *kRRCenc = NULL; + uint8_t *kRRCint = NULL; + derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm, + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc); + derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm, + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint); + // Refresh SRBs + nr_rrc_pdcp_config_asn1_req(ctxt_pP, + radioBearerConfig->srb_ToAddModList, + NULL, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | + (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + kRRCenc, + kRRCint, + NULL, + NULL, + NULL, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); + // Refresh SRBs + nr_rrc_rlc_config_asn1_req(ctxt_pP, + radioBearerConfig->srb_ToAddModList, + NULL, + NULL, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList + ); + + for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) { + SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity; + LOG_D(NR_RRC,"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)\n", ctxt_pP->module_id, ctxt_pP->frame, cnt, SRB_id); + if (SRB_id == 1) { + if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index]) { + memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index], + radioBearerConfig->srb_ToAddModList->list.array[cnt], + sizeof(NR_SRB_ToAddMod_t)); + } else { + NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt]; + nr_rrc_ue_establish_srb1(ctxt_pP->module_id, + ctxt_pP->frame, + gNB_index, + radioBearerConfig->srb_ToAddModList->list.array[cnt]); + + LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]\n", + ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); + // rrc_mac_config_req_ue + } + } else { + if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index]) { + memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index], + radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t)); + } else { + NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt]; + nr_rrc_ue_establish_srb2(ctxt_pP->module_id, + ctxt_pP->frame, + gNB_index, + radioBearerConfig->srb_ToAddModList->list.array[cnt]); + + LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]\n", + ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); + // rrc_mac_config_req_ue + } + } // srb2 + } + } // srb_ToAddModList + + // Establish DRBs if present + if (radioBearerConfig->drb_ToAddModList != NULL) { + if ((NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) && + (radioBearerConfig->drb_ToAddModList->list.count >= 1)) { + NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t)); + *NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity; + } + + for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) { + DRB_id = radioBearerConfig->drb_ToAddModList->list.array[cnt]->drb_Identity; + if (NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]) { + memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1], + radioBearerConfig->drb_ToAddModList->list.array[cnt], sizeof(NR_DRB_ToAddMod_t)); + } else { + LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]); + NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1] = radioBearerConfig->drb_ToAddModList->list.array[cnt]; + } + } + + uint8_t *kUPenc = NULL; + derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm, + NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc); + MSC_LOG_TX_MESSAGE( + MSC_RRC_UE, + MSC_PDCP_UE, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)", + MSC_AS_TIME_ARGS(ctxt_pP), + ctxt_pP->rnti, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | + (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4)); + + // Refresh DRBs + // nr_rrc_pdcp_config_asn1_req(ctxt_pP, + // NULL, + // radioBearerConfig->drb_ToAddModList, + // NULL, + // NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | + // (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + // NULL, + // NULL, + // kUPenc, + // NULL, + // NULL, + // NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, + // NULL); + // Refresh DRBs + // nr_rrc_rlc_config_asn1_req(ctxt_pP, + // NULL, + // radioBearerConfig->drb_ToAddModList, + // NULL, + // NULL, + // NULL + // ); + } // drb_ToAddModList + + if (radioBearerConfig->drb_ToReleaseList != NULL) { + for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) { + DRB_id = *radioBearerConfig->drb_ToReleaseList->list.array[i]; + free(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]); + } + } - if (Srb_id != 1) { - LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n", - ctxt_pP->module_id, ctxt_pP->frame, Srb_id); - return -1; - } else { - LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id); - } + NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED; + LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index); + } - LOG_D(NR_RRC, "Decoding DL-DCCH Message\n"); - dec_rval = uper_decode( NULL, - &asn_DEF_NR_DL_DCCH_Message, - (void **)&dl_dcch_msg, - Buffer, - RRC_BUF_SIZE, - 0, - 0); + //----------------------------------------------------------------------------- + void + rrc_ue_process_rrcReconfiguration( + const protocol_ctxt_t *const ctxt_pP, + NR_RRCReconfiguration_t *rrcReconfiguration, + uint8_t gNB_index + ) + //----------------------------------------------------------------------------- + { + LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n", + ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + + NR_RRCReconfiguration_IEs_t *ie = NULL; + + if (rrcReconfiguration->criticalExtensions.present + == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { + ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; + if (ie->measConfig != NULL) { + LOG_I(NR_RRC, "Measurement Configuration is present\n"); + // nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig); + } + + if (ie->radioBearerConfig != NULL) { + LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); + // nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); + } + + /* Check if there is dedicated NAS information to forward to NAS */ + if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) { + int list_count; + uint32_t pdu_length; + uint8_t *pdu_buffer; + MessageDef *msg_p; + + for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) { + pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size; + pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf; + msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_ESTABLI_CNF); + NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; + NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; + NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; + itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p); + } + + free (ie->nonCriticalExtension->dedicatedNAS_MessageList); + } + } + } - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed); - return -1; - } + //----------------------------------------------------------------------------- + void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, const uint8_t Transaction_id ) { + uint8_t buffer[32], size; + size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, Transaction_id); + LOG_I(NR_RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, gNB_index); + LOG_D(RLC, + "[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n", + ctxt_pP->frame, + UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), + size, + gNB_index, + nr_rrc_mui, + UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), + DCCH); + #ifdef ITTI_SIM + MessageDef *message_p; + uint8_t *message_buffer; + message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,size); + memcpy (message_buffer, buffer, size); + + message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND); + UE_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; + UE_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; + UE_RRC_DCCH_DATA_IND (message_p).size = size; + itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); + + #else + rrc_data_req_ue ( + ctxt_pP, + DCCH, + nr_rrc_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + #endif - // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg); - // } - - if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { - switch (dl_dcch_msg->message.choice.c1->present) { - case NR_DL_DCCH_MessageType__c1_PR_NOTHING: - LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: - { - rrc_ue_process_rrcReconfiguration(ctxt_pP, - dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration, - gNB_indexP); - nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP, - gNB_indexP, - dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); - - if (first_rrcreconfigurationcomplete == 0) { - first_rrcreconfigurationcomplete = 1; -#ifdef ITTI_SIM - if (AMF_MODE_ENABLED) { - as_nas_info_t initialNasMsg; - memset(&initialNasMsg, 0, sizeof(as_nas_info_t)); - generateRegistrationComplete(&initialNasMsg, NULL); - if(initialNasMsg.length > 0){ - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_UPLINK_DATA_REQ); - NAS_UPLINK_DATA_REQ(message_p).UEid = ctxt_pP->module_id; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length; - itti_send_msg_to_task(TASK_RRC_NRUE, ctxt_pP->instance, message_p); - LOG_I(NR_RRC, " Send NAS_UPLINK_DATA_REQ message(RegistrationComplete)\n"); - } - as_nas_info_t pduEstablishMsg; - memset(&pduEstablishMsg, 0, sizeof(as_nas_info_t)); - generatePduSessionEstablishRequest(&pduEstablishMsg); - if(initialNasMsg.length > 0){ - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_UPLINK_DATA_REQ); - NAS_UPLINK_DATA_REQ(message_p).UEid = ctxt_pP->module_id; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)pduEstablishMsg.data; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = pduEstablishMsg.length; - itti_send_msg_to_task(TASK_RRC_NRUE, ctxt_pP->instance, message_p); - LOG_I(NR_RRC, " Send NAS_UPLINK_DATA_REQ message(PduSessionEstablishRequest)\n"); - } - } -#endif - } - } - break; - - case NR_DL_DCCH_MessageType__c1_PR_rrcResume: - case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: - LOG_I(NR_RRC, "[UE %d] Received RRC Release (gNB %d)\n", - ctxt_pP->module_id, gNB_indexP); - - msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); - - if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && - (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ - dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = - NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; - dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = - NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; - } - - itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); - break; - case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", - ctxt_pP->module_id,gNB_indexP); - nr_rrc_ue_process_ueCapabilityEnquiry( - ctxt_pP, - dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry, - gNB_indexP); - break; - case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: - LOG_I(NR_RRC, - "[UE%d] Frame %d : Logical Channel DL-DCCH (SRB1), Received RRCReestablishment\n", - ctxt_pP->module_id, - ctxt_pP->frame); - nr_rrc_ue_generate_rrcReestablishmentComplete( - ctxt_pP, - dl_dcch_msg->message.choice.c1->choice.rrcReestablishment, - gNB_indexP); - break; - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: - { - NR_DLInformationTransfer_t *dlInformationTransfer = dl_dcch_msg->message.choice.c1->choice.dlInformationTransfer; - - if (dlInformationTransfer->criticalExtensions.present - == NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) { - /* This message hold a dedicated info NAS payload, forward it to NAS */ - NR_DedicatedNAS_Message_t *dedicatedNAS_Message = - dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message; - uint32_t pdu_length; - uint8_t *pdu_buffer; - pdu_length = dedicatedNAS_Message->size; - pdu_buffer = dedicatedNAS_Message->buf; -#ifdef ITTI_SIM - LOG_I(NR_RRC, "[UE %d] Received %s: UEid %u, length %u , buffer %p\n", ctxt_pP->module_id, messages_info[NAS_DOWNLINK_DATA_IND].name, - ctxt_pP->module_id, pdu_length, pdu_buffer); - as_nas_info_t initialNasMsg; - uint8_t msg_type = 0; - memset(&initialNasMsg, 0, sizeof(as_nas_info_t)); - if((pdu_buffer + 1) != NULL){ - if (*(pdu_buffer + 1) > 0 ) { - msg_type = *(pdu_buffer + 9); - } else { - msg_type = *(pdu_buffer + 2); - } - } - if((pdu_buffer + 2) == NULL){ - LOG_W(NR_RRC, "[UE] Received invalid downlink message\n"); - return 0; - } - - switch(msg_type){ - case FGS_IDENTITY_REQUEST: - generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3)); - break; - case FGS_AUTHENTICATION_REQUEST: - generateAuthenticationResp(&initialNasMsg, pdu_buffer); - break; - case FGS_SECURITY_MODE_COMMAND: - generateSecurityModeComplete(&initialNasMsg); - break; - default: - LOG_W(NR_RRC,"unknow message type %d\n",msg_type); - break; - } - if(initialNasMsg.length > 0){ - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_UPLINK_DATA_REQ); - NAS_UPLINK_DATA_REQ(message_p).UEid = ctxt_pP->module_id; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length; - itti_send_msg_to_task(TASK_RRC_NRUE, ctxt_pP->instance, message_p); - LOG_I(NR_RRC, " Send NAS_UPLINK_DATA_REQ message\n"); - } -#else - MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND); - NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length; - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer; - itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); -#endif - } - } + } - break; - case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: - case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: - case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: - case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: - case NR_DL_DCCH_MessageType__c1_PR_spare3: - case NR_DL_DCCH_MessageType__c1_PR_spare2: - case NR_DL_DCCH_MessageType__c1_PR_spare1: - case NR_DL_DCCH_MessageType__c1_PR_counterCheck: - break; - case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: - LOG_I(NR_RRC, "[UE %d] Received securityModeCommand (gNB %d)\n", - ctxt_pP->module_id, gNB_indexP); - nr_rrc_ue_process_securityModeCommand( - ctxt_pP, - dl_dcch_msg->message.choice.c1->choice.securityModeCommand, - gNB_indexP); - - break; - } - } - return 0; -} + // from NR SRB1 + //----------------------------------------------------------------------------- + int + nr_rrc_ue_decode_dcch( + const protocol_ctxt_t *const ctxt_pP, + const srb_id_t Srb_id, + const uint8_t *const Buffer, + const uint8_t gNB_indexP + ) + //----------------------------------------------------------------------------- + { + asn_dec_rval_t dec_rval; + NR_DL_DCCH_Message_t *dl_dcch_msg = NULL; + MessageDef *msg_p; + + if (Srb_id != 1) { + LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n", + ctxt_pP->module_id, ctxt_pP->frame, Srb_id); + return -1; + } else { + LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id); + } -//----------------------------------------------------------------------------- -void *rrc_nrue_task( void *args_p ) { - MessageDef *msg_p; - instance_t instance; - unsigned int ue_mod_id; - int result; - NR_SRB_INFO *srb_info_p; - protocol_ctxt_t ctxt; - itti_mark_task_ready (TASK_RRC_NRUE); - - while(1) { - // Wait for a message - itti_receive_msg (TASK_RRC_NRUE, &msg_p); - instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); - ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); - - switch (ITTI_MSG_ID(msg_p)) { - case TERMINATE_MESSAGE: - LOG_W(NR_RRC, " *** Exiting RRC thread\n"); - itti_exit_task (); - break; + LOG_D(NR_RRC, "Decoding DL-DCCH Message\n"); + dec_rval = uper_decode( NULL, + &asn_DEF_NR_DL_DCCH_Message, + (void **)&dl_dcch_msg, + Buffer, + RRC_BUF_SIZE, + 0, + 0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed); + return -1; + } - case MESSAGE_TEST: - LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); - break; + // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg); + // } + + if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { + switch (dl_dcch_msg->message.choice.c1->present) { + case NR_DL_DCCH_MessageType__c1_PR_NOTHING: + LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: + { + rrc_ue_process_rrcReconfiguration(ctxt_pP, + dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration, + gNB_indexP); + nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP, + gNB_indexP, + dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); + break; + } + + case NR_DL_DCCH_MessageType__c1_PR_rrcResume: + case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: + LOG_I(NR_RRC, "[UE %d] Received RRC Release (gNB %d)\n", + ctxt_pP->module_id, gNB_indexP); + + msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); + + if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && + (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ + dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = + NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; + dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = + NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; + } + + itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); + break; + case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", + ctxt_pP->module_id,gNB_indexP); + nr_rrc_ue_process_ueCapabilityEnquiry( + ctxt_pP, + dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry, + gNB_indexP); + break; + case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: + LOG_I(NR_RRC, + "[UE%d] Frame %d : Logical Channel DL-DCCH (SRB1), Received RRCReestablishment\n", + ctxt_pP->module_id, + ctxt_pP->frame); + nr_rrc_ue_generate_rrcReestablishmentComplete( + ctxt_pP, + dl_dcch_msg->message.choice.c1->choice.rrcReestablishment, + gNB_indexP); + break; + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + { + NR_DLInformationTransfer_t *dlInformationTransfer = dl_dcch_msg->message.choice.c1->choice.dlInformationTransfer; + + if (dlInformationTransfer->criticalExtensions.present + == NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) { + /* This message hold a dedicated info NAS payload, forward it to NAS */ + NR_DedicatedNAS_Message_t *dedicatedNAS_Message = + dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message; + + MessageDef *msg_p; + msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND); + NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = dedicatedNAS_Message->size; + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = dedicatedNAS_Message->buf; + itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p); + } + } + + break; + case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: + case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: + case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: + case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: + case NR_DL_DCCH_MessageType__c1_PR_spare3: + case NR_DL_DCCH_MessageType__c1_PR_spare2: + case NR_DL_DCCH_MessageType__c1_PR_spare1: + case NR_DL_DCCH_MessageType__c1_PR_counterCheck: + break; + case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: + LOG_I(NR_RRC, "[UE %d] Received securityModeCommand (gNB %d)\n", + ctxt_pP->module_id, gNB_indexP); + nr_rrc_ue_process_securityModeCommand( + ctxt_pP, + dl_dcch_msg->message.choice.c1->choice.securityModeCommand, + gNB_indexP); + + break; + } + } + return 0; + } - case NR_RRC_MAC_BCCH_DATA_IND: - LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), - NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); - // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0); - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); - nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id, - NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index, - NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu, - NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, - NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, - NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); - - case NR_RRC_MAC_CCCH_DATA_IND: - LOG_D(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n", - ue_mod_id, - NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, - ITTI_MSG_NAME (msg_p), - NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, - NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index); - srb_info_p = &NR_UE_rrc_inst[ue_mod_id].Srb0[NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index]; - memcpy (srb_info_p->Rx_buffer.Payload, NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu, - NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size); - srb_info_p->Rx_buffer.payload_size = NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0); + //----------------------------------------------------------------------------- + void *rrc_nrue_task( void *args_p ) { + MessageDef *msg_p; + instance_t instance; + unsigned int ue_mod_id; + int result; + NR_SRB_INFO *srb_info_p; + protocol_ctxt_t ctxt; + itti_mark_task_ready (TASK_RRC_NRUE); + + while(1) { + // Wait for a message + itti_receive_msg (TASK_RRC_NRUE, &msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); + ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); + + switch (ITTI_MSG_ID(msg_p)) { + case TERMINATE_MESSAGE: + LOG_W(NR_RRC, " *** Exiting RRC thread\n"); + itti_exit_task (); + break; + + case MESSAGE_TEST: + LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); + break; + + case NR_RRC_MAC_BCCH_DATA_IND: + LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), + NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); + nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id, + NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index, + NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu, + NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, + NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, + NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); + break; + + case NR_RRC_MAC_CCCH_DATA_IND: + LOG_I(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n", + ue_mod_id, + NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, + ITTI_MSG_NAME (msg_p), + NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, + NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index); + srb_info_p = &NR_UE_rrc_inst[ue_mod_id].Srb0[NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index]; + memcpy (srb_info_p->Rx_buffer.Payload, NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu, + NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size); + srb_info_p->Rx_buffer.payload_size = NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0); // PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index); nr_rrc_ue_decode_ccch (&ctxt, srb_info_p, @@ -2502,7 +2451,7 @@ void *rrc_nrue_task( void *args_p ) { /* PDCP messages */ case NR_RRC_DCCH_DATA_IND: PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, NR_RRC_DCCH_DATA_IND (msg_p).module_id, GNB_FLAG_NO, NR_RRC_DCCH_DATA_IND (msg_p).rnti, NR_RRC_DCCH_DATA_IND (msg_p).frame, 0,NR_RRC_DCCH_DATA_IND (msg_p).gNB_index); - LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, DCCH %d, gNB %d\n", + LOG_I(NR_RRC, "[UE %d] Received %s: frameP %d, DCCH %d, gNB %d\n", NR_RRC_DCCH_DATA_IND (msg_p).module_id, ITTI_MSG_NAME (msg_p), NR_RRC_DCCH_DATA_IND (msg_p).frame, @@ -2568,7 +2517,7 @@ void *rrc_nrue_task( void *args_p ) { LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); break; } - LOG_I(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, nr_rrc_get_state(ue_mod_id)); + LOG_D(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, nr_rrc_get_state(ue_mod_id)); result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); msg_p = NULL; diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index f4ce4746573b5e7e93a0805b88ec269fd81c9fa5..e417b9f0b478130a8cfc78a57dcd680b7572b75f 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -105,6 +105,9 @@ typedef struct NR_UE_RRC_INST_s { NR_MeasConfig_t *meas_config; NR_CellGroupConfig_t *cell_group_config; + NR_CellGroupConfig_t *scell_group_config; + NR_ServingCellConfigCommonSIB_t *servingCellConfigCommonSIB; + NR_RadioBearerConfig_t *radio_bearer_config; NR_MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; @@ -123,7 +126,7 @@ typedef struct NR_UE_RRC_INST_s { NR_SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE]; uint8_t MBMS_flag; - OAI_NR_UECapability_t *UECap; + OAI_NR_UECapability_t *UECap; uint8_t *UECapability; uint8_t UECapability_size; @@ -209,7 +212,7 @@ typedef struct NR_UE_RRC_INST_s { long selected_plmn_identity; Rrc_State_NR_t nrRrcState; Rrc_Sub_State_NR_t nrRrcSubState; - as_nas_info_t initialNasMsg; + as_nas_info_t initialNasMsg; } NR_UE_RRC_INST_t; #endif diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 0acf6db634fd757c525fd442eb860f6164e65f9f..534da0112bf3feedd45cf7682ebde12bb9a714b9 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -109,7 +109,15 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui \param channel indicator for channel of the pdu \param pduP pointer to pdu \param pdu_len data length of pdu*/ -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len); +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len); /**\brief \param module_id module id diff --git a/openair2/RRC/NR_UE/rrc_vars.h b/openair2/RRC/NR_UE/rrc_vars.h index 5c74e5b5a8555db98ad76ac7a82f532978fcfa52..30c74debdd2db39cc5f203782078627d24988800 100644 --- a/openair2/RRC/NR_UE/rrc_vars.h +++ b/openair2/RRC/NR_UE/rrc_vars.h @@ -36,6 +36,6 @@ #include "rrc_defs.h" -NR_UE_RRC_INST_t *NR_UE_rrc_inst; +extern NR_UE_RRC_INST_t *NR_UE_rrc_inst; #endif diff --git a/openair2/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index 9b35ea67210da994de39e89afa3b2fb78a0c2c78..01b3fbfa351e14df839733d5564e4ef2df6ff369 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -81,14 +81,15 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "RRC/NR_UE/rrc_proto.h" #include "RRC/NR_UE/rrc_vars.h" #include "openair3/NAS/UE/nas_ue_task.h" +#if ITTI_SIM +#include "nr_nas_msg_sim.h" +#endif pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex uint8_t nfapi_mode = 0; // Default to monolithic mode -uint32_t target_dl_mcs = 28; -uint32_t target_ul_mcs = 20; uint32_t timing_advance = 0; uint64_t num_missed_slots=0; @@ -120,7 +121,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; //Temp fix for inexistent NR upper layer unsigned char NB_gNB_INST = 1; -static char *itti_dump_file = NULL; int UE_scan = 1; int UE_scan_carrier = 0; @@ -148,7 +148,6 @@ extern void *udp_eNB_task(void *args_p); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; double cpuf; @@ -404,6 +403,12 @@ int create_tasks_nrue(uint32_t ue_nb) { LOG_E(NR_RRC, "Create task for RRC UE failed\n"); return -1; } + + printf("create TASK_NAS_NRUE\n"); + if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) { + LOG_E(NR_RRC, "Create task for NAS UE failed\n"); + return -1; + } } @@ -571,8 +576,14 @@ int main( int argc, char **argv ) init_pdcp(); if (RC.nb_nr_inst > 0) { + nr_read_config_and_init(); // don't create if node doesn't connect to RRC/S1/GTP AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n"); + for (int gnb_id = 0; gnb_id < RC.nb_nr_inst; gnb_id++) { + MessageDef *msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); + NRRRC_CONFIGURATION_REQ(msg_p) = RC.nrrrc[gnb_id]->configuration; + itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); + } } else { printf("No ITTI, Initializing L1\n"); return 0; diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h index 34190f7d15839e2a0c3a83e9bcc9d501fbf7fb25..58cc7184e7d05ef0f449f15aafa44a2b1ca9c7c4 100644 --- a/openair2/UTIL/OCG/OCG.h +++ b/openair2/UTIL/OCG/OCG.h @@ -667,7 +667,6 @@ typedef struct { unsigned char omv_enabled; // openair mobility visulizer unsigned char opp_enabled; // openair performance profiler unsigned char oeh_enabled; // openair event handler, with CLI this could provide a remote event management - char *itti_dump_file; unsigned char vcd_enabled; char *vcd_file; unsigned char eMBMS_active_state; @@ -717,12 +716,6 @@ typedef struct { */ unsigned char slot_isr; int slot_sfd; - rnti_t eNB_ue_module_id_to_rnti[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled: - by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/ - - module_id_t eNB_ue_local_uid_to_ue_module_id[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled: - by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/ - } Info; /* @}*/ diff --git a/openair2/UTIL/OSA/osa_defs.h b/openair2/UTIL/OSA/osa_defs.h index 633465868380bba098f25dfbe385873baa050765..e845315922ceaafe585c1a04adfb2bdb8bd84a60 100644 --- a/openair2/UTIL/OSA/osa_defs.h +++ b/openair2/UTIL/OSA/osa_defs.h @@ -48,7 +48,8 @@ typedef enum { NAS_INT_ALG = 0x02, RRC_ENC_ALG = 0x03, RRC_INT_ALG = 0x04, - UP_ENC_ALG = 0x05 + UP_ENC_ALG = 0x05, + UP_INT_ALG = 0x06 } algorithm_type_dist_t; //int derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t **keNB); diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c index 58535646fd023c1d17f4402b55a9b43681d76544..321190015d7c8a37be529a8c67a263acddf0f9af 100644 --- a/openair2/X2AP/x2ap_eNB.c +++ b/openair2/X2AP/x2ap_eNB.c @@ -116,9 +116,7 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa /* some sanity check - to be refined at some point */ if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { X2AP_ERROR("x2ap_enb_data_p not NULL and sctp state not SCTP_STATE_ESTABLISHED, what to do?\n"); - // Allow for a gracious exit when we kill first the gNB, then the eNB - //abort(); - return; + exit(1); } x2ap_enb_data_p->in_streams = sctp_new_association_resp->in_streams; diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index fdce8678b0eacbee802ccdf6d72240d1f7653e87..7c3a89e7f4bff4b0a652f8224d1b94161b375cf0 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -1318,6 +1318,9 @@ MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length ASN_SEQUENCE_ADD(&servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nRFreqInfo.freqBandListNr, freq_band); switch (instance_p->N_RB_DL[i]) { + case 24: + servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nR_TxBW.nRNRB = X2AP_NRNRB_nrb24; + break; case 32: servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nR_TxBW.nRNRB = X2AP_NRNRB_nrb32; break; diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 1fb28ea05b2dd0c9a99b7c5383aa7f8ebbc83608..d60f7654ad40348af381e6778d611857667aaa2c 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -690,9 +690,11 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance, // need a FSM to handle all cases if ((ie->value.choice.Cause.present == X2AP_Cause_PR_misc) && (ie->value.choice.Cause.choice.misc == X2AP_CauseMisc_unspecified)) { - X2AP_WARN("Received X2 setup failure for eNB ... eNB is not ready\n"); + X2AP_ERROR("Received X2 setup failure for eNB ... eNB is not ready\n"); + exit(1); } else { X2AP_ERROR("Received x2 setup failure for eNB... please check your parameters\n"); + exit(1); } x2ap_eNB_data->state = X2AP_ENB_STATE_WAITING; diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 847002ab446e03f78fab62b9f0d94fe189c9d937..e1ea5cb08e2ead6103b3e4b66cd65ad877a86096 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -51,6 +51,7 @@ #include "gtpv1u_eNB_defs.h" #include "gtpv1u_eNB_task.h" #include "rrc_eNB_GTPV1U.h" +#include <common/utils/msc/msc.h> #undef GTP_DUMP_SOCKET @@ -308,7 +309,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( msgsrc != GTPV1U_MSG_FROM_SOURCE_ENB? "UDP DATA" : msgType == NW_GTP_END_MARKER?"END MARKER":"DATA FORWARDING"); - /* target enb */ + /* target enb */ if(msgType == NW_GTP_END_MARKER) { LOG_I(GTPU, "target end receive END MARKER\n"); ue_context_p->ue_context.handover_info->state = HO_END_MARKER; @@ -1497,15 +1498,15 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { stack_req.apiInfo.sendtoInfo.teid = tenb_x2u_teid; stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].tenb_ip_addr;// target enb ip rc = nwGtpv1uGpduMsgNew( - RC.gtpv1u_data_g->gtpv1u_stack, - tenb_x2u_teid, - NW_FALSE, - RC.gtpv1u_data_g->seq_num++, - data_req_p->buffer, - data_req_p->length, - data_req_p->offset, - &(stack_req.apiInfo.sendtoInfo.hMsg)); - + RC.gtpv1u_data_g->gtpv1u_stack, + tenb_x2u_teid, + NW_FALSE, + RC.gtpv1u_data_g->seq_num++, + data_req_p->buffer, + data_req_p->length, + data_req_p->offset, + &(stack_req.apiInfo.sendtoInfo.hMsg)); + if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", @@ -1515,7 +1516,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { pMsg = (NwGtpv1uMsgT *) stack_req.apiInfo.sendtoInfo.hMsg; pMsg->msgType = NW_GTP_END_MARKER; rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - + if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", @@ -1535,11 +1536,11 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, stack_req.apiInfo.sendtoInfo.hMsg); - + if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); } - + gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); delete_tunnel_req.rnti = data_req_p->rnti; @@ -1547,7 +1548,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { } } } - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT); } break; diff --git a/openair3/GTPV1-U/gtpv1u_gNB.c b/openair3/GTPV1-U/gtpv1u_gNB.c index 19d2440a95f69c537c7810e65c21301652485098..cc21b27ab5cf87b93b5e856a1fd15f73518850c1 100644 --- a/openair3/GTPV1-U/gtpv1u_gNB.c +++ b/openair3/GTPV1-U/gtpv1u_gNB.c @@ -52,6 +52,9 @@ #undef GTP_DUMP_SOCKET +#undef GTPV1U_BEARER_OFFSET +#define GTPV1U_BEARER_OFFSET 1 + extern unsigned char NB_eNB_INST; extern RAN_CONTEXT_t RC; @@ -309,6 +312,106 @@ void *gtpv1u_gNB_task(void *args) { return NULL; } +/* Callback called when a gtpv1u message arrived on UDP interface */ +NwGtpv1uRcT nr_gtpv1u_gNB_process_stack_req( + NwGtpv1uUlpHandleT hUlp, + NwGtpv1uUlpApiT *pUlpApi) { + boolean_t result = FALSE; + teid_t teid = 0; + hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; + nr_gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; + protocol_ctxt_t ctxt; + NwGtpv1uRcT rc; + + switch(pUlpApi->apiType) { + /* Here there are two type of messages handled: + * - T-PDU + * - END-MARKER + */ + case NW_GTPV1U_ULP_API_RECV_TPDU: { + uint8_t buffer[4096]; + uint32_t buffer_len; + //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; + + if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg, + buffer, &buffer_len)) { + LOG_E(GTPU, "Error while retrieving T-PDU"); + } + + itti_free(TASK_UDP, ((NwGtpv1uMsgT *)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf); +#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 + gtpv1u_eNB_write_dump_socket(buffer,buffer_len); +#endif + rc = nwGtpv1uMsgDelete(RC.nr_gtpv1u_data_g->gtpv1u_stack, + pUlpApi->apiInfo.recvMsgInfo.hMsg); + + if (rc != NW_GTPV1U_OK) { + LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); + } + + hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->teid_mapping, teid, (void **)>pv1u_teid_data_p); + + if (hash_rc == HASH_TABLE_OK) { +// #if defined(LOG_GTPU) && LOG_GTPU > 0 + LOG_D(GTPU, "Received T-PDU from gtpv1u stack teid %u size %d -> gnb module id %u ue module id %u pdu session id %u\n", + teid, + buffer_len, + gtpv1u_teid_data_p->gnb_id, + gtpv1u_teid_data_p->ue_id, + gtpv1u_teid_data_p->pdu_session_id); +// #endif + //warning "LG eps bearer mapping to DRB id to do (offset -4)" + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gtpv1u_teid_data_p->gnb_id, GNB_FLAG_YES, gtpv1u_teid_data_p->ue_id, 0, 0,gtpv1u_teid_data_p->gnb_id); + // MSC_LOG_TX_MESSAGE( + // MSC_GTPU_ENB, + // MSC_PDCP_ENB, + // NULL,0, + // MSC_AS_TIME_FMT" DATA-REQ rb %u size %u", + // 0,0, + // (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, + // buffer_len); + + result = pdcp_data_req( + &ctxt, + SRB_FLAG_NO, + 1, + 0, // mui + SDU_CONFIRM_NO, // confirm + buffer_len, + buffer, + PDCP_TRANSMISSION_MODE_DATA,NULL, NULL + ); + + if ( result == FALSE ) { + if (ctxt.configured == FALSE ) + LOG_W(GTPU, "gNB node PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ; + else + LOG_W(GTPU, "PDCP data request failed\n"); + + return NW_GTPV1U_FAILURE; + } + } else { + LOG_W(GTPU, "Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len); + } + } + break; + + default: { + LOG_E(GTPU, "Received undefined UlpApi (%02x) from gtpv1u stack!\n", + pUlpApi->apiType); + } + } // end of switch + + return NW_GTPV1U_OK; +} + int nr_gtpv1u_gNB_init(void) { NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; NwGtpv1uUlpEntityT ulp; @@ -344,7 +447,7 @@ int nr_gtpv1u_gNB_init(void) { /* Set the ULP API callback. Called once message have been processed by the * nw-gtpv1u stack. */ - ulp.ulpReqCallback = gtpv1u_gNB_process_stack_req; + ulp.ulpReqCallback = nr_gtpv1u_gNB_process_stack_req; memset((void *)&(ulp.hUlp), 0, sizeof(NwGtpv1uUlpHandleT)); if ((rc = nwGtpv1uSetUlpEntity(RC.nr_gtpv1u_data_g->gtpv1u_stack, &ulp)) != NW_GTPV1U_OK) { @@ -751,6 +854,79 @@ static int gtpv1u_ng_req( return 0; } +static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_data_req) { + gtpv1u_gnb_tunnel_data_req_t *data_req_p = NULL; + NwGtpv1uUlpApiT stack_req; + NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; + hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; + nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; + teid_t gnb_ngu_teid = 0; + teid_t upf_ngu_teid = 0; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_IN); + data_req_p = gnb_tunnel_data_req; + + memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); + hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)>pv1u_ue_data_p); + + if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { + LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); + } else { + if ((data_req_p->pdusession_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->pdusession_id < max_val_NR_DRB_Identity)) { + gnb_ngu_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB; + upf_ngu_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf; + stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; + stack_req.apiInfo.sendtoInfo.teid = upf_ngu_teid; + stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip_addr; + rc = nwGtpv1uGpduMsgNew( + RC.nr_gtpv1u_data_g->gtpv1u_stack, + upf_ngu_teid, + NW_FALSE, + RC.nr_gtpv1u_data_g->seq_num++, + data_req_p->buffer, + data_req_p->length, + data_req_p->offset, + &(stack_req.apiInfo.sendtoInfo.hMsg)); + + if (rc != NW_GTPV1U_OK) { + LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); + MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u", + gnb_ngu_teid,upf_ngu_teid,data_req_p->length); + (void)gnb_ngu_teid; /* avoid gcc warning "set but not used" */ + } else { + rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req); + + if (rc != NW_GTPV1U_OK) { + LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); + MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u", + gnb_ngu_teid,upf_ngu_teid,data_req_p->length); + } else { + MSC_LOG_TX_MESSAGE( + MSC_GTPU_GNB, + MSC_GTPU_SGW, + NULL, + 0, + MSC_AS_TIME_FMT" G-PDU ltid %u rtid %u size %u", + 0,0, + gnb_ngu_teid, + upf_ngu_teid, + data_req_p->length); + } + + rc = nwGtpv1uMsgDelete(RC.nr_gtpv1u_data_g->gtpv1u_stack, + stack_req.apiInfo.sendtoInfo.hMsg); + + if (rc != NW_GTPV1U_OK) { + LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); + } + } + } + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT); + /* Buffer still needed, do not free it */ + //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), data_req_p->buffer); +} + //----------------------------------------------------------------------------- void *gtpv1u_gNB_process_itti_msg(void *notUsed) { /* Trying to fetch a message from the message queue. @@ -774,6 +950,24 @@ void *gtpv1u_gNB_process_itti_msg(void *notUsed) { gtpv1u_delete_ngu_tunnel(instance, &received_message_p->ittiMsg.NRGtpv1uDeleteTunnelReq); break; + // DATA COMING FROM UDP + case UDP_DATA_IND: { + udp_data_ind_t *udp_data_ind_p; + udp_data_ind_p = &received_message_p->ittiMsg.udp_data_ind; + nwGtpv1uProcessUdpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, + udp_data_ind_p->buffer, + udp_data_ind_p->buffer_length, + udp_data_ind_p->peer_port, + udp_data_ind_p->peer_address); + } + break; + + // DATA TO BE SENT TO UDP + case GTPV1U_GNB_TUNNEL_DATA_REQ: + LOG_I(GTPU, "Received message %s\n", ITTI_MSG_NAME(received_message_p)); + gtpv1u_gnb_tunnel_data_req(>PV1U_GNB_TUNNEL_DATA_REQ(received_message_p)); + break; + case TERMINATE_MESSAGE: { if (RC.nr_gtpv1u_data_g->ue_mapping != NULL) { hashtable_destroy (&(RC.nr_gtpv1u_data_g->ue_mapping)); diff --git a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c index 0c7663921b71dbd85c74323715c30ab19b316995..5479e176eb4b8aa0d62156044121519edbfc336f 100644 --- a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c +++ b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c @@ -59,6 +59,7 @@ extern "C" { #endif +#define LOG_GTPU 1 /*--------------------------------------------------------------------------* * P R I V A T E F U N C T I O N S * *--------------------------------------------------------------------------*/ diff --git a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c b/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c index bc4d34d6503cf42d080e64f65f579fff508d3af1..1c9198b7204689cbc2288da98ec07628f4379362 100644 --- a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c +++ b/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c @@ -54,6 +54,8 @@ int encode_pdu_session_establishment_request(pdu_session_establishment_request_m encoded++; IES_ENCODE_U16(buffer, encoded, pdusessionestablishrequest->maxdatarate); + *(buffer + encoded) = pdusessionestablishrequest->pdusessiontype; + encoded++; return encoded; } diff --git a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h b/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h index ac5b250f66d5c158b5d457d5fea8b8b040e2599f..e2742ebc386c6e077531f259f0a34ee36d0dea9f 100644 --- a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h +++ b/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h @@ -53,6 +53,7 @@ typedef struct pdu_session_establishment_request_msg_tag { uint8_t pti; MessageType pdusessionestblishmsgtype; uint16_t maxdatarate; + uint8_t pdusessiontype; /* Optional fields */ } pdu_session_establishment_request_msg; diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 2c07de8dd5abfea1d460c0f0b09d5d672a724f80..d86209177681e60e3e49ff5cee978063b02d7b1c 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -38,12 +38,22 @@ #include "aka_functions.h" #include "secu_defs.h" #include "PduSessionEstablishRequest.h" -char netName[] = "5G:mnc093.mcc208.3gppnetwork.org"; +# include "intertask_interface.h" + +/*char netName[] = "5G:mnc093.mcc208.3gppnetwork.org"; char imsi[] = "2089300007487"; // USIM_API_K: 5122250214c33e723a5dd523fc145fc0 uint8_t k[16] = {0x51, 0x22, 0x25, 0x02, 0x14,0xc3, 0x3e, 0x72, 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0}; // OPC: 981d464c7c52eb6e5036234984ad0bcf -const uint8_t opc[16] = {0x98, 0x1d, 0x46, 0x4c,0x7c,0x52,0xeb, 0x6e, 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf}; +const uint8_t opc[16] = {0x98, 0x1d, 0x46, 0x4c,0x7c,0x52,0xeb, 0x6e, 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf};*/ + + +char netName[] = "5G:mnc099.mcc208.3gppnetwork.org"; +char imsi[] = "2089900007487"; //"208990100001100"; +// USIM_API_K: fe c8 6b a6 eb 70 7e d0 89 05 75 7b 1b b4 4b 8f +uint8_t k[16] = {0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0, 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f}; +// OPC: c4 24 49 36 3b ba d0 2b 66 d1 6b c9 75 d7 7c c1 +const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0xd1, 0x6b, 0xc9, 0x75, 0xd7, 0x7c, 0xc1}; uint8_t *registration_request_buf; uint32_t registration_request_len; @@ -273,14 +283,14 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) { mm_msg->registration_request.fgsregistrationtype = INITIAL_REGISTRATION; mm_msg->registration_request.naskeysetidentifier.naskeysetidentifier = 1; size += 1; - if(1){ + if(0){ mm_msg->registration_request.fgsmobileidentity.guti.typeofidentity = FGS_MOBILE_IDENTITY_5G_GUTI; mm_msg->registration_request.fgsmobileidentity.guti.amfregionid = 0xca; mm_msg->registration_request.fgsmobileidentity.guti.amfpointer = 0; mm_msg->registration_request.fgsmobileidentity.guti.amfsetid = 1016; mm_msg->registration_request.fgsmobileidentity.guti.tmsi = 10; mm_msg->registration_request.fgsmobileidentity.guti.mncdigit1 = 9; - mm_msg->registration_request.fgsmobileidentity.guti.mncdigit2 = 3; + mm_msg->registration_request.fgsmobileidentity.guti.mncdigit2 = 9; mm_msg->registration_request.fgsmobileidentity.guti.mncdigit3 = 0xf; mm_msg->registration_request.fgsmobileidentity.guti.mccdigit1 = 2; mm_msg->registration_request.fgsmobileidentity.guti.mccdigit2 = 0; @@ -291,7 +301,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) { } else { mm_msg->registration_request.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI; mm_msg->registration_request.fgsmobileidentity.suci.mncdigit1 = 9; - mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = 3; + mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = 9; mm_msg->registration_request.fgsmobileidentity.suci.mncdigit3 = 0xf; mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = 2; mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = 0; @@ -348,7 +358,7 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype if(identitytype == FGS_MOBILE_IDENTITY_SUCI){ mm_msg->fgs_identity_response.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI; mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit1 = 9; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit2 = 3; + mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit2 = 9; mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit3 = 0xf; mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit1 = 2; mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit2 = 0; @@ -612,14 +622,15 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ memset(&nas_msg, 0, sizeof(fgs_nas_message_t)); // setup pdu session establishment request - uint16_t req_length = 6; + uint16_t req_length = 7; uint8_t *req_buffer = malloc(req_length); pdu_session_establishment_request_msg pdu_session_establish; pdu_session_establish.protocoldiscriminator = FGS_SESSION_MANAGEMENT_MESSAGE; pdu_session_establish.pdusessionid = 10; - pdu_session_establish.pti = 0; + pdu_session_establish.pti = 1; pdu_session_establish.pdusessionestblishmsgtype = FGS_PDU_SESSION_ESTABLISHMENT_REQ; pdu_session_establish.maxdatarate = 0xffff; + pdu_session_establish.pdusessiontype = 0x91; encode_pdu_session_establishment_request(&pdu_session_establish, req_buffer); @@ -627,9 +638,8 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ MM_msg *mm_msg; nas_stream_cipher_t stream_cipher; uint8_t mac[4]; - uint8_t nssai[]={1,1,2,3}; - uint8_t dnn[9]={0x8,0x69,0x6e,0x74,0x65,0x72,0x6e,0x65,0x74}; - // set security protected header + uint8_t nssai[]={1,0,0,1}; //Corresponding to SST:1, SD:1 + uint8_t dnn[4]={0x4,0x6f,0x61,0x69}; //Corresponding to dnn:"oai" nas_msg.header.protocol_discriminator = FGS_MOBILITY_MANAGEMENT_MESSAGE; nas_msg.header.security_header_type = INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX; size += 7; @@ -661,9 +671,9 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ mm_msg->uplink_nas_transport.snssai.length = 4; mm_msg->uplink_nas_transport.snssai.value = nssai; size += (1+1+4); - mm_msg->uplink_nas_transport.dnn.length = 9; + mm_msg->uplink_nas_transport.dnn.length = 4; mm_msg->uplink_nas_transport.dnn.value = dnn; - size += (1+1+9); + size += (1+1+4); // encode the message initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); @@ -690,3 +700,199 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ initialNasMsg->data[2+i] = mac[i]; } } + +void *nas_nrue_task(void *args_p) +{ + MessageDef *msg_p; + instance_t instance; + unsigned int Mod_id; + int result; + uint8_t msg_type = 0; + uint8_t *pdu_buffer = NULL; + + itti_mark_task_ready (TASK_NAS_NRUE); + MSC_START_USE(); + + while(1) { + // Wait for a message or an event + itti_receive_msg (TASK_NAS_NRUE, &msg_p); + + if (msg_p != NULL) { + instance = msg_p->ittiMsgHeader.originInstance; + Mod_id = instance ; + if (instance == INSTANCE_DEFAULT) { + printf("%s:%d: FATAL: instance is INSTANCE_DEFAULT, should not happen.\n", + __FILE__, __LINE__); + exit_fun("exit... \n"); + } + + switch (ITTI_MSG_ID(msg_p)) { + case INITIALIZE_MESSAGE: + LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p)); + + break; + + case TERMINATE_MESSAGE: + itti_exit_task (); + break; + + case MESSAGE_TEST: + LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p)); + break; + + case NAS_CELL_SELECTION_CNF: + LOG_I(NAS, "[UE %d] Received %s: errCode %u, cellID %u, tac %u\n", Mod_id, ITTI_MSG_NAME (msg_p), + NAS_CELL_SELECTION_CNF (msg_p).errCode, NAS_CELL_SELECTION_CNF (msg_p).cellID, NAS_CELL_SELECTION_CNF (msg_p).tac); + // as_stmsi_t s_tmsi={0, 0}; + // as_nas_info_t nas_info; + // plmn_t plmnID={0, 0, 0, 0}; + // generateRegistrationRequest(&nas_info); + // nr_nas_itti_nas_establish_req(0, AS_TYPE_ORIGINATING_SIGNAL, s_tmsi, plmnID, nas_info.data, nas_info.length, 0); + break; + + case NAS_CELL_SELECTION_IND: + LOG_I(NAS, "[UE %d] Received %s: cellID %u, tac %u\n", Mod_id, ITTI_MSG_NAME (msg_p), + NAS_CELL_SELECTION_IND (msg_p).cellID, NAS_CELL_SELECTION_IND (msg_p).tac); + + /* TODO not processed by NAS currently */ + break; + + case NAS_PAGING_IND: + LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, ITTI_MSG_NAME (msg_p), + NAS_PAGING_IND (msg_p).cause); + + /* TODO not processed by NAS currently */ + break; + + case NAS_CONN_ESTABLI_CNF: + { + LOG_I(NAS, "[UE %d] Received %s: errCode %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p), + NAS_CONN_ESTABLI_CNF (msg_p).errCode, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); + + pdu_buffer = NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data; + if((pdu_buffer + 1) != NULL){ + if (*(pdu_buffer + 1) > 0 ) { + if((pdu_buffer + 9) != NULL){ + msg_type = *(pdu_buffer + 9); + } else { + LOG_W(NAS, "[UE] Received invalid downlink message\n"); + break; + } + } else { + if((pdu_buffer + 2) != NULL){ + msg_type = *(pdu_buffer + 2); + } else { + LOG_W(NAS, "[UE] Received invalid downlink message\n"); + break; + } + } + } + if(msg_type == REGISTRATION_ACCEPT){ + LOG_I(NAS, "[UE] Received REGISTRATION ACCEPT message\n"); + + as_nas_info_t initialNasMsg; + memset(&initialNasMsg, 0, sizeof(as_nas_info_t)); + generateRegistrationComplete(&initialNasMsg, NULL); + if(initialNasMsg.length > 0){ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ); + NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length; + itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); + LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message(RegistrationComplete)\n"); + } + + as_nas_info_t pduEstablishMsg; + memset(&pduEstablishMsg, 0, sizeof(as_nas_info_t)); + generatePduSessionEstablishRequest(&pduEstablishMsg); + if(pduEstablishMsg.length > 0){ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ); + NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)pduEstablishMsg.data; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = pduEstablishMsg.length; + itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); + LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message(PduSessionEstablishRequest)\n"); + } + } + + break; + } + + case NAS_CONN_RELEASE_IND: + LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, ITTI_MSG_NAME (msg_p), + NAS_CONN_RELEASE_IND (msg_p).cause); + + break; + + case NAS_UPLINK_DATA_CNF: + LOG_I(NAS, "[UE %d] Received %s: UEid %u, errCode %u\n", Mod_id, ITTI_MSG_NAME (msg_p), + NAS_UPLINK_DATA_CNF (msg_p).UEid, NAS_UPLINK_DATA_CNF (msg_p).errCode); + + break; + + case NAS_DOWNLINK_DATA_IND: + { + LOG_I(NAS, "[UE %d] Received %s: UEid %u, length %u , buffer %p\n", Mod_id, + ITTI_MSG_NAME (msg_p), + Mod_id, + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length, + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data); + as_nas_info_t initialNasMsg; + memset(&initialNasMsg, 0, sizeof(as_nas_info_t)); + + pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data; + if((pdu_buffer + 1) != NULL){ + if (*(pdu_buffer + 1) > 0 ) { + msg_type = *(pdu_buffer + 9); + } else { + msg_type = *(pdu_buffer + 2); + } + } + if((pdu_buffer + 2) == NULL){ + LOG_W(NAS, "[UE] Received invalid downlink message\n"); + return 0; + } + + switch(msg_type){ + case FGS_IDENTITY_REQUEST: + generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3)); + break; + case FGS_AUTHENTICATION_REQUEST: + generateAuthenticationResp(&initialNasMsg, pdu_buffer); + break; + case FGS_SECURITY_MODE_COMMAND: + generateSecurityModeComplete(&initialNasMsg); + break; + default: + LOG_W(NR_RRC,"unknow message type %d\n",msg_type); + break; + } + + if(initialNasMsg.length > 0){ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ); + NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length; + itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); + LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message\n"); + } + + break; + } + + default: + LOG_E(NAS, "[UE %d] Received unexpected message %s\n", Mod_id, ITTI_MSG_NAME (msg_p)); + break; + } + + result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + msg_p = NULL; + } + } + + return NULL; +} diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.h b/openair3/NAS/NR_UE/nr_nas_msg_sim.h index fef4671f434706aae3f828c1111c828de93557ec..2f123a6f04822605d18b5d721947c164c9c80460 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.h +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.h @@ -120,6 +120,7 @@ void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf); void generateSecurityModeComplete(as_nas_info_t *initialNasMsg); void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer); void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg); +void *nas_nrue_task(void *args_p); #endif /* __NR_NAS_MSG_SIM_H__*/ diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index 178f21a44a12fd54d47822d5df6d3978a7f554c1..be887623bb56e49abaa0b17114c6032e67a1f260 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -33,6 +33,7 @@ # include "memory.h" #include "nas_user.h" +#include <common/utils/msc/msc.h> // FIXME make command line option for NAS_UE_AUTOSTART # define NAS_UE_AUTOSTART 1 diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index f0302a88c77a135fc94257940a9a9a1a749bbd65..6803adb0dda43fface7944d7d9ac93dd106df38f 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -144,7 +144,6 @@ extern int asn1_xer_print; if (ie == NULL ) { \ NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\ } \ - if (mandatory) DevAssert(ie != NULL); \ } while(0) /** \brief Function callback prototype. **/ diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index f143002537a723219a3dcf046734a39b3944ea62..e398f8fa3e1c39d0e5ac5a9d18ce57c766c794ef 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -1061,12 +1061,31 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_ProtocolIE_ID_id_AllowedNSSAI, true); - if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ + //if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL; - NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); - DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0); - DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs); + NGAP_WARN("AllowedNSSAI.list.count %d\n", ie != NULL ? ie->value.choice.AllowedNSSAI.list.count : 2); + //NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); + //DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0); + //DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs); + + if (ie == NULL) { + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = 2; + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sST = 01; + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD_flag = 1; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD[0] = 01; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD[1] = 02; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD[2] = 03; + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sST = 01; + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD_flag = 1; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[0] = 00;//11; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[1] = 00;//22; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[2] = 01;//33; + } else { NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count; @@ -1082,9 +1101,10 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[2] = allow_nssai_item_p->s_NSSAI.sD->buf[2]; } } - } else {/* ie != NULL */ - return -1; - } + } + //} else {/* ie != NULL */ + // return -1; + //} /* id-UESecurityCapabilities */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 37110726820c4a11ac10187cf068f9ff27e5d2a0..6b6164358837893ab60649259c40541eeb9c4ece 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -932,7 +932,7 @@ int ngap_gNB_ue_capabilities(instance_t instance, /* mandatory */ ie = (NGAP_UERadioCapabilityInfoIndicationIEs_t *)calloc(1, sizeof(NGAP_UERadioCapabilityInfoIndicationIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_UERadioCapability; - ie->criticality = NGAP_Criticality_reject; + ie->criticality = NGAP_Criticality_ignore; ie->value.present = NGAP_UERadioCapabilityInfoIndicationIEs__value_PR_UERadioCapability; ie->value.choice.UERadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer; ie->value.choice.UERadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e4d3945469d96f7c450fc6d5ffdbf983200a0da4 --- /dev/null +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -0,0 +1,810 @@ +#include <map> +using namespace std; + +#ifdef __cplusplus +extern "C" { +#endif +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <sys/types.h> +#include <netdb.h> + +#include <openair2/COMMON/platform_types.h> +#include <openair3/UTILS/conversions.h> +#include "common/utils/LOG/log.h" +#include <common/utils/ocp_itti/intertask_interface.h> +#include <openair2/COMMON/gtpv1_u_messages_types.h> +#include <openair3/ocp-gtpu/gtp_itf.h> +#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h> +//#include <openair1/PHY/phy_extern.h> + +#pragma pack(1) + +typedef struct Gtpv1uMsgHeader { + uint8_t PN:1; + uint8_t S:1; + uint8_t E:1; + uint8_t spare:1; + uint8_t PT:1; + uint8_t version:3; + uint8_t msgType; + uint16_t msgLength; + teid_t teid; +} __attribute__((packed)) Gtpv1uMsgHeaderT; + +#pragma pack() + +// TS 29.060, table 7.1 defines the possible message types +// here are all the possible messages (3GPP R16) +#define GTP_ECHO_REQ (1) +#define GTP_ECHO_RSP (2) +#define GTP_ERROR_INDICATION (26) +#define GTP_SUPPORTED_EXTENSION_HEADER_INDICATION (31) +#define GTP_END_MARKER (254) +#define GTP_GPDU (255) + + +typedef struct ocp_gtpv1u_bearer_s { + /* TEID used in dl and ul */ + teid_t teid_incoming; ///< eNB TEID + teid_t teid_outgoing; ///< Remote TEID + in_addr_t outgoing_ip_addr; + struct in6_addr outgoing_ip6_addr; + tcp_udp_port_t outgoing_port; + uint16_t seqNum; + uint8_t npduNum; +} ocp_gtpv1u_bearer_t; + +typedef struct { + map<int, ocp_gtpv1u_bearer_t> bearers; +} teidData_t; + +typedef struct { + rnti_t rnti; + ebi_t rb_id; + gtpCallback callBack; +} rntiData_t; + +class gtpEndPoint { + public: + openAddr_t addr; + uint8_t foundAddr[20]; + int foundAddrLen; + int ipVersion; + map<int,teidData_t> ue2te_mapping; + map<int,rntiData_t> te2ue_mapping; +}; + +class gtpEndPoints { + public: + pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER; + // the instance id will be the Linux socket handler, as this is uniq + map<int, gtpEndPoint> instances; +}; + +gtpEndPoints globGtp; + + // note TEid 0 is reserved for specific usage: echo req/resp, error and supported extensions +static uint32_t gtpv1uNewTeid(void) { +#ifdef GTPV1U_LINEAR_TEID_ALLOCATION + g_gtpv1u_teid = g_gtpv1u_teid + 1; + return g_gtpv1u_teid; +#else + return random() + random() % (RAND_MAX - 1) + 1; +#endif +} + +int legacyInstanceMapping=0; +#define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) + +#define GTPV1U_HEADER_SIZE (8) +static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, teid_t teid, uint8_t *Msg,int msgLen, + bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) { + AssertFatal(extHdrFlag==false,"Not developped"); + int headerAdditional=0; + + if ( seqNumFlag || npduNumFlag || extHdrFlag) + headerAdditional=4; + + uint8_t *buffer; + int fullSize=GTPV1U_HEADER_SIZE+headerAdditional+msgLen; + AssertFatal((buffer=(uint8_t *) malloc(fullSize)) != NULL, ""); + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *)buffer ; + // N should be 0 for us (it was used only in 2G and 3G) + msgHdr->PN=npduNumFlag; + msgHdr->S=seqNumFlag; + msgHdr->E=extHdrFlag; + msgHdr->spare=0; + //PT=0 is for GTP' TS 32.295 (charging) + msgHdr->PT=1; + msgHdr->version=1; + msgHdr->msgType=GTP_GPDU; + msgHdr->msgLength=htons(msgLen); + if ( seqNumFlag || extHdrFlag || npduNumFlag) + msgHdr->msgLength+=4; + msgHdr->teid=htonl(teid); + + if(seqNumFlag || extHdrFlag || npduNumFlag) { + *((uint16_t *) (buffer+8)) = seqNumFlag ? htons(seqNum) : 0x0000; + *((uint8_t *) (buffer+10)) = npduNumFlag ? htons(npduNum) : 0x00; + *((uint8_t *) (buffer+11)) = extHdrFlag ? htons(extHdrType) : 0x00; + } + + memcpy(buffer+GTPV1U_HEADER_SIZE+headerAdditional, Msg, msgLen); + // Fix me: add IPv6 support, using flag ipVersion + static struct sockaddr_in to= {0}; + to.sin_family = AF_INET; + to.sin_port = htons(peerPort); + to.sin_addr.s_addr = peerIp ; + LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); + + if (sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) ) != fullSize ) { + LOG_E(GTPU, + "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u\n", + h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize); + free(buffer); + return GTPNOK; + } + + free(buffer); + return !GTPNOK; +} + +static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) { + uint8_t *buffer=req->buffer+req->offset; + size_t length=req->length; + uint64_t rnti=req->rnti; + int rab_id=req->rab_id; + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto ptrRnti=inst->ue2te_mapping.find(rnti); + + if ( ptrRnti==inst->ue2te_mapping.end() ) { + LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %lx in hashtable ue_mapping\n", rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } + + auto ptr=ptrRnti->second.bearers; + + if ( ptr.find(rab_id) == ptr.end() ) { + LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %lx/%x\n", rnti, rab_id); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } else + LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %lx/%x/%x, len %lu, oldseq %d, oldnum %d\n", + rnti, rab_id,ptr[rab_id].teid_outgoing,length, ptr[rab_id].seqNum,ptr[rab_id].npduNum ); + + if(seqNumFlag) + ptr[rab_id].seqNum++; + + if(npduNumFlag) + ptr[rab_id].npduNum++; + + // We will release the lock, let's copy data before + ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + pthread_mutex_unlock(&globGtp.gtp_lock); + gtpv1uCreateAndSendMsg(compatInst(instance), + tmp.outgoing_ip_addr, + tmp.outgoing_port, + tmp.teid_outgoing, + buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ; +} + +static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req) { + uint64_t rnti=req->rnti; + int rab_id=req->rab_id; + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto ptrRnti=inst->ue2te_mapping.find(rnti); + + if ( ptrRnti==inst->ue2te_mapping.end() ) { + LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %lx in hashtable ue_mapping\n", rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } + + auto ptr=ptrRnti->second.bearers; + + if ( ptr.find(rab_id) == ptr.end() ) { + LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %lx/%x\n", rnti, rab_id); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } else + LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %lx/%x/%x\n", + rnti, rab_id,ptr[rab_id].teid_outgoing); + ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + pthread_mutex_unlock(&globGtp.gtp_lock); + + Gtpv1uMsgHeaderT msgHdr; + // N should be 0 for us (it was used only in 2G and 3G) + msgHdr.PN=0; + msgHdr.S=0; + msgHdr.E=0; + msgHdr.spare=0; + //PT=0 is for GTP' TS 32.295 (charging) + msgHdr.PT=1; + msgHdr.version=1; + msgHdr.msgType=GTP_END_MARKER; + msgHdr.msgLength=htons(0); + msgHdr.teid=htonl(tmp.teid_outgoing); + + // Fix me: add IPv6 support, using flag ipVersion + static struct sockaddr_in to= {0}; + to.sin_family = AF_INET; + to.sin_port = htons(tmp.outgoing_port); + to.sin_addr.s_addr = tmp.outgoing_ip_addr; + LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); + + if (sendto(compatInst(instance), (void *)&msgHdr, sizeof(msgHdr), 0,(struct sockaddr *)&to, sizeof(to) ) != sizeof(msgHdr)) { + LOG_E(GTPU, + "[SD %ld] Failed to send data to " IPV4_ADDR " on port %d, buffer size %lu\n", + compatInst(instance), IPV4_ADDR_FORMAT(tmp.outgoing_ip_addr), tmp.outgoing_port, sizeof(msgHdr)); + } +} + +static int udpServerSocket(openAddr_s addr) { + LOG_I(GTPU, "Initializing UDP for local address %s with port %s\n", addr.originHost, addr.originService); + int status; + struct addrinfo hints= {0}, *servinfo, *p; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + + if ((status = getaddrinfo(addr.originHost, addr.originService, &hints, &servinfo)) != 0) { + LOG_E(GTPU,"getaddrinfo error: %s\n", gai_strerror(status)); + return -1; + } + + int sockfd=-1; + + // loop through all the results and bind to the first we can + for(p = servinfo; p != NULL; p = p->ai_next) { + if ((sockfd = socket(p->ai_family, p->ai_socktype, + p->ai_protocol)) == -1) { + LOG_W(GTPU,"socket: %s\n", strerror(errno)); + continue; + } + + if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) { + close(sockfd); + LOG_W(GTPU,"bind: %s\n", strerror(errno)); + continue; + } else { + // We create the gtp instance on the socket + globGtp.instances[sockfd].addr=addr; + + if (p->ai_family == AF_INET) { + struct sockaddr_in *ipv4=(struct sockaddr_in *)p->ai_addr; + memcpy(globGtp.instances[sockfd].foundAddr, + &ipv4->sin_addr.s_addr, sizeof(ipv4->sin_addr.s_addr)); + globGtp.instances[sockfd].foundAddrLen=sizeof(ipv4->sin_addr.s_addr); + globGtp.instances[sockfd].ipVersion=4; + break; + } else if (p->ai_family == AF_INET6) { + LOG_W(GTPU,"Local address is IP v6\n"); + struct sockaddr_in6 *ipv6=(struct sockaddr_in6 *)p->ai_addr; + memcpy(globGtp.instances[sockfd].foundAddr, + &ipv6->sin6_addr.s6_addr, sizeof(ipv6->sin6_addr.s6_addr)); + globGtp.instances[sockfd].foundAddrLen=sizeof(ipv6->sin6_addr.s6_addr); + globGtp.instances[sockfd].ipVersion=6; + } else + AssertFatal(false,"Local address is not IPv4 or IPv6"); + } + + break; // if we get here, we must have connected successfully + } + + if (p == NULL) { + // looped off the end of the list with no successful bind + LOG_E(GTPU,"failed to bind socket: %s %s \n", addr.originHost, addr.originService); + return -1; + } + + freeaddrinfo(servinfo); // all done with this structure + + if (strlen(addr.destinationHost)>1) { + struct addrinfo hints; + memset(&hints,0,sizeof(hints)); + hints.ai_family=AF_UNSPEC; + hints.ai_socktype=SOCK_DGRAM; + hints.ai_protocol=0; + hints.ai_flags=AI_PASSIVE|AI_ADDRCONFIG; + struct addrinfo *res=0; + int err=getaddrinfo(addr.destinationHost,addr.destinationService,&hints,&res); + + if (err==0) { + for(p = res; p != NULL; p = p->ai_next) { + if ((err=connect(sockfd, p->ai_addr, p->ai_addrlen))==0) + break; + } + } + + if (err) + LOG_E(GTPU,"Can't filter remote host: %s, %s\n", addr.destinationHost,addr.destinationService); + } + + int sendbuff = 1000*1000*10; + AssertFatal(0==setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, sizeof(sendbuff)),""); + LOG_D(GTPU,"Created listener for paquets to: %s:%s, send buffer size: %d\n", addr.originHost, addr.originService,sendbuff); + return sockfd; +} + +instance_t ocp_gtpv1Init(openAddr_t context) { + pthread_mutex_lock(&globGtp.gtp_lock); + int id=udpServerSocket(context); + + if (id>=0) { + itti_subscribe_event_fd(OCP_GTPV1_U, id); + } else + LOG_E(GTPU,"can't create GTP-U instance\n"); + + pthread_mutex_unlock(&globGtp.gtp_lock); + return id; +} + +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid_t teid, transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[instance]; + auto it=inst->ue2te_mapping.find(rnti); + + if ( it != inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Create a config for a already existing GTP tunnel (rnti %x)\n", rnti); + inst->ue2te_mapping.erase(it); + } + + uint32_t s1u_teid=gtpv1uNewTeid(); + + while ( inst->te2ue_mapping.find(s1u_teid) != inst->te2ue_mapping.end() ) { + LOG_W(GTPU, "generated a random Teid that exists, re-generating (%u)\n",s1u_teid); + s1u_teid=gtpv1uNewTeid(); + }; + + inst->te2ue_mapping[s1u_teid].rnti=rnti; + + inst->te2ue_mapping[s1u_teid].rb_id= teid; + + inst->te2ue_mapping[s1u_teid].callBack=callBack; + + auto tmp=&inst->ue2te_mapping[rnti].bearers[bearer_id]; + + int addrs_length_in_bytes = remoteAddr.length / 8; + + switch (addrs_length_in_bytes) { + case 4: + memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4); + break; + + case 16: + memcpy(tmp->outgoing_ip6_addr.s6_addr,remoteAddr.buffer, + 16); + break; + + case 20: + memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4); + memcpy(&tmp->outgoing_ip6_addr.s6_addr, + remoteAddr.buffer+4, + 16); + + default: + AssertFatal(false, "SGW Address size impossible"); + } + + tmp->teid_incoming = s1u_teid; + tmp->outgoing_port=port; + tmp->teid_outgoing= teid; + pthread_mutex_unlock(&globGtp.gtp_lock); + return s1u_teid; +} + +int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { + LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %d\n", + create_tunnel_req->rnti, + create_tunnel_req->num_tunnels, + create_tunnel_req->sgw_S1u_teid[0]); + + for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { + teid_t teid=newGtpuCreateTunnel(compatInst(instance), create_tunnel_req->rnti, + create_tunnel_req->eps_bearer_id[i], + create_tunnel_req->sgw_S1u_teid[i], + create_tunnel_req->sgw_addr[i], 2152, + pdcp_data_req); + create_tunnel_resp->status=0; + create_tunnel_resp->rnti=create_tunnel_req->rnti; + create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; + create_tunnel_resp->enb_S1u_teid[i]=teid; + create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i]; + memcpy(create_tunnel_resp->enb_addr.buffer,globGtp.instances[compatInst(instance)].foundAddr, + globGtp.instances[compatInst(instance)].foundAddrLen); + create_tunnel_resp->enb_addr.length= globGtp.instances[compatInst(instance)].foundAddrLen; + } + + return !GTPNOK; +} + +int ocp_gtpv1u_update_s1u_tunnel( + const instance_t instance, + const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, + const rnti_t prior_rnti +) { + LOG_D(GTPU, "Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %d, eps_bearer_id %d\n", + prior_rnti, + create_tunnel_req->rnti, + create_tunnel_req->num_tunnels, + create_tunnel_req->sgw_S1u_teid[0], + create_tunnel_req->eps_bearer_id[0]); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + + if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) == inst->ue2te_mapping.end() ) { + LOG_E(GTPU,"Update not already existing tunnel (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + } + + auto it=inst->ue2te_mapping.find(prior_rnti); + + if ( it != inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + gtpv1u_enb_create_tunnel_resp_t tmp; + (void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); + return 0; + } + + inst->ue2te_mapping[create_tunnel_req->rnti]=it->second; + inst->ue2te_mapping.erase(it); + pthread_mutex_unlock(&globGtp.gtp_lock); + return 0; +} + + int gtpv1u_create_ngu_tunnel( const instance_t instanceP, + const gtpv1u_gnb_create_tunnel_req_t * const create_tunnel_req_pP, + gtpv1u_gnb_create_tunnel_resp_t * const create_tunnel_resp_pP) { + return !GTPNOK; + } + + int gtpv1u_update_ngu_tunnel( + const instance_t instanceP, + const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, + const rnti_t prior_rnti + ) { + return GTPNOK; + } + +int ocp_gtpv1u_create_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP) { + AssertFatal( false, "to be developped\n"); +} + +int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { + LOG_D(GTPU, "Start delete tunnels for RNTI %x\n", + rnti); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto it=inst->ue2te_mapping.find(rnti); + + if ( it == inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Delete a non existing GTP tunnel\n"); + pthread_mutex_unlock(&globGtp.gtp_lock); + return -1; + } + + for (auto j=it->second.bearers.begin(); + j!=it->second.bearers.end(); + ++j) + inst->te2ue_mapping.erase(j->second.teid_incoming); + + inst->ue2te_mapping.erase(it); + pthread_mutex_unlock(&globGtp.gtp_lock); + return !GTPNOK; +} + +// Legacy delete tunnel finish by deleting all the rnti +// so the list of bearer provided is only a design bug +int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, + const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + return newGtpuDeleteTunnel(instance, req_pP->rnti); +} + + int gtpv1u_delete_x2u_tunnel( const instance_t instanceP, + const gtpv1u_enb_delete_tunnel_req_t * const req_pP, + int enbflag) { + return 0; +} + +static int Gtpv1uHandleEchoReq(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + +static int Gtpv1uHandleError(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + +static int Gtpv1uHandleSupportedExt(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + + // When end marker arrives, we notify the client with buffer size = 0 + // The client will likely call "delete tunnel" + // nevertheless we don't take the initiative +static int Gtpv1uHandleEndMarker(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; + if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { + LOG_E(GTPU, "Received a packet that is not GTP header\n"); + return GTPNOK; + } + + pthread_mutex_lock(&globGtp.gtp_lock); + // the socket Linux file handler is the instance id + auto inst=&globGtp.instances[h]; + auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); + + if ( tunnel == inst->te2ue_mapping.end() ) { + LOG_E(GTPU,"Received a incoming packet on unknown teid (%d) Dropping!\n", msgHdr->teid); + pthread_mutex_unlock(&globGtp.gtp_lock); + return GTPNOK; + } + // This context is not good for gtp + // frame, ... has no meaning + // manyother attributes may come from create tunnel + protocol_ctxt_t ctxt; + ctxt.module_id = 0; + ctxt.enb_flag = 1; + ctxt.instance = inst->addr.originInstance; + ctxt.rnti = tunnel->second.rnti; + ctxt.frame = 0; + ctxt.subframe = 0; + ctxt.eNB_index = 0; + ctxt.configured = 0; + ctxt.brOption = 0; + const srb_flag_t srb_flag=SRB_FLAG_NO; + const rb_id_t rb_id=tunnel->second.rb_id; + const mui_t mui=RLC_MUI_UNDEFINED; + const confirm_t confirm=RLC_SDU_CONFIRM_NO; + const pdcp_transmission_mode_t mode=PDCP_TRANSMISSION_MODE_DATA; + const uint32_t sourceL2Id=0; + const uint32_t destinationL2Id=0; + pthread_mutex_unlock(&globGtp.gtp_lock); + + if ( !tunnel->second.callBack(&ctxt, + srb_flag, + rb_id, + mui, + confirm, + 0, + NULL, + mode, + &sourceL2Id, + &destinationL2Id) ) + LOG_E(GTPU,"down layer refused incoming packet\n"); + + LOG_D(GTPU,"Received END marker packet for: teid:%x\n", ntohl(msgHdr->teid)); + return !GTPNOK; +} + +static int Gtpv1uHandleGpdu(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; + + if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { + LOG_E(GTPU, "Received a packet that is not GTP header\n"); + return GTPNOK; + } + + pthread_mutex_lock(&globGtp.gtp_lock); + // the socket Linux file handler is the instance id + auto inst=&globGtp.instances[h]; + auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); + + if ( tunnel == inst->te2ue_mapping.end() ) { + LOG_E(GTPU,"Received a incoming packet on unknown teid (%d) Dropping!\n", msgHdr->teid); + pthread_mutex_unlock(&globGtp.gtp_lock); + return GTPNOK; + } + + int offset=8; + + if( msgHdr->E || msgHdr->S ||msgHdr->PN) + offset+=4; + + // This context is not good for gtp + // frame, ... has no meaning + // manyother attributes may come from create tunnel + protocol_ctxt_t ctxt; + ctxt.module_id = 0; + ctxt.enb_flag = 1; + ctxt.instance = inst->addr.originInstance; + ctxt.rnti = tunnel->second.rnti; + ctxt.frame = 0; + ctxt.subframe = 0; + ctxt.eNB_index = 0; + ctxt.configured = 0; + ctxt.brOption = 0; + const srb_flag_t srb_flag=SRB_FLAG_NO; + const rb_id_t rb_id=tunnel->second.rb_id; + const mui_t mui=RLC_MUI_UNDEFINED; + const confirm_t confirm=RLC_SDU_CONFIRM_NO; + const sdu_size_t sdu_buffer_size=msgBufLen-offset; + unsigned char *const sdu_buffer=msgBuf+offset; + const pdcp_transmission_mode_t mode=PDCP_TRANSMISSION_MODE_DATA; + const uint32_t sourceL2Id=0; + const uint32_t destinationL2Id=0; + pthread_mutex_unlock(&globGtp.gtp_lock); + + if ( !tunnel->second.callBack(&ctxt, + srb_flag, + rb_id, + mui, + confirm, + sdu_buffer_size, + sdu_buffer, + mode, + &sourceL2Id, + &destinationL2Id) ) + LOG_E(GTPU,"down layer refused incoming packet\n"); + + LOG_D(GTPU,"Received a %d bytes packet for: teid:%x\n", + msgBufLen-offset, + ntohl(msgHdr->teid)); + return !GTPNOK; +} + +void gtpv1uReceiver(int h) { + uint8_t udpData[65536]; + int udpDataLen; + socklen_t from_len; + struct sockaddr_in addr; + from_len = (socklen_t)sizeof(struct sockaddr_in); + + if ((udpDataLen = recvfrom(h, udpData, sizeof(udpData), 0, + (struct sockaddr *)&addr, &from_len)) < 0) { + LOG_E(GTPU, "Recvfrom failed on %d (%s)\n", h, strerror(errno)); + return; + } else if (udpDataLen == 0) { + LOG_W(GTPU, "Recvfrom returned 0\n"); + return; + } else { + uint8_t msgType = *((uint8_t *)(udpData + 1)); + LOG_D(GTPU, "Received GTP data, msg type: %x\n", msgType); + + switch(msgType) { + case GTP_ECHO_RSP: + break; + + case GTP_ECHO_REQ: + Gtpv1uHandleEchoReq( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_ERROR_INDICATION: + Gtpv1uHandleError( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_SUPPORTED_EXTENSION_HEADER_INDICATION: + Gtpv1uHandleSupportedExt( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_END_MARKER: + Gtpv1uHandleEndMarker( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_GPDU: + Gtpv1uHandleGpdu( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + default: + LOG_E(GTPU, "Received a GTP packet of unknown type: %d\n",msgType); + break; + } + } +} + +#include <openair2/ENB_APP/enb_paramdef.h> + +void *ocp_gtpv1uTask(void *args) { + while(1) { + /* Trying to fetch a message from the message queue. + If the queue is empty, this function will block till a + message is sent to the task. + */ + MessageDef *message_p = NULL; + itti_receive_msg(OCP_GTPV1_U, &message_p); + + if (message_p != NULL ) { + openAddr_t addr= {0}; + + switch (ITTI_MSG_ID(message_p)) { + // DATA TO BE SENT TO UDP + case GTPV1U_ENB_TUNNEL_DATA_REQ: { + gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), + >PV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false); + itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + } + break; + + case TERMINATE_MESSAGE: + break; + + case TIMER_HAS_EXPIRED: + LOG_E(GTPU, "Received unexpected timer expired (no need of timers in this version) %s\n", ITTI_MSG_NAME(message_p)); + break; + + case GTPV1U_ENB_END_MARKER_REQ: + gtpv1uEndTunnel(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), + >PV1U_ENB_TUNNEL_DATA_REQ(message_p)); + itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + break; + + case GTPV1U_ENB_DATA_FORWARDING_REQ: + case GTPV1U_ENB_DATA_FORWARDING_IND: + case GTPV1U_ENB_END_MARKER_IND: + LOG_E(GTPU, "to be developped %s\n", ITTI_MSG_NAME(message_p)); + abort(); + break; + + case GTPV1U_ENB_S1_REQ: + // to be dev: should be removed, to use API + strcpy(addr.originHost, GTPV1U_ENB_S1_REQ(message_p).addrStr); + strcpy(addr.originService, GTPV1U_ENB_S1_REQ(message_p).portStr); + AssertFatal((legacyInstanceMapping=ocp_gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n"); + break; + + case GTPV1U_GNB_NG_REQ: + // to be dev: should be removed, to use API + strcpy(addr.originHost, GTPV1U_ENB_S1_REQ(message_p).addrStr); + strcpy(addr.originService, GTPV1U_ENB_S1_REQ(message_p).portStr); + AssertFatal((legacyInstanceMapping=ocp_gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n"); + break; + + default: + LOG_E(GTPU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); + abort(); + break; + } + + AssertFatal(EXIT_SUCCESS==itti_free(OCP_GTPV1_U, message_p), "Failed to free memory!\n"); + } + + struct epoll_event *events; + + int nb_events = itti_get_events(OCP_GTPV1_U, &events); + + for (int i = 0; i < nb_events; i++) + if ((events[i].events&EPOLLIN)) + gtpv1uReceiver(events[i].data.fd); + } + + return NULL; +} + +#ifdef __cplusplus +} +#endif diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h new file mode 100644 index 0000000000000000000000000000000000000000..9819ed9485ece5c9e025c3cd63c1670b1fb781e1 --- /dev/null +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -0,0 +1,71 @@ +#ifndef __GTPUNEW_ITF_H__ +#define __GTPUNEW_ITF_H__ +#define GTPNOK -1 + +# define GTPU_HEADER_OVERHEAD_MAX 64 +#ifdef __cplusplus +extern "C" { +#endif + +#include <openair3/GTPV1-U/gtpv1u_eNB_defs.h> +#if defined(NEW_GTPU) +#define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel +#define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel +#define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel +#define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel +#define gtpv1u_eNB_task ocp_gtpv1uTask +#define nr_gtpv1u_gNB_task ocp_gtpv1uTask +#define TASK_VARIABLE OCP_GTPV1_U +#else +#define TASK_VARIABLE TASK_GTPV1_U +#endif + +typedef boolean_t (*gtpCallback)( + protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id); + +typedef struct openAddr_s { + char originHost[HOST_NAME_MAX]; + char originService[HOST_NAME_MAX]; + char destinationHost[HOST_NAME_MAX]; + char destinationService[HOST_NAME_MAX]; + instance_t originInstance; +} openAddr_t; + +// the init function create a gtp instance and return the gtp instance id +// the parameter originInstance will be sent back in each message from gtp to the creator +void ocp_gtpv1uReceiver(int h); +void ocp_gtpv1uProcessTimeout(int handle,void *arg); +int ocp_gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp); +int ocp_gtpv1u_update_s1u_tunnel(const instance_t instanceP, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP, + const rnti_t prior_rnti + ); +int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); +int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); + +int ocp_gtpv1u_create_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); + + +// New API +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid_t teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack); +instance_t ocp_gtpv1Init(openAddr_t context); +void *ocp_gtpv1uTask(void *args); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 93e9ffb52f8d908c5f6da1dbcf56bdd68db50aad..2ab6d29d309a79909c896858f40f9ea469ea0131 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -33,6 +33,7 @@ #ifndef COMMON_LIB_H #define COMMON_LIB_H #include <stdint.h> +#include <stdio.h> #include <sys/types.h> #include <openair1/PHY/TOOLS/tools_defs.h> #include "record_player.h" diff --git a/targets/ARCH/COMMON/record_player.c b/targets/ARCH/COMMON/record_player.c index 2dcd61e47949be1b2311c905e89d62221ffaaf40..522f6b6d166e7aa7a60f28f2e92cd0f28c1772ef 100644 --- a/targets/ARCH/COMMON/record_player.c +++ b/targets/ARCH/COMMON/record_player.c @@ -68,8 +68,10 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ *recplay_conf=NULL; } - if (u_sf_replay == 1) return RECPLAY_REPLAYMODE; - else if (u_sf_record == 1) return RECPLAY_RECORDMODE; + if (u_sf_replay == 1) + return RECPLAY_REPLAYMODE; + else if (u_sf_record == 1) + return RECPLAY_RECORDMODE; return 0; } @@ -80,7 +82,7 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ */ void iqrecorder_end(openair0_device *device) { if (device->recplay_state != NULL) { // subframes store - iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,OAIIQFILE_ID}; + iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID}; recplay_state_t *rs = device->recplay_state; recplay_conf_t *rc = device->openair0_cfg[0].recplay_conf; rs->pFile = fopen (rc->u_sf_filename,"wb+"); @@ -91,16 +93,20 @@ void iqrecorder_end(openair0_device *device) { unsigned int i = 0; unsigned int modu = 0; - if ((modu = rs->nb_samples % 10) != 0) { - rs->nb_samples -= modu; // store entire number of frames + if ((modu = rs->nbSamplesBlocks % 10) != 0) { + rs->nbSamplesBlocks -= modu; // store entire number of frames } + fh.nbSamplesBlocks=rs->nbSamplesBlocks; LOG_I(HW,"Writing file header to %s \n", rc->u_sf_filename ); fwrite(&fh, sizeof(fh), 1, rs->pFile); - LOG_UI(HW,"Writing %u subframes to %s \n",rs->nb_samples, rc->u_sf_filename ); + LOG_UI(HW,"Writing %u subframes to %s \n",rs->nbSamplesBlocks, rc->u_sf_filename ); + uint8_t *ptr=(uint8_t *)rs->ms_sample; - for (i = 0; i < rs->nb_samples; i++) { - fwrite(rs->ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), rs->pFile); + for (i = 0; i < rs->nbSamplesBlocks; i++) { + int blockBytes=sizeof(iqrec_t)+((iqrec_t *)ptr)->nbBytes; + fwrite(ptr, sizeof(unsigned char), blockBytes, rs->pFile); + ptr+=blockBytes; } fclose (rs->pFile); @@ -112,4 +118,4 @@ void iqrecorder_end(openair0_device *device) { rs->ms_sample = NULL; } } -} \ No newline at end of file +} diff --git a/targets/ARCH/COMMON/record_player.h b/targets/ARCH/COMMON/record_player.h index 500acdd709950c167f4513e87b30f65a7f5bb6f7..d91da6832308eb8db2dfa949feb39f44a0eaf030 100644 --- a/targets/ARCH/COMMON/record_player.h +++ b/targets/ARCH/COMMON/record_player.h @@ -46,21 +46,22 @@ extern "C" #define BELL_LABS_IQ_HEADER 0xabababababababab #define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now #define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4) +#define MAX_BELL_LABS_IQ_BYTES_PER_SF BELL_LABS_IQ_BYTES_PER_SF*10 -#define OAIIQFILE_ID "OIQF" +#define OAIIQFILE_ID {'O', 'I','Q','F'} typedef struct { uint64_t devtype; uint64_t tx_sample_advance; double bw; + unsigned int nbSamplesBlocks; char oaiid[4]; } iqfile_header_t; typedef struct { int64_t header; int64_t ts; - int64_t rfu1; + int64_t nbBytes; int64_t rfu2; // pad for 256 bits alignement required by AVX2 - unsigned char samples[BELL_LABS_IQ_BYTES_PER_SF]; // iq's for one subframe } iqrec_t; #define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz) #define DEF_SF_FILE "/tmp/iqfile" // default subframes file name @@ -114,14 +115,16 @@ typedef struct { int use_mmap; // default is to use mmap size_t mapsize; FILE *pFile; - int mmapfd; - int iqfd; + int fd; iqrec_t *ms_sample; // memory for all subframes - unsigned int nb_samples; + unsigned int nbSamplesBlocks; + uint8_t *currentPtr; + uint64_t currentTs; + unsigned int curSamplesBlock; + int64_t wrap_count; + size_t maxSizeBytes; } recplay_state_t; - - #ifdef __cplusplus } #endif diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c index dce410de47e0fb1dcd49dc8258c7d5606e8b26d3..f35a18eb0e52b5f389a41b71ef5c7a11238d697a 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c @@ -42,7 +42,6 @@ #include <unistd.h> #include <errno.h> #include <linux/sysctl.h> -#include <sys/sysctl.h> #include "common_lib.h" #include "ethernet_lib.h" diff --git a/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c b/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c index 88f4ecb4cdebde52d1f8ce2997ad34762c1b5364..9b398e9bd951eb0c70b4c27e902adc2f5703748f 100644 --- a/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c +++ b/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c @@ -312,14 +312,13 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) oai_slot = tx_subframe * 2 + tx_slot; lock_dl_buffer(bs->buffers, oai_slot); if (!(bs->buffers->dl_busy[a][oai_slot] & (1 << tx_symbol))) { - printf("%s: warning, DL underflow (antenna %d sl.symbol %d.%d)\n", __FUNCTION__, - a, oai_slot, tx_symbol); + //printf("%s: warning, DL underflow (antenna %d sl.symbol %d.%d)\n", __FUNCTION__,a, oai_slot, tx_symbol); memset(IQ_ptr, 0, 1272 * 4); } else { memcpy(IQ_ptr, bs->buffers->dl[a][oai_slot] + tx_symbol * 1272*4, 1272*4); } -//printf("DL buffer f sf slot symbol %d %d %d %d (sf %d)\n", tx_frame, tx_subframe, tx_slot, tx_symbol, (int)sf); + //printf("DL buffer f sf slot symbol %d %d %d %d (sf %d)\n", tx_frame, tx_subframe, tx_slot, tx_symbol, (int)sf); bs->buffers->dl_busy[a][oai_slot] &= ~(1 << tx_symbol); unlock_dl_buffer(bs->buffers, oai_slot); } diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index dd29d01fae751ebc527ea59dc1423ed29475150f..c830aeb18e358a0afb9881f18b03fa8720493e2a 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -153,7 +153,7 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) { } static int sync_to_gps(openair0_device *device) { - uhd::set_thread_priority_safe(); + //uhd::set_thread_priority_safe(); //std::string args; //Set up program options //po::options_description desc("Allowed options"); @@ -276,7 +276,7 @@ static int trx_usrp_start(openair0_device *device) { // setup GPIO for TDD, GPIO(4) = ATR_RX //set data direction register (DDR) to output s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff); - //set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually) + //set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually) s->usrp->set_gpio_attr("FP0", "CTRL", 0x7f,0xfff); //set pins 4 (RX_TX_Switch) and 6 (Shutdown PA) to 1 when the radio is only receiving (ATR_RX) s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4)|(1<<6), 0x7f); @@ -301,7 +301,7 @@ static int trx_usrp_start(openair0_device *device) { } uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); - cmd.time_spec = uhd::time_spec_t(1.0); + cmd.time_spec = uhd::time_spec_t(1.0); cmd.stream_now = false; // start at constant delay s->rx_stream->issue_stream_cmd(cmd); @@ -315,7 +315,7 @@ static void trx_usrp_end(openair0_device *device) { return; usrp_state_t *s = (usrp_state_t *)device->priv; - + if (s == NULL) return; iqrecorder_end(device); @@ -436,7 +436,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI buff_ptrs.push_back(&(((int16_t *)buff_tx[i])[0])); ret = (int)s->tx_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); } @@ -480,7 +480,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI @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){ +void *trx_usrp_write_thread(void * arg){ int ret=0; openair0_device *device=(openair0_device *)arg; openair0_thread_t *write_thread = &device->write_thread; @@ -549,7 +549,7 @@ void *trx_usrp_write_thread(void * arg){ } } - + s->tx_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; @@ -572,7 +572,7 @@ void *trx_usrp_write_thread(void * arg){ buff_ptrs.push_back(&(((int16_t *)buff_tx[i])[0])); ret = (int)s->tx_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); } @@ -589,7 +589,7 @@ void *trx_usrp_write_thread(void * arg){ int trx_usrp_write_init(openair0_device *device){ - uhd::set_thread_priority_safe(1.0); + //uhd::set_thread_priority_safe(1.0); openair0_thread_t *write_thread = &device->write_thread; printf("initializing tx write thread\n"); @@ -597,7 +597,8 @@ int trx_usrp_write_init(openair0_device *device){ write_thread->end = 0; write_thread->count_write = 0; printf("end of tx write thread\n"); - + pthread_mutex_init(&write_thread->mutex_write, NULL); + pthread_cond_init(&write_thread->cond_write, NULL); pthread_create(&write_thread->pthread_write,NULL,trx_usrp_write_thread,(void *)device); return(0); @@ -697,15 +698,23 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp s->usrp->set_gpio_attr("FP0", "OUT", gpio789<<7, 0x380); s->usrp->clear_command_time(); gpio789 = (gpio789+1)&7;*/ + recplay_state_t *recPlay=device->recplay_state; - if (device->recplay_state != NULL) { // record mode + if ( recPlay != NULL) { // record mode // Copy subframes to memory (later dump on a file) - if (device->recplay_state->nb_samples < device->openair0_cfg->recplay_conf->u_sf_max) { - (device->recplay_state->ms_sample+device->recplay_state->nb_samples)->header = BELL_LABS_IQ_HEADER; - (device->recplay_state->ms_sample+device->recplay_state->nb_samples)->ts = *ptimestamp; - memcpy((device->recplay_state->ms_sample+device->recplay_state->nb_samples)->samples, buff[0], nsamps*4); - device->recplay_state->nb_samples++; - } else exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n"); + if (recPlay->nbSamplesBlocks < device->openair0_cfg->recplay_conf->u_sf_max && + recPlay->maxSizeBytes > (recPlay->currentPtr-(uint8_t *)recPlay->ms_sample) + + sizeof(iqrec_t) + nsamps*4 ) { + iqrec_t *hdr=(iqrec_t *)recPlay->currentPtr; + hdr->header = BELL_LABS_IQ_HEADER; + hdr->ts = *ptimestamp; + hdr->nbBytes=nsamps*4; + memcpy(hdr+1, buff[0], nsamps*4); + recPlay->currentPtr+=sizeof(iqrec_t)+nsamps*4; + recPlay->nbSamplesBlocks++; + LOG_D(HW,"recorded %d samples, for TS %lu, shift in buffer %ld\n", nsamps, hdr->ts, recPlay->currentPtr-(uint8_t *)recPlay->ms_sample); + } else + exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n"); } return samples_received; @@ -915,8 +924,8 @@ int trx_usrp_reset_stats(openair0_device *device) { extern "C" { int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { - LOG_D(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs); - LOG_D(HW, "openair0_cfg[0].clock_source == '%d'\n", openair0_cfg[0].clock_source); + LOG_I(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs); + LOG_I(HW, "openair0_cfg[0].clock_source == '%d' (internal = %d, external = %d)\n", openair0_cfg[0].clock_source,internal,external); usrp_state_t *s ; if ( device->priv == NULL) { @@ -940,29 +949,29 @@ extern "C" { // hotfix! to be checked later - uhd::set_thread_priority_safe(1.0); + //uhd::set_thread_priority_safe(1.0); // Initialize USRP device int vers=0,subvers=0,subsubvers=0; int bw_gain_adjust=0; - + if (device->openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) { std::cerr << "USRP device initialized in subframes record mode" << std::endl; } - + sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers); LOG_I(HW,"UHD version %s (%d.%d.%d)\n", uhd::get_version_string().c_str(),vers,subvers,subsubvers); std::string args; - + if (openair0_cfg[0].sdr_addrs == NULL) { args = "type=b200"; } else { args = openair0_cfg[0].sdr_addrs; LOG_I(HW,"Checking for USRP with args %s\n",openair0_cfg[0].sdr_addrs); } - + uhd::device_addrs_t device_adds = uhd::device::find(args); - + if (device_adds.size() == 0) { LOG_E(HW,"No USRP Device Found.\n "); free(s); @@ -972,52 +981,52 @@ extern "C" { free(s); return -1; } - + LOG_I(HW,"Found USRP %s\n", device_adds[0].get("type").c_str()); double usrp_master_clock; - + if (device_adds[0].get("type") == "b200") { device->type = USRP_B200_DEV; usrp_master_clock = 30.72e6; args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ; } - + if (device_adds[0].get("type") == "n3xx") { printf("Found USRP n300\n"); - device->type=USRP_N300_DEV; + device->type=USRP_N300_DEV; usrp_master_clock = 122.88e6; args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); //args += ", send_buff_size=33554432"; } - + if (device_adds[0].get("type") == "x300") { printf("Found USRP x300\n"); device->type=USRP_X300_DEV; usrp_master_clock = 184.32e6; args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); - + // USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") ) LOG_W(HW,"Can't set kernel parameters for X3xx\n"); } - + s->usrp = uhd::usrp::multi_usrp::make(args); - + if (args.find("clock_source")==std::string::npos) { if (openair0_cfg[0].clock_source == internal) { s->usrp->set_clock_source("internal"); - LOG_D(HW,"Setting clock source to internal\n"); + LOG_I(HW,"Setting clock source to internal\n"); } else if (openair0_cfg[0].clock_source == external ) { s->usrp->set_clock_source("external"); - LOG_D(HW,"Setting clock source to external\n"); + LOG_I(HW,"Setting clock source to external\n"); } else if (openair0_cfg[0].clock_source==gpsdo) { s->usrp->set_clock_source("gpsdo"); - LOG_D(HW,"Setting clock source to gpsdo\n"); + LOG_I(HW,"Setting clock source to gpsdo\n"); } - else { + else { LOG_W(HW,"Clock source set neither in usrp_args nor on command line, using default!\n"); } } @@ -1030,17 +1039,17 @@ extern "C" { if (args.find("time_source")==std::string::npos) { if (openair0_cfg[0].time_source == internal) { s->usrp->set_time_source("internal"); - LOG_D(HW,"Setting time source to internal\n"); + LOG_I(HW,"Setting time source to internal\n"); } else if (openair0_cfg[0].time_source == external ) { s->usrp->set_time_source("external"); - LOG_D(HW,"Setting time source to external\n"); + LOG_I(HW,"Setting time source to external\n"); } else if (openair0_cfg[0].time_source==gpsdo) { s->usrp->set_time_source("gpsdo"); - LOG_D(HW,"Setting time source to gpsdo\n"); + LOG_I(HW,"Setting time source to gpsdo\n"); } - else { + else { LOG_W(HW,"Time source set neither in usrp_args nor on command line, using default!\n"); } } @@ -1050,10 +1059,10 @@ extern "C" { } } - + if (s->usrp->get_clock_source(0) == "gpsdo") { s->use_gps = 1; - + if (sync_to_gps(device)==EXIT_SUCCESS) { LOG_I(HW,"USRP synced with GPS!\n"); } else { @@ -1068,15 +1077,15 @@ extern "C" { exit(EXIT_FAILURE); } } - + if (device->type==USRP_X300_DEV) { openair0_cfg[0].rx_gain_calib_table = calib_table_x310; - std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; + std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; } if (device->type==USRP_N300_DEV) { openair0_cfg[0].rx_gain_calib_table = calib_table_n310; - std::cerr << "-- Using calibration table: calib_table_n310" << std::endl; + std::cerr << "-- Using calibration table: calib_table_n310" << std::endl; } @@ -1091,7 +1100,7 @@ extern "C" { openair0_cfg[0].tx_bw = 80e6; openair0_cfg[0].rx_bw = 80e6; break; - + case 92160000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1099,7 +1108,7 @@ extern "C" { openair0_cfg[0].tx_bw = 80e6; openair0_cfg[0].rx_bw = 80e6; break; - + case 61440000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1107,14 +1116,14 @@ extern "C" { openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; - + case 46080000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 15; openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; - + case 30720000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1122,35 +1131,35 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 15360000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 45; openair0_cfg[0].tx_bw = 10e6; openair0_cfg[0].rx_bw = 10e6; break; - + case 7680000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 50; openair0_cfg[0].tx_bw = 5e6; openair0_cfg[0].rx_bw = 5e6; break; - + case 1920000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 50; openair0_cfg[0].tx_bw = 1.25e6; openair0_cfg[0].rx_bw = 1.25e6; break; - + default: LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate); exit(-1); break; } } - + if (device->type == USRP_B200_DEV) { if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) { openair0_cfg[0].rx_gain_calib_table = calib_table_b210; @@ -1161,7 +1170,7 @@ extern "C" { bw_gain_adjust=1; std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info } - + switch ((int)openair0_cfg[0].sample_rate) { case 46080000: s->usrp->set_master_clock_rate(46.08e6); @@ -1170,7 +1179,7 @@ extern "C" { openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; - + case 30720000: s->usrp->set_master_clock_rate(30.72e6); //openair0_cfg[0].samples_per_packet = 1024; @@ -1178,7 +1187,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 23040000: s->usrp->set_master_clock_rate(23.04e6); //to be checked //openair0_cfg[0].samples_per_packet = 1024; @@ -1186,7 +1195,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 15360000: s->usrp->set_master_clock_rate(30.72e06); //openair0_cfg[0].samples_per_packet = 1024; @@ -1194,7 +1203,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 7680000: s->usrp->set_master_clock_rate(30.72e6); //openair0_cfg[0].samples_per_packet = 1024; @@ -1202,7 +1211,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 1920000: s->usrp->set_master_clock_rate(30.72e6); //openair0_cfg[0].samples_per_packet = 1024; @@ -1210,20 +1219,20 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + default: LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate); exit(-1); break; } } - + /* device specific */ //openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered //openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered openair0_cfg[0].iq_txshift = 4;//shift openair0_cfg[0].iq_rxrescale = 15;//rescale iqs - + for(int i=0; i<((int) s->usrp->get_rx_num_channels()); i++) { if (i<openair0_cfg[0].rx_num_channels) { s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i); @@ -1240,13 +1249,13 @@ extern "C" { openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],gain_range.stop()); } } - + LOG_D(HW, "usrp->get_tx_num_channels() == %zd\n", s->usrp->get_tx_num_channels()); LOG_D(HW, "openair0_cfg[0].tx_num_channels == %d\n", openair0_cfg[0].tx_num_channels); - + for(int i=0; i<((int) s->usrp->get_tx_num_channels()); i++) { ::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(i); - + if (i<openair0_cfg[0].tx_num_channels) { s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i); s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i); @@ -1254,7 +1263,7 @@ extern "C" { LOG_I(HW,"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf\n", gain_range_tx.stop()-openair0_cfg[0].tx_gain[i], gain_range_tx.stop(), openair0_cfg[0].tx_gain[i]); } } - + //s->usrp->set_clock_source("external"); //s->usrp->set_time_source("external"); // display USRP settings @@ -1268,32 +1277,32 @@ extern "C" { int max=s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps(); samples/=10000; LOG_I(HW,"RF board max packet size %u, size for 100µs jitter %d \n", max, samples); - + if ( samples < max ) { stream_args_rx.args["spp"] = str(boost::format("%d") % samples ); } - + LOG_I(HW,"rx_max_num_samps %zu\n", s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps()); - + for (int i = 0; i<openair0_cfg[0].rx_num_channels; i++) stream_args_rx.channels.push_back(i); - + s->rx_stream = s->usrp->get_rx_stream(stream_args_rx); uhd::stream_args_t stream_args_tx("sc16", "sc16"); - + for (int i = 0; i<openair0_cfg[0].tx_num_channels; i++) stream_args_tx.channels.push_back(i); - + s->tx_stream = s->usrp->get_tx_stream(stream_args_tx); - + /* Setting TX/RX BW after streamers are created due to USRP calibration issue */ for(int i=0; i<((int) s->usrp->get_tx_num_channels()) && i<openair0_cfg[0].tx_num_channels; i++) s->usrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i); - + for(int i=0; i<((int) s->usrp->get_rx_num_channels()) && i<openair0_cfg[0].rx_num_channels; i++) s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i); - + for (int i=0; i<openair0_cfg[0].rx_num_channels; i++) { LOG_I(HW,"RX Channel %d\n",i); LOG_I(HW," Actual RX sample rate: %fMSps...\n",s->usrp->get_rx_rate(i)/1e6); @@ -1302,7 +1311,7 @@ extern "C" { LOG_I(HW," Actual RX bandwidth: %fM...\n", s->usrp->get_rx_bandwidth(i)/1e6); LOG_I(HW," Actual RX antenna: %s...\n", s->usrp->get_rx_antenna(i).c_str()); } - + for (int i=0; i<openair0_cfg[0].tx_num_channels; i++) { LOG_I(HW,"TX Channel %d\n",i); LOG_I(HW," Actual TX sample rate: %fMSps...\n", s->usrp->get_tx_rate(i)/1e6); @@ -1312,33 +1321,35 @@ extern "C" { LOG_I(HW," Actual TX antenna: %s...\n", s->usrp->get_tx_antenna(i).c_str()); LOG_I(HW," Actual TX packet size: %lu\n",s->tx_stream->get_max_num_samps()); } - + LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs()); device->trx_write_func = trx_usrp_write; device->trx_read_func = trx_usrp_read; s->sample_rate = openair0_cfg[0].sample_rate; - + // TODO: // init tx_forward_nsamps based usrp_time_offset ex if(is_equal(s->sample_rate, (double)30.72e6)) s->tx_forward_nsamps = 176; - + if(is_equal(s->sample_rate, (double)15.36e6)) s->tx_forward_nsamps = 90; - + if(is_equal(s->sample_rate, (double)7.68e6)) s->tx_forward_nsamps = 50; - - - if (device->recplay_state != NULL) { // record mode - device->recplay_state->ms_sample = (iqrec_t *) malloc(openair0_cfg[0].recplay_conf->u_sf_max * sizeof(iqrec_t)); - - if (device->recplay_state->ms_sample == NULL) { + + recplay_state_t *recPlay=device->recplay_state; + + if (recPlay != NULL) { // record mode + recPlay->maxSizeBytes=openair0_cfg[0].recplay_conf->u_sf_max * + (sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF); + recPlay->ms_sample = (iqrec_t *) malloc(recPlay->maxSizeBytes); + recPlay->currentPtr= (uint8_t *)recPlay->ms_sample; + + if (recPlay->ms_sample == NULL) { std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl; exit(-1); } - - memset(device->recplay_state->ms_sample, 0, openair0_cfg[0].recplay_conf->u_sf_max * BELL_LABS_IQ_BYTES_PER_SF); } return 0; } diff --git a/targets/ARCH/iqplayer/iqplayer_lib.c b/targets/ARCH/iqplayer/iqplayer_lib.c index c4133d1b11652615f320065b405f65016ba48970..8b6844f9d3f5bfaa2df87ae236cf997ae874ac48 100644 --- a/targets/ARCH/iqplayer/iqplayer_lib.c +++ b/targets/ARCH/iqplayer/iqplayer_lib.c @@ -25,7 +25,6 @@ */ #define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 -#define NB_ANTENNAS_RX 2 #include <string.h> #include <pthread.h> #include <unistd.h> @@ -40,18 +39,15 @@ #include "assertions.h" #include "common/utils/LOG/log.h" - - - - - static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) { - AssertFatal((memcmp(iq_fh->oaiid,OAIIQFILE_ID,sizeof(OAIIQFILE_ID)) == 0), - "iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n", - iq_fh->oaiid); + char tmp[4]=OAIIQFILE_ID; + AssertFatal((memcmp(iq_fh->oaiid,tmp,sizeof(iq_fh->oaiid)) == 0), + "iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n", + iq_fh->oaiid); device->type = iq_fh->devtype; device->openair0_cfg[0].tx_sample_advance=iq_fh->tx_sample_advance; device->openair0_cfg[0].tx_bw = device->openair0_cfg[0].rx_bw = iq_fh->bw; + device->recplay_state->nbSamplesBlocks=iq_fh->nbSamplesBlocks; LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw); } @@ -63,89 +59,73 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair recplay_state_t *s = device->recplay_state; recplay_conf_t *c = openair0_cfg->recplay_conf; + struct stat sb; + s->fd = open(c->u_sf_filename, O_RDONLY ); + if (s->fd >= 0 ) { + fstat(s->fd, &sb); + } else { + LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename ); + exit(-1); + } + if (s->use_mmap) { // use mmap - s->mmapfd = open(c->u_sf_filename, O_RDONLY ); - - if (s->mmapfd != 0) { - struct stat sb; - fstat(s->mmapfd, &sb); s->mapsize=sb.st_size; LOG_I(HW,"Loading subframes using mmap() from %s size=%lu bytes ...\n",c->u_sf_filename, (uint64_t)sb.st_size ); - void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) ; - s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) + sizeof(iqfile_header_t)); + void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) ; + s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) + sizeof(iqfile_header_t)); if (mptr != MAP_FAILED) { parse_iqfile_header(device, (iqfile_header_t *)mptr); s->ms_sample = (iqrec_t *)((char *)mptr + sizeof(iqfile_header_t)); - s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t)) / sizeof(iqrec_t)); - int aligned = (((unsigned long)s->ms_sample & 31) == 0)? 1:0; - LOG_I(HW,"Loaded %u subframes.\n",s->nb_samples ); - - if (aligned == 0) { - LOG_E(HW, "mmap address is not 32 bytes aligned, exiting.\n" ); - close(s->mmapfd); - exit(-1); - } + LOG_I(HW,"Loaded %u subframes.\n",s->nbSamplesBlocks ); } else { LOG_E(HW,"Cannot mmap file, exiting.\n"); - close(s->mmapfd); + close(s->fd); exit(-1); } - } else { - LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename ); - exit(-1); - } } else { - s->iqfd = open(c->u_sf_filename, O_RDONLY); + iqfile_header_t fh; + size_t hs = read(s->fd,&fh,sizeof(fh)); - if (s->iqfd != 0) { - struct stat sb; - iqfile_header_t fh; - size_t hs = read(s->iqfd,&fh,sizeof(fh)); - - if (hs == sizeof(fh)) { - parse_iqfile_header(device, &fh); - fstat(s->iqfd, &sb); + if (hs == sizeof(fh)) { + parse_iqfile_header(device, &fh); + fstat(s->fd, &sb); s->mapsize=sb.st_size; - s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t))/ sizeof(iqrec_t)); - LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nb_samples, c->u_sf_filename,(uint64_t)sb.st_size); + LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nbSamplesBlocks, c->u_sf_filename,(uint64_t)sb.st_size); // allocate buffer for 1 sample at a time - s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)); + s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)+MAX_BELL_LABS_IQ_BYTES_PER_SF*4); if (s->ms_sample == NULL) { LOG_E(HW,"Memory allocation failed for individual subframe replay mode.\n" ); - close(s->iqfd); + close(s->fd); exit(-1); } memset(s->ms_sample, 0, sizeof(iqrec_t)); // point at beginning of iqs in file - if (lseek(s->iqfd,sizeof(iqfile_header_t), SEEK_SET) == 0) { + if (lseek(s->fd,sizeof(iqfile_header_t), SEEK_SET) == 0) { LOG_I(HW,"Initial seek at beginning of the file\n" ); } else { LOG_I(HW,"Problem initial seek at beginning of the file\n"); } } else { LOG_E(HW,"Cannot read header in %s exiting.\n",c->u_sf_filename ); - close(s->iqfd); + close(s->fd); exit(-1); } - } else { - LOG_E(HW,"Cannot open %s exiting.\n",c->u_sf_filename ); - exit(-1); - } } + s->currentPtr=(uint8_t *)s->ms_sample; return 0; } /*! \brief start the oai iq player * \param device, the hardware used */ -static int trx_iqplayer_start(openair0_device *device){ - return 0; +static int trx_iqplayer_start(openair0_device *device) { + return 0; } /*! \brief Terminate operation of the oai iq player @@ -157,28 +137,22 @@ static void trx_iqplayer_end(openair0_device *device) { if (device->recplay_state == NULL) return; - + if (device->recplay_state->use_mmap) { if (device->recplay_state->ms_sample != MAP_FAILED) { munmap(device->recplay_state->ms_sample, device->recplay_state->mapsize); - device->recplay_state->ms_sample = NULL; - } - - if (device->recplay_state->mmapfd != 0) { - close(device->recplay_state->mmapfd); - device->recplay_state->mmapfd = 0; - } + } } else { if (device->recplay_state->ms_sample != NULL) { free(device->recplay_state->ms_sample); - device->recplay_state->ms_sample = NULL; - } - - if (device->recplay_state->iqfd != 0) { - close(device->recplay_state->iqfd); - device->recplay_state->iqfd = 0; - } + } + } + device->recplay_state->ms_sample = NULL; + if (device->recplay_state->fd >= 0) { + close(device->recplay_state->fd); + device->recplay_state->fd = -1; } + } /*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time, @param device pointer to the device structure specific to the RF hardware target @@ -208,93 +182,68 @@ static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timest * \returns the number of sample read */ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { - int samples_received=0; - static unsigned int cur_samples; - static int64_t wrap_count; - static int64_t wrap_ts; recplay_state_t *s = device->recplay_state; - if (cur_samples == s->nb_samples) { - cur_samples = 0; - wrap_count++; - - if (wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) { - LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n",device->openair0_cfg->recplay_conf->u_sf_loops); + if (s->curSamplesBlock==0 && s->wrap_count==0 ) + s->currentTs=s->ms_sample->ts; + + if (s->curSamplesBlock == s->nbSamplesBlocks) { + LOG_I(HW, "wrapping on iq file (%ld)\n", s->wrap_count); + s->curSamplesBlock = 0; + s->wrap_count++; + + if (s->wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) { + LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n", + device->openair0_cfg->recplay_conf->u_sf_loops); exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n"); } - wrap_ts = wrap_count * (s->nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)); + LOG_I(HW,"go back at the beginning of IQ file"); + device->recplay_state->currentPtr=(uint8_t *)device->recplay_state->ms_sample; - if (!device->recplay_state->use_mmap) { - if (lseek(device->recplay_state->iqfd, 0, SEEK_SET) == 0) { - LOG_I(HW,"Seeking at the beginning of IQ file"); - } else { - LOG_I(HW, "Problem seeking at the beginning of IQ file"); + if (!s->use_mmap) { + if (lseek(device->recplay_state->fd, 0, SEEK_SET) != 0) { + LOG_E(HW, "Problem seeking at the beginning of IQ file"); } } } - if (s->use_mmap) { - if (cur_samples < s->nb_samples) { - *ptimestamp = (s->ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts; - - if (cur_samples == 0) { - LOG_I(HW,"starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu\n", wrap_count,wrap_ts,*ptimestamp); - } - - memcpy(buff[0], &s->ms_sample[cur_samples].samples[0], nsamps*4); - cur_samples++; - } - } else { + if (!s->use_mmap) { // read sample from file - if (read(s->iqfd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) { - LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*cur_samples ); - close(s->iqfd); - free(s->ms_sample); - s->ms_sample = NULL; - s->iqfd = 0; + if (read(s->fd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) { + LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock ); exit(-1); - } - - if (cur_samples < s->nb_samples) { - static int64_t ts0 = 0; - - if ((cur_samples == 0) && (wrap_count == 0)) { - ts0 = s->ms_sample->ts; - } - - *ptimestamp = ts0 + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)) + wrap_ts; - - if (cur_samples == 0) { - LOG_I(HW, "starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu ",wrap_count,wrap_ts, *ptimestamp); - } - - memcpy(buff[0], &s->ms_sample->samples[0], nsamps*4); - cur_samples++; - // Prepare for next read - off_t where = lseek(s->iqfd, cur_samples * sizeof(iqrec_t), SEEK_SET); - - if (where < 0) { - LOG_E(HW,"Cannot lseek in iqfile: %s\n",strerror(errno)); + } else { + if (read(s->fd, s->ms_sample+1, s->ms_sample->nbBytes) != s->ms_sample->nbBytes) { + LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock ); exit(-1); } } } - struct timespec req; + iqrec_t *curHeader=(iqrec_t *)s->currentPtr; + AssertFatal(curHeader->header==BELL_LABS_IQ_HEADER,"" ); + // the current timestamp is the stored timestamp until we wrap on input + // USRP shifts 1 sample time to time + AssertFatal(s->wrap_count !=0 || abs(curHeader->ts-s->currentTs) < 5 ,""); + AssertFatal(nsamps*4==curHeader->nbBytes,""); + *ptimestamp = s->currentTs; + memcpy(buff[0], curHeader+1, nsamps*4); + s->curSamplesBlock++; + // Prepare for next read + s->currentTs+=nsamps; + + if (s->use_mmap) + s->currentPtr+=sizeof(iqrec_t)+s->ms_sample->nbBytes; + struct timespec req; req.tv_sec = 0; - req.tv_nsec = (device->openair0_cfg[0].recplay_conf->u_sf_read_delay) * 1000; - nanosleep(&req, NULL); - + LOG_D(HW, "returning %d samples at ts %lu\n", nsamps, *ptimestamp); return nsamps; - - return samples_received; } - int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { device->openair0_cfg = openair0_cfg; device->trx_start_func = trx_iqplayer_start; @@ -313,5 +262,4 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { LOG_UI(HW,"iqplayer device initialized, replay %s for %i iterations",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops); return 0; } - /*@}*/ diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index 3f4c0e1517e162274b2f015bc4f09d7393179aef..ab8ae77edde7320d887b670663ce45eaa5c66a0c 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -65,17 +65,8 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si // Fixme: not sure when it is "volts" so dB is 20*log10(...) or "power", so dB is 10*log10(...) const double pathLossLinear = pow(10,channelDesc->path_loss_dB/20.0); // Energy in one sample to calibrate input noise - //Fixme: modified the N0W computation, not understand the origin value - const double KT=1.38e-23*290; //Boltzman*temperature - // sampling rate is linked to acquisition band (the input pass band filter) - const double noise_figure_watt = KT*channelDesc->sampling_rate; - // Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ? - // the parameter "-s" is declared as SNR, but the input power is not well defined - // −132.24 dBm is a LTE subcarrier noise, that was used in origin code (15KHz BW thermal noise) - const double rxGain= 132.24 - channelmod_get_snr_dB(); - // sqrt(4*noise_figure_watt) is the thermal noise factor (volts) - // fixme: the last constant is pure trial results to make decent noise - const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10; + // the normalized OAI value seems to be 256 as average amplitude (numerical amplification = 1) + const double noise_per_sample = pow(10,channelDesc->noise_power_dB/10.0) * 256; // Fixme: we don't fill the offset length samples at begining ? // anyway, in today code, channel_offset=0 const int dd = abs(channelDesc->channel_offset); diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index cd35c46a15a40c882e7c393adbe55ea527599792..f80f77f39c3a9d1c52baf7572b7263f7c91a88ff 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -54,7 +54,7 @@ #include <targets/ARCH/rfsimulator/rfsimulator.h> #define PORT 4043 //default TCP port for this simulator -#define CirSize 307200 // 100ms is enough +#define CirSize 6144000 // 100ms is enough #define sampleToByte(a,b) ((a)*(b)*sizeof(sample_t)) #define byteToSample(a,b) ((a)/(sizeof(sample_t)*(b))) @@ -69,7 +69,9 @@ extern RAN_CONTEXT_t RC; #define RFSIMU_SECTION "rfsimulator" #define RFSIMU_OPTIONS_PARAMNAME "options" -# define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ + + +#define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ " chanmod: enable channel modelisation\n"\ " saviq: enable saving written iqs to a file\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -78,21 +80,21 @@ extern RAN_CONTEXT_t RC; /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED #define RFSIMULATOR_PARAMS_DESC { \ - {"serveraddr", "<ip address to connect to>\n", simOpt , strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ - {"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ - {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ - {"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ - {"modelname", "<channel model name>\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ - {"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ - {"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ - {"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ + {"serveraddr", "<ip address to connect to>\n", simOpt, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ + {"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ + {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ + {"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ + {"modelname", "<channel model name>\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ + {"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ + {"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ + {"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ }; static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static telnetshell_cmddef_t rfsimu_cmdarray[] = { - {"setmodel","<model name>",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, + {"setmodel","<model name> <model type>",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, {"","",NULL}, }; @@ -133,6 +135,7 @@ typedef struct { double chan_pathloss; double chan_forgetfact; int chan_offset; + float noise_power_dB; void *telnetcmd_qid; poll_telnetcmdq_func_t poll_telnetcmdq; } rfsimulator_state_t; @@ -182,15 +185,9 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) { tableNor(rand); init_done=true; } - - ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels, - bridge->channelmod, - bridge->sample_rate, - bridge->tx_bw, - 30e-9, // TDL delay-spread parameter - bridge->chan_forgetfact, // forgetting_factor - bridge->chan_offset, // maybe used for TA - bridge->chan_pathloss); // path_loss in dB + char *modelname = (bridge->typeStamp == ENB_MAGICDL) ? "rfsimu_channel_ue0":"rfsimu_channel_enB0"; + ptr->channel_model=find_channel_desc_fromname(modelname); // path_loss in dB + AssertFatal((ptr->channel_model!= NULL),"Channel model %s not found, check config file\n",modelname); set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID); random_channel(ptr->channel_model,false); } @@ -299,7 +296,8 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { break; } else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) { init_channelmod(); - rfsimulator->channelmod=modelid_fromname(modelname); + load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw); + rfsimulator->channelmod=true; } else { fprintf(stderr,"Unknown rfsimulator option: %s\n",rfsimu_params[p].strlistptr[i]); exit(-1); @@ -320,20 +318,27 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) { char *modelname=NULL; - int s = sscanf(buff,"%ms\n",&modelname); + char *modeltype=NULL; + if (debug) + prnt("rfsimu_setchanmod_cmd buffer \"%s\"\n",buff); + int s = sscanf(buff,"%m[^ ] %ms\n",&modelname, &modeltype); - if (s == 1) { - int channelmod=modelid_fromname(modelname); + if (s == 2) { + int channelmod=modelid_fromstrtype(modeltype); if (channelmod<0) - prnt("ERROR: model %s unknown\n",modelname); + prnt("ERROR: model type %s unknown\n",modeltype); else { rfsimulator_state_t *t = (rfsimulator_state_t *)arg; - + int found=0; for (int i=0; i<FD_SETSIZE; i++) { buffer_t *b=&t->buf[i]; + if ( b->channel_model==NULL) + continue; + if (b->channel_model->model_name==NULL) + continue; + if (b->conn_sock >= 0 && (strcmp(b->channel_model->model_name,modelname)==0)) { - if (b->conn_sock >= 0 ) { channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels, channelmod, t->sample_rate, @@ -341,21 +346,29 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, 30e-9, // TDL delay-spread parameter t->chan_forgetfact, // forgetting_factor t->chan_offset, // maybe used for TA - t->chan_pathloss); // path_loss in dB + t->chan_pathloss, + t->noise_power_dB + ); // path_loss in dB set_channeldesc_owner(newmodel, RFSIMU_MODULEID); + set_channeldesc_name(newmodel,modelname); random_channel(newmodel,false); channel_desc_t *oldmodel=b->channel_model; b->channel_model=newmodel; free_channel_desc_scm(oldmodel); - prnt("New model %s applied to channel connected to sock %d\n",modelname,i); + prnt("New model type %s applied to channel %s connected to sock %d\n",modeltype,modelname,i); + found=1; + break; } - } + } /* for */ + if (found==0) + prnt("Channel %s not found or not currently used\n",modelname); } } else { - prnt("ERROR: no model specified\n"); + prnt("ERROR: 2 parameters required: model name and model type (%i found)\n",s); } free(modelname); + free(modeltype); return CMDSTATUS_FOUND; } @@ -774,6 +787,11 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // to change the log level, use this on command line // --log_config.hw_log_level debug rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1); + // initialize channel simulation + rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; + rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; + rfsimulator->sample_rate=openair0_cfg->sample_rate; + rfsimulator->tx_bw=openair0_cfg->tx_bw; rfsimulator_readconfig(rfsimulator); pthread_mutex_init(&Sockmutex, NULL); LOG_I(HW,"rfsimulator: running as %s\n", rfsimulator-> typeStamp == ENB_MAGICDL ? "server waiting opposite rfsimulators to connect" : "client: will connect to a rfsimulator server side"); @@ -798,11 +816,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { rfsimulator->buf[i].conn_sock=-1; AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,""); - // initialize channel simulation - rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; - 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); set_taus_seed(0); /* look for telnet server, if it is loaded, add the channel modeling commands to it */ diff --git a/targets/ARCH/rfsimulator/stored_node.c b/targets/ARCH/rfsimulator/stored_node.c index dcea69b9ddfe8c0f166423475a825edde3c8b6fe..cf025680cd76d3665135a2002a9c5e5ad35158f4 100644 --- a/targets/ARCH/rfsimulator/stored_node.c +++ b/targets/ARCH/rfsimulator/stored_node.c @@ -186,14 +186,14 @@ int main(int argc, char *argv[]) { serviceSock=client_start(argv[2],atoi(argv[3])); } - uint64_t typeStamp=ENB_MAGICDL_FDD; + uint64_t typeStamp=ENB_MAGICDL; boolean_t raw=false; if ( argc == 5 ) { raw=true; if (strcmp(argv[4],"UL") == 0 ) - typeStamp=UE_MAGICDL_FDD; + typeStamp=UE_MAGICDL; } samplesBlockHeader_t header; @@ -201,7 +201,6 @@ int main(int argc, char *argv[]) { void *buff=malloc(bufSize); uint64_t timestamp=0; const int blockSize=1920; - // If fileSize is not multiple of blockSize*4 then discard remaining samples fileSize = (fileSize/(blockSize<<2))*(blockSize<<2); diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 4d57ab4e16625eac82290aa7ffae94665cc01892..3e0d97f60a09aa82be414e510f0f396dd595303a 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -42,6 +42,7 @@ # include "enb_app.h" # include "openair2/LAYER2/MAC/mac_proto.h" #include <executables/split_headers.h> +#include <openair3/ocp-gtpu/gtp_itf.h> extern RAN_CONTEXT_t RC; diff --git a/targets/COMMON/create_tasks_mbms.c b/targets/COMMON/create_tasks_mbms.c index 5f81592b96640211e55f9590c8a611c81990c1a8..579e851ea70e699a113a65baff99abb0bc5905df 100644 --- a/targets/COMMON/create_tasks_mbms.c +++ b/targets/COMMON/create_tasks_mbms.c @@ -47,6 +47,7 @@ # include "mce_app.h" # include "mme_app.h" +#include <openair3/ocp-gtpu/gtp_itf.h> //extern RAN_CONTEXT_t RC; int create_tasks_mbms(uint32_t enb_nb) { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf index 504d5e7b349d48fb9c047cbcd196d4da020158ee..a426c39a7ae323a15842a5ce8397369096263e5a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; #pusch_TargetSNRx10 = 200; #pucch_TargetSNRx10 = 200; pusch_TargetSNRx10 = 200; @@ -50,7 +51,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -59,27 +60,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; - - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 + + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 + #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -92,7 +80,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -136,20 +124,18 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; + initialULBWPstartSymbolAndLength_0 = 55; # this is SS=0 L=12 + + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 24; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + msg3_DeltaPreamble = 1; #p0_NominalWithGrant =-90; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf new file mode 100644 index 0000000000000000000000000000000000000000..477240a3a04edf8eda56f28357d16570b1a303b9 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf @@ -0,0 +1,300 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP) + absoluteFrequencySSB = 2071241; + dl_frequencyBand = 257; + # this is 27.900 GHz + dl_absoluteFrequencyPointA = 2070833; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 3; + dl_carrierBandwidth = 32; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=32 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 3; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=2,L=3 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) + initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 261; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 3; + ul_carrierBandwidth = 32; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 3; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 52; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 7; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 3, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 4; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 3; + ssb_PositionsInBurst_Bitmap = 0x0001000100010001L; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 3; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 3; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 3; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.199"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2"; + if_freq = 5124520000L; + clock_src = "external"; + time_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf index f2e468c71b5415a0f6951f72d16e60b7a9196401..8b1079350bb94d416e7d2eef09ed4087ea55925c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf @@ -23,6 +23,9 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -33,10 +36,10 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP) - absoluteFrequencySSB = 2077907; + absoluteFrequencySSB = 2071241; dl_frequencyBand = 257; # this is 27.900 GHz - dl_absoluteFrequencyPointA = 2077499; + dl_absoluteFrequencyPointA = 2070833; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -110,8 +113,8 @@ gNBs = #1,2,4,8,10,20,40,80 ra_ResponseWindow = 7; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; #oneHalf (0..15) 4,8,12,16,...60,64 ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; #ra_ContentionResolutionTimer @@ -140,7 +143,7 @@ gNBs = # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; - initialULBWPk2_2 = 14; + initialULBWPk2_2 = 4; initialULBWPmappingType_2 = 1; # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; @@ -157,7 +160,7 @@ gNBs = # ssb_PositionsInBurs_BitmapPR # 1=short, 2=medium, 3=long ssb_PositionsInBurst_PR = 3; - ssb_PositionsInBurst_Bitmap = 0x100000001L; + ssb_PositionsInBurst_Bitmap = 0x0001000100010001L; # ssb_periodicityServingCell # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 @@ -185,7 +188,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -216,6 +219,7 @@ gNBs = GNB_INTERFACE_NAME_FOR_S1U = "eth0"; GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; } ); @@ -247,9 +251,9 @@ RUs = ( max_rxgain = 75; eNB_instances = [0]; sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2"; - if_freq = 5300000000L; - #time_source = "external"; - clock_source = "external"; + if_freq = 5124520000L; + clock_src = "external"; + time_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf index 273735785109c26521ce447a1b77d6860c124719..3bfcc01703958c300a70ae5953e4883b5ecf2bcb 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -176,7 +177,7 @@ gNBs = nrofUplinkSlots = 10; nrofUplinkSymbols = 0; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf index f810dd546cab7fa7352dd27682e273aef61d333a..e1bf1b98184b07560c3260a048d682c55f963155 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; @@ -112,8 +113,8 @@ gNBs = #1,2,4,8,10,20,40,80 ra_ResponseWindow = 7; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; #oneHalf (0..15) 4,8,12,16,...60,64 ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; #ra_ContentionResolutionTimer @@ -142,7 +143,7 @@ gNBs = # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; - initialULBWPk2_2 = 14; + initialULBWPk2_2 = 4; initialULBWPmappingType_2 = 1; # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; @@ -187,7 +188,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -249,6 +250,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 8; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf index 32de0aa4f57d6ea6d05d8625fc93b547056db0dc..ceba30dacfec6760641df4c39fa0bcd2cb5037d3 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -185,7 +186,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -238,7 +239,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1; nb_rx = 1; att_tx = 0; @@ -247,15 +248,14 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; # if_freq = 3700000000L; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index 307cf52cb3074340a767a16c1e9aece217d3e6f1..115ed6f6f0210fca97b35c3462ac545900c194f4 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -185,7 +186,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -238,7 +239,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1; nb_rx = 1; att_tx = 0; @@ -247,15 +248,14 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "type=x300"; clock_src = "external"; # if_freq = 3700000000L; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf index 1cd16d08319379277e9401aa0e40e9ccc196eecc..b83999f25ed6fe74542d846058537f7cb35510c1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -83,7 +84,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -176,7 +177,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf index dfae41f0a6b47a1251b7b28b667ff6f294df3fb1..27ade965dc29869e5fcf915f351aea4a04b6a807 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=0,L=50 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -89,7 +90,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf index dcdfa003a26495723a2c733f62678c63ee105d95..9bb91329173132150f812a867c76919b11f56589 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf new file mode 100644 index 0000000000000000000000000000000000000000..ffced2055ae509996183ae44401b3ce973358523 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf @@ -0,0 +1,339 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + + # downlinkConfigCommon + # frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641032; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; + # subcarrierSpacing + # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6366; + # subcarrierSpacing + # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; + # subcarrierSpacing + # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6366; + # subcarrierSpacing + # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; + #prach_msg1_FDM + #0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; + #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; + #powerRampingStep + # 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; + #ra_ReponseWindow + #1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; + #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR + #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; + #oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; + #ra_ContentionResolutionTimer + #(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; + #prach-RootSequenceIndex_PR + #1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, + # restrictedSetConfig + # 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + + # pucch-ConfigCommon setup : + # pucchGroupHopping + # 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; + # ssb_PositionsInBurs_BitmapPR + # 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + + # ssb_periodicityServingCell + # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + + # dmrs_TypeA_position + # 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + + # subcarrierSpacing + # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon + # subcarrierSpacing + # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + # Dedicated Serving Cell Configuration + servingCellConfigDedicated = ( + { + # DL PTRS related parameters. + # 3GPP TS 38.331 PTRS-DownlinkConfig + + # frequencyDensity value range: 1-276 + dl_ptrsFreqDensity0_0 = 25; + dl_ptrsFreqDensity1_0 = 75; + + # timeDensity value range: 0-29 + dl_ptrsTimeDensity0_0 = 2; + dl_ptrsTimeDensity1_0 = 4; + dl_ptrsTimeDensity2_0 = 10; + + # epre_Ratio + # 0 = "00", 1 = "01" in TS 38.214, table 4.1-2 + dl_ptrsEpreRatio_0 = 0; + + # resourceElementOffset + # 0 = offset01 1 = offset02, 2 = offset02 + # 3GPP TS 38.331 PTRS-DownlinkConfig; TS 38.211 sec. 7.4.1.2.2 + dl_ptrsReOffset_0 = 0; + + # UL PTRS related parameters. + # 3GPP TS 38.331 PTRS-UplinkConfig + + # frequencyDensity value range: 1-276 + ul_ptrsFreqDensity0_0 = 25; + ul_ptrsFreqDensity1_0 = 75; + + # timeDensity value range: 0-29 + ul_ptrsTimeDensity0_0 = 2; + ul_ptrsTimeDensity1_0 = 4; + ul_ptrsTimeDensity2_0 = 10; + + # resourceElementOffset + # 0 = offset01 1 = offset02, 2 = offset02 + # TS 38.331 PTRS-UplinkConfig; TS 38.211 sec. 6.4.1.2.2.1 + ul_ptrsReOffset_0 = 0; + + # maxNrofPorts + # 0 = n1, 1 = n2 + ul_ptrsMaxPorts_0 = 0; + + # ptrs-Power + # 0 = p00, 1 = p01, 2 = p10, 3 = p11 + #ul_ptrsPower_0 = 0; + } + ); + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +log_config : +{ + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; +}; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf index 862f0e6303f29bca115302c991c844f18af76649..b517bea8ee322838e942bdf568685f451655f120 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -176,7 +177,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -228,7 +229,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 0 @@ -237,7 +238,15 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - sdr_addrs = "type=b200"; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + #bf_weights = [0x00007fff, 0x00007fff]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=b200"; #clock_src = "external"; } ); 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 c77497dedd6406ac68d0251fbdf35b6055718ba1..7080aff8ea99abef5723c1e96c0a86ba10dde180 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 @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -89,7 +90,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -158,7 +159,7 @@ gNBs = # ssb_PositionsInBurs_BitmapPR # 1=short, 2=medium, 3=long ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; + ssb_PositionsInBurst_Bitmap = 0x1; # ssb_periodicityServingCell # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 @@ -186,7 +187,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -239,7 +240,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 0 @@ -248,15 +249,14 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 50; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas - bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas + #bf_weights = [0x00007fff, 0x00007fff]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - 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 b3fdd7947518d9eea2bb4fbfff9ccb22ed373736..4039012fe18aae1cbcc74e75f5f762858dc1aa04 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 @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=0,L=50 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -89,7 +90,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -186,7 +187,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; // -25 dBm/RE is the maximum measured power from USRP corresponding to att_tx = 0 dB } ); @@ -256,7 +257,6 @@ RUs = ( # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "type=x300"; clock_src = "external"; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 40361aaf4e8ffa042fec8f82965afe156c668bbc..20e8aabf9845d9ae2047762419652f2521220d2b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -186,7 +187,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf index c907dcfe8d84c38ea5f7ae353408d45de201cb09..fc8bda5d53c6e482fe807255ef6e99f358ba6034 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -181,7 +182,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf new file mode 100644 index 0000000000000000000000000000000000000000..89dda14e2070f71fa49c6ec0f149ecdbddacbbe2 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf @@ -0,0 +1,293 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=b200"; + #"addr=192.168.18.207"; + #"addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf new file mode 100644 index 0000000000000000000000000000000000000000..7954b3c201a2dbf2e828696e7ec51f62e899a37d --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf @@ -0,0 +1,291 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf new file mode 100644 index 0000000000000000000000000000000000000000..bd88ed88c792cfde0ca65cedb933230a62172ca9 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf @@ -0,0 +1,291 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + 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 a899845cb8913e82a529bed2b0809215be7c3f6e..694b78e08d6e31820f232a078c618cd83d09a5e3 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 @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -186,7 +187,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf index 5f65a2c80136d16eb07ad6d15685ddf5d71d2359..e541607559c555b15cd1b05452ab8d1a1e30d3a0 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index c46ea98ec24cb204ca326f25d25b9fb1815a39d8..ece681bc6ea6762017b9536f7544f8170142ace8 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; @@ -48,7 +49,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -90,7 +91,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -203,7 +204,7 @@ gNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.18.99"; + amf_ip_address = ( { ipv4 = "192.168.69.131"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -226,10 +227,10 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24"; - GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.198/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; GNB_PORT_FOR_X2C = 36422; # Spec 36422 @@ -249,7 +250,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + pusch_proc_threads = 8; } ); @@ -264,7 +265,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - clock_src = "external"; + #clock_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf new file mode 100644 index 0000000000000000000000000000000000000000..185edc5666de041f1c8d8c3de55d7960197f7ab1 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf @@ -0,0 +1,307 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 12 PRBs@30kHz SCS + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) + initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -100; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 5; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 2; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; #0x80; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.199"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + //parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf index 6a3f008ec1a02a538f4b73f278381fda9c33a8bd..e8fcced3863b66f546cc48bebb420c60b03c09a6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -88,7 +89,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf new file mode 100644 index 0000000000000000000000000000000000000000..483fd34f2a1e910ce7ff449e4ad0e3f3b4966a77 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -0,0 +1,288 @@ +Active_gNBs = ( "gNB-CU-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; +Num_Threads_PUSCH = 8; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-CU-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + nr_cellid = 12345678L + + tr_s_preference = "f1" + + local_s_if_name = "lo"; + remote_s_address = "127.0.0.3"; + local_s_address = "127.0.0.4"; + local_s_portc = 501; + remote_s_portc = 500; + local_s_portd = 601; + remote_s_portd = 600; + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641032; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6366; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6366; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +# RUs = ( +# { +# local_rf = "yes" +# nb_tx = 1 +# nb_rx = 1 +# att_tx = 0 +# att_rx = 0; +# bands = [7]; +# max_pdschReferenceSignalPower = -27; +# max_rxgain = 75; +# eNB_instances = [0]; +# ##beamforming 1x2 matrix: 1 layer x 2 antennas +# bf_weights = [0x00007fff, 0x0000]; +# ##beamforming 1x4 matrix: 1 layer x 4 antennas +# #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; +# ## beamforming 2x2 matrix: +# # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; +# ## beamforming 4x4 matrix: +# #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + +# sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; +# clock_src = "external"; +# } +# ); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="debug"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="debug"; + rrc_log_verbosity ="medium"; + f1ap_log_level ="info"; + f1ap_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf new file mode 100644 index 0000000000000000000000000000000000000000..dcb3010f20386b2fc13f7bdbc8c00a72270a87d0 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -0,0 +1,302 @@ +Active_gNBs = ( "gNB-Eurecom-DU"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; +Num_Threads_PUSCH = 8; + +gNBs = +( + { + ////////// Identification parameters: + gNB_CU_ID = 0xe00; + +# cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-DU"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + nr_cellid = 12345678L + +# tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641032; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6366; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6366; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "f1"; + local_n_if_name = "lo"; + remote_n_address = "127.0.0.4"; + local_n_address = "127.0.0.3"; + local_n_portc = 500; + remote_n_portc = 501; + local_n_portd = 600; + remote_n_portd = 601; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="debug"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf new file mode 100644 index 0000000000000000000000000000000000000000..753bd0bed3ef58dac322a104f5bc70c7ecfae2a3 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf @@ -0,0 +1,304 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 100; + + plmn_list = ({ + mcc = 208; + mnc = 93; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x010203; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641032; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6366; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6366; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.199.223"; + ipv6 = "192:168:199::223"; + active = "yes"; + preference = "ipv4"; + } + ); + + + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_NG_AMF = "eno1"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.199.222/24"; + GNB_INTERFACE_NAME_FOR_NGU = "enx000ec6c0a3ac"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.10.100/24"; + GNB_PORT_FOR_NGU = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.20.20/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + ngap_log_level ="info"; + ngap_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 108cf06033b77f5f33afe98117b50dc19c63cc38..20423b50b9ba5d241f106750eb8f2826bfb175fc 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -13,7 +13,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;}); + plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -21,6 +21,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pdcch_ConfigSIB1 = ( { @@ -51,7 +52,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; # 6366 12925 12956 28875 + initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -64,28 +65,23 @@ gNBs = #initialULBWPmappingType #0=typeA,1=typeB initialDLBWPmappingType_0 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_0 = 53; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=10 - initialDLBWPstartSymbolAndLength_1 = 81; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 95; + initialDLBWPstartSymbolAndLength_2 = 54; initialDLBWPk0_3 = 0; initialDLBWPmappingType_3 = 0; - #this is SS=2,L=7 - initialDLBWPstartSymbolAndLength_3 = 86; - - initialDLBWPk0_4 = 0; - initialDLBWPmappingType_4 = 0; - #this is SS=2,L=5 - initialDLBWPstartSymbolAndLength_4 = 58; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL @@ -99,7 +95,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 12952; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -111,7 +107,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -100; + preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -196,7 +192,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -255,10 +251,11 @@ MACRLCs = ( ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index d28427dbf3615f8fedf243557d262590297317cb..f91650cdc1f6fc1f0fe22ea390a10ce944d72da0 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -13,14 +13,30 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;}); - + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x010203; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + tr_s_preference = "local_mac" ////////// Physical parameters: ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pdcch_ConfigSIB1 = ( { @@ -50,8 +66,8 @@ gNBs = dl_carrierBandwidth = 106; #initialDownlinkBWP #genericParameters - # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; # 6366 12925 12956 28875 + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -64,13 +80,13 @@ gNBs = #initialULBWPmappingType #0=typeA,1=typeB initialDLBWPmappingType_0 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_0 = 53; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=10 - initialDLBWPstartSymbolAndLength_1 = 81; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; @@ -94,7 +110,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 12952; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -106,7 +122,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -100; + preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -191,7 +207,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -207,7 +223,7 @@ gNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + amf_ip_address = ( { ipv4 = "192.168.69.131"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -229,12 +245,12 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR"; - GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.198/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 - GNB_IPV4_ADDRESS_FOR_X2C = "CI_GNB_IP_ADDR"; + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; GNB_PORT_FOR_X2C = 36422; # Spec 36422 }; @@ -250,10 +266,11 @@ MACRLCs = ( ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( @@ -307,5 +324,7 @@ rfsimulator : pdcp_log_verbosity ="medium"; rrc_log_level ="info"; rrc_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; }; diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 368fd78f9e8c01230ef5f957efb2398e64c03b32..4682c5989e92a0b0a986e1175f0896be81016ece 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -869,7 +869,6 @@ static void *ru_thread_asynch_rxtx( void *param ) { LOG_I(PHY, "devices ok (ru_thread_asynch_rxtx)\n"); while (!oai_exit) { - if (oai_exit) break; if (ru->state != RU_RUN) { subframe=0; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 2e6f148e00710905e7f3afa4e6a0af6a07b5ebc0..ca54792cedd444949f8349bf3cf144a7ee78bacd 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -35,6 +35,7 @@ #include <sched.h> #include "rt_wrapper.h" +#include <common/utils/msc/msc.h> #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all @@ -56,6 +57,8 @@ //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all +#include <openair1/PHY/phy_extern_ue.h> + #include "PHY/phy_vars.h" #include "SCHED/sched_common_vars.h" #include "LAYER2/MAC/mac_vars.h" @@ -100,6 +103,8 @@ pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex +msc_interface_t msc_interface; + uint16_t sf_ahead=4; @@ -170,7 +175,6 @@ 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 */ @@ -179,6 +183,7 @@ eth_params_t *eth_params; double cpuf; int oaisim_flag=0; +uint8_t proto_agent_flag = 0; /* forward declarations */ @@ -727,7 +732,7 @@ int main ( int argc, char **argv ) fflush(stderr); // end of CI modifications //getchar(); - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("enb",NULL); itti_wait_tasks_end(); oai_exit=1; @@ -735,7 +740,7 @@ int main ( int argc, char **argv ) // stop threads if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) { - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); LOG_I(ENB_APP,"stopping MODEM threads\n"); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 407756e20f44736a94f9f8e96fe4c63a67ee882c..82140ea5aa1492b9cff8a8b5257910d5161e3334 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -95,6 +95,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); +int tx_req_num_elems; extern uint16_t sf_ahead; //extern int tx_req_UE_MAC1(); @@ -181,9 +182,8 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t abstraction_flag) { - PHY_VARS_UE *ue = (PHY_VARS_UE *)malloc(sizeof(PHY_VARS_UE)); - memset(ue,0,sizeof(PHY_VARS_UE)); - + PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE)); + AssertFatal(ue,""); if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); } diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 9bf179efb928293a82235771b9faeca929d98b53..3714b0dc6fba53910b107cf2d78ce05b55ae47a8 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -86,6 +86,7 @@ #include "lte-softmodem.h" +msc_interface_t msc_interface; /* temporary compilation wokaround (UE/eNB split */ uint16_t sf_ahead; @@ -168,7 +169,6 @@ extern void get_uethreads_params(void); int transmission_mode=1; -int usrp_tx_thread = 0; char *usrp_args=NULL; @@ -758,7 +758,7 @@ int main( int argc, char **argv ) { PHY_vars_UE_g[0][0]->no_timing_correction = 1; } - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("ue",NULL); config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); @@ -783,7 +783,7 @@ int main( int argc, char **argv ) { printf("oai_exit=%d\n",oai_exit); // stop threads - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); printf("stopping MODEM threads\n"); diff --git a/targets/RT/USER/rfsim.c b/targets/RT/USER/rfsim.c index eb380b95186ae78ed8ec7143bb91615e7d964c31..2bd95507c325a59f757b69e6db9532dd4317c627 100644 --- a/targets/RT/USER/rfsim.c +++ b/targets/RT/USER/rfsim.c @@ -361,6 +361,7 @@ void init_ocm(void) { DS_TDL, 0.0, 0, + 0, 0); random_channel(sim.RU2UE[ru_id][UE_id][CC_id],0); LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN", UE_id, ru_id); @@ -374,6 +375,7 @@ void init_ocm(void) { DS_TDL, 0.0, 0, + 0, 0); random_channel(sim.UE2RU[UE_id][ru_id][CC_id],0); // to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed. diff --git a/targets/RT/USER/rt_wrapper.c b/targets/RT/USER/rt_wrapper.c index 5bdbbb36e3f8b5d07b0cd3e8556bb6ce16acc2a6..b0518688252856a39f8d70c6efcd045a2f87f85d 100644 --- a/targets/RT/USER/rt_wrapper.c +++ b/targets/RT/USER/rt_wrapper.c @@ -44,6 +44,7 @@ #include <sys/sysinfo.h> #include "rt_wrapper.h" #include <errno.h> +#include <common/utils/msc/msc.h> #include "openair1/PHY/defs_common.h"