Merge remote-tracking branch 'origin/develop' into NR_SA_F1AP_RFSIMULATOR2
Conflicts: cmake_targets/CMakeLists.txt executables/nr-softmodem.c executables/nr-uesoftmodem.c openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c openair2/RRC/NR/rrc_gNB.c openair2/RRC/NR/rrc_gNB_NGAP.c openair2/RRC/NR_UE/rrc_UE.c openair3/NGAP/ngap_gNB.c openair3/NGAP/ngap_gNB_nas_procedures.c
This commit is contained in:
Vendored
+1
-1
@@ -25,4 +25,4 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ def nodeExecutor = params.nodeExecutor
|
|||||||
// VM Lockable resources
|
// VM Lockable resources
|
||||||
def vmResource = params.vmLockableResource
|
def vmResource = params.vmLockableResource
|
||||||
|
|
||||||
|
// Tags to shorten pipeline duration
|
||||||
|
def doMandatoryTests = false
|
||||||
|
def doFullTestsuite = false
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
label nodeExecutor
|
label nodeExecutor
|
||||||
@@ -46,31 +50,6 @@ pipeline {
|
|||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
timestamps()
|
timestamps()
|
||||||
gitLabConnection('OAI GitLab')
|
gitLabConnection('OAI GitLab')
|
||||||
gitlabBuilds(builds: [
|
|
||||||
"Build gNB-USRP",
|
|
||||||
"Build nr-UE-USRP",
|
|
||||||
"Build eNB-USRP",
|
|
||||||
"Build basic-sim",
|
|
||||||
"Build phy-sim",
|
|
||||||
"Build eNB-ethernet",
|
|
||||||
"Build UE-ethernet",
|
|
||||||
"Analysis with cppcheck",
|
|
||||||
"Test phy-sim",
|
|
||||||
"Test basic-sim",
|
|
||||||
"Test L1-sim",
|
|
||||||
"Test RF-sim",
|
|
||||||
"Test L2-sim",
|
|
||||||
"Test-Mono-FDD-Band7",
|
|
||||||
"Test-Mono-TDD-Band40",
|
|
||||||
"Test-IF4p5-FDD-Band7",
|
|
||||||
"Test-IF4p5-TDD-Band40",
|
|
||||||
"Test-Mono-FDD-Band13-LTE-M",
|
|
||||||
"Test-IF4p5-TDD-Band38-Multi-RRU",
|
|
||||||
"Test-eNB-OAI-UE-FDD-Band7",
|
|
||||||
"Test-Mono-FDD-Band13-X2-HO",
|
|
||||||
"Test-TDD-Band78-gNB-NR-UE",
|
|
||||||
"Test-OCP-FDD-Band7"
|
|
||||||
])
|
|
||||||
ansiColor('xterm')
|
ansiColor('xterm')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +72,33 @@ pipeline {
|
|||||||
if (fileExists("flexran")) {
|
if (fileExists("flexran")) {
|
||||||
sh "rm -Rf flexran > /dev/null 2>&1"
|
sh "rm -Rf flexran > /dev/null 2>&1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +141,7 @@ pipeline {
|
|||||||
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
|
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
|
||||||
sh "./ci-scripts/checkCodingFormattingRules.sh"
|
sh "./ci-scripts/checkCodingFormattingRules.sh"
|
||||||
}
|
}
|
||||||
if (doFlexranCtrlTest) {
|
if (doFlexranCtrlTest && doMandatoryTests) {
|
||||||
sh "mkdir flexran"
|
sh "mkdir flexran"
|
||||||
dir ('flexran') {
|
dir ('flexran') {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
@@ -375,6 +381,9 @@ pipeline {
|
|||||||
stage ("VM-based tests") {
|
stage ("VM-based tests") {
|
||||||
stages {
|
stages {
|
||||||
stage ("Test physical simulators") {
|
stage ("Test physical simulators") {
|
||||||
|
when {
|
||||||
|
expression {doMandatoryTests}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
lock (vmResource) {
|
lock (vmResource) {
|
||||||
script {
|
script {
|
||||||
@@ -393,7 +402,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage ("Build Flexran Controller") {
|
stage ("Build Flexran Controller") {
|
||||||
when {
|
when {
|
||||||
expression {doFlexranCtrlTest}
|
expression {doFlexranCtrlTest && doMandatoryTests}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
lock (vmResource) {
|
lock (vmResource) {
|
||||||
@@ -410,6 +419,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test basic simulator") {
|
stage ("Test basic simulator") {
|
||||||
|
when {
|
||||||
|
expression {doMandatoryTests}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
lock (vmResource) {
|
lock (vmResource) {
|
||||||
script {
|
script {
|
||||||
@@ -427,6 +439,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test L1 simulator") {
|
stage ("Test L1 simulator") {
|
||||||
|
when {
|
||||||
|
expression {doMandatoryTests}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
lock (vmResource) {
|
lock (vmResource) {
|
||||||
script {
|
script {
|
||||||
@@ -444,6 +459,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test RF simulator") {
|
stage ("Test RF simulator") {
|
||||||
|
when {
|
||||||
|
expression {doMandatoryTests}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
lock (vmResource) {
|
lock (vmResource) {
|
||||||
script {
|
script {
|
||||||
@@ -461,6 +479,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test L2 simulator") {
|
stage ("Test L2 simulator") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
lock (vmResource) {
|
lock (vmResource) {
|
||||||
script {
|
script {
|
||||||
@@ -478,6 +499,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Destroy all Virtual Machines") {
|
stage ("Destroy all Virtual Machines") {
|
||||||
|
when {
|
||||||
|
expression {doMandatoryTests}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
lock (vmResource) {
|
lock (vmResource) {
|
||||||
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||||
@@ -487,6 +511,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test MONOLITHIC - FDD - Band 7 - B210") {
|
stage ("Test MONOLITHIC - FDD - Band 7 - B210") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
triggerSlaveJob ('eNB-CI-FDD-Band7-B210', 'Test-Mono-FDD-Band7')
|
triggerSlaveJob ('eNB-CI-FDD-Band7-B210', 'Test-Mono-FDD-Band7')
|
||||||
@@ -506,6 +533,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test MONOLITHIC - TDD - Band 40 - B210") {
|
stage ("Test MONOLITHIC - TDD - Band 40 - B210") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
triggerSlaveJob ('eNB-CI-TDD-Band40-B210', 'Test-Mono-TDD-Band40')
|
triggerSlaveJob ('eNB-CI-TDD-Band40-B210', 'Test-Mono-TDD-Band40')
|
||||||
@@ -525,6 +555,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test IF4p5 - FDD - Band 7 - B210") {
|
stage ("Test IF4p5 - FDD - Band 7 - B210") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh "sleep 60"
|
sh "sleep 60"
|
||||||
@@ -545,6 +578,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test IF4p5 - TDD - Band 40 - B210") {
|
stage ("Test IF4p5 - TDD - Band 40 - B210") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh "sleep 60"
|
sh "sleep 60"
|
||||||
@@ -565,6 +601,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test MONOLITHIC - FDD - Band 13 - B210") {
|
stage ("Test MONOLITHIC - FDD - Band 13 - B210") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh "sleep 60"
|
sh "sleep 60"
|
||||||
@@ -585,6 +624,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test X2 Handover - FDD - Band 13 - B210") {
|
stage ("Test X2 Handover - FDD - Band 13 - B210") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh "sleep 60"
|
sh "sleep 60"
|
||||||
@@ -605,6 +647,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test IF4p5 - TDD - Band 38 - B210 - MultiRRU") {
|
stage ("Test IF4p5 - TDD - Band 38 - B210 - MultiRRU") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
triggerSlaveJob ('eNB-CI-IF4p5-TDD-Band38-MultiRRU-B210', 'Test-IF4p5-TDD-Band38-Multi-RRU')
|
triggerSlaveJob ('eNB-CI-IF4p5-TDD-Band38-MultiRRU-B210', 'Test-IF4p5-TDD-Band38-Multi-RRU')
|
||||||
@@ -624,6 +669,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test OAI UE - FDD - Band 20 - B200") {
|
stage ("Test OAI UE - FDD - Band 20 - B200") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
triggerSlaveJobNoGitLab ('UE-CI-FDD-Band20-B200')
|
triggerSlaveJobNoGitLab ('UE-CI-FDD-Band20-B200')
|
||||||
@@ -643,6 +691,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test OAI UE - OAI eNB - FDD - Band 7 - B200") {
|
stage ("Test OAI UE - OAI eNB - FDD - Band 7 - B200") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
// Delayed trigger on slave job, so it is always the last one to run
|
// Delayed trigger on slave job, so it is always the last one to run
|
||||||
@@ -664,6 +715,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test OAI NR UE - OAI gNB - TDD - Band 78 - N300") {
|
stage ("Test OAI NR UE - OAI gNB - TDD - Band 78 - N300") {
|
||||||
|
when {
|
||||||
|
expression {doMandatoryTests}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
triggerSlaveJob ('gNB-nrUE-MONO-TDD-Band78-N300', 'Test-TDD-Band78-gNB-NR-UE')
|
triggerSlaveJob ('gNB-nrUE-MONO-TDD-Band78-N300', 'Test-TDD-Band78-gNB-NR-UE')
|
||||||
@@ -683,6 +737,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Test OAI OCP-eNB - FDD - Band 7 - B210") {
|
stage ("Test OAI OCP-eNB - FDD - Band 7 - B210") {
|
||||||
|
when {
|
||||||
|
expression {doFullTestsuite}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
triggerSlaveJob ('OCPeNB-FDD-Band7-B210', 'Test-OCP-FDD-Band7')
|
triggerSlaveJob ('OCPeNB-FDD-Band7-B210', 'Test-OCP-FDD-Band7')
|
||||||
@@ -705,6 +762,7 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
script {
|
script {
|
||||||
|
if (doMandatoryTests) {
|
||||||
dir ('archives') {
|
dir ('archives') {
|
||||||
sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi"
|
sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi"
|
||||||
}
|
}
|
||||||
@@ -720,6 +778,7 @@ pipeline {
|
|||||||
archiveArtifacts artifacts: 'test_simulator_results.html'
|
archiveArtifacts artifacts: 'test_simulator_results.html'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+108
@@ -0,0 +1,108 @@
|
|||||||
|
#!/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 GitLab merge request applying script"
|
||||||
|
echo " Original Author: Raphael Defosseux"
|
||||||
|
echo ""
|
||||||
|
echo "Usage:"
|
||||||
|
echo "------"
|
||||||
|
echo ""
|
||||||
|
echo " checkGitLabMergeRequestLabels.sh [OPTIONS]"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo "------------------"
|
||||||
|
echo ""
|
||||||
|
echo " --mr-id ####"
|
||||||
|
echo " Specify the ID of the merge request."
|
||||||
|
echo ""
|
||||||
|
echo " --help OR -h"
|
||||||
|
echo " Print this help message."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -ne 2 ] && [ $# -ne 1 ]
|
||||||
|
then
|
||||||
|
echo "Syntax Error: not the correct number of arguments"
|
||||||
|
echo ""
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]
|
||||||
|
do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
|
case $key in
|
||||||
|
-h|--help)
|
||||||
|
shift
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--mr-id)
|
||||||
|
MERGE_REQUEST_ID="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Syntax Error: unknown option: $key"
|
||||||
|
echo ""
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
LABELS=`curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/$MERGE_REQUEST_ID" | jq '.labels' || true`
|
||||||
|
|
||||||
|
IS_MR_BUILD_ONLY=`echo $LABELS | grep -c BUILD-ONLY || true`
|
||||||
|
IS_MR_CI=`echo $LABELS | grep -c CI || true`
|
||||||
|
IS_MR_4G=`echo $LABELS | grep -c 4G-LTE || true`
|
||||||
|
IS_MR_5G=`echo $LABELS | grep -c 5G-NR || true`
|
||||||
|
|
||||||
|
# First case: none is present! No CI
|
||||||
|
if [ $IS_MR_BUILD_ONLY -eq 0 ] && [ $IS_MR_CI -eq 0 ] && [ $IS_MR_4G -eq 0 ] && [ $IS_MR_5G -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "NONE"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Second case: Build-Only
|
||||||
|
if [ $IS_MR_BUILD_ONLY -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "BUILD-ONLY"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Third case: CI or 4G label --> Full CI run
|
||||||
|
if [ $IS_MR_4G -eq 1 ] || [ $IS_MR_CI -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "FULL"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fourth case: 5G label
|
||||||
|
if [ $IS_MR_BUILD_ONLY -eq 0 ] && [ $IS_MR_CI -eq 0 ] && [ $IS_MR_4G -eq 0 ] && [ $IS_MR_5G -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "SHORTEN-5G"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
Active_gNBs = ( "gNB-Eurecom-5GNRBox");
|
Active_gNBs = ( "gNB-Eurecom-5GNRBox");
|
||||||
# Asn1_verbosity, choice in: none, info, annoying
|
# Asn1_verbosity, choice in: none, info, annoying
|
||||||
Asn1_verbosity = "none";
|
Asn1_verbosity = "none";
|
||||||
Num_Threads_PUSCH = 8
|
|
||||||
|
|
||||||
|
|
||||||
gNBs =
|
gNBs =
|
||||||
@@ -251,6 +250,7 @@ L1s = (
|
|||||||
{
|
{
|
||||||
num_cc = 1;
|
num_cc = 1;
|
||||||
tr_n_preference = "local_mac";
|
tr_n_preference = "local_mac";
|
||||||
|
pusch_proc_threads = 8;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<testCase id="090102">
|
<testCase id="090102">
|
||||||
<class>Initialize_OAI_UE</class>
|
<class>Initialize_OAI_UE</class>
|
||||||
<desc>Initialize NR UE USRP</desc>
|
<desc>Initialize NR UE USRP</desc>
|
||||||
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . --dlsch-parallel 4 </Initialize_OAI_UE_args>
|
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 50 --rrc_config_path . --dlsch-parallel 4 </Initialize_OAI_UE_args>
|
||||||
<air_interface>NR</air_interface>
|
<air_interface>NR</air_interface>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
|
|||||||
@@ -485,7 +485,6 @@ add_custom_target (
|
|||||||
|
|
||||||
add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
|
add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
|
||||||
${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c
|
${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c
|
||||||
${OPENAIR2_DIR}/RRC/NR/nr_ngap_gNB.c
|
|
||||||
)
|
)
|
||||||
add_dependencies(NR_RRC_LIB nr_rrc_flag)
|
add_dependencies(NR_RRC_LIB nr_rrc_flag)
|
||||||
include_directories ("${NR_RRC_FULL_DIR}")
|
include_directories ("${NR_RRC_FULL_DIR}")
|
||||||
@@ -1969,6 +1968,7 @@ set(NR_PDCP_SRC
|
|||||||
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
|
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
|
||||||
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity.c
|
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity.c
|
||||||
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
|
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
|
||||||
|
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c
|
||||||
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
|
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
|
||||||
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c
|
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c
|
||||||
)
|
)
|
||||||
@@ -2112,10 +2112,10 @@ set (MAC_NR_SRC_UE
|
|||||||
${NR_UE_MAC_DIR}/mac_vars.c
|
${NR_UE_MAC_DIR}/mac_vars.c
|
||||||
${NR_UE_MAC_DIR}/main_ue_nr.c
|
${NR_UE_MAC_DIR}/main_ue_nr.c
|
||||||
${NR_UE_MAC_DIR}/nr_ue_procedures.c
|
${NR_UE_MAC_DIR}/nr_ue_procedures.c
|
||||||
|
${NR_UE_MAC_DIR}/nr_ue_scheduler.c
|
||||||
${NR_UE_MAC_DIR}/nr_ue_dci_configuration.c
|
${NR_UE_MAC_DIR}/nr_ue_dci_configuration.c
|
||||||
${NR_UE_MAC_DIR}/nr_l1_helpers.c
|
${NR_UE_MAC_DIR}/nr_l1_helpers.c
|
||||||
${NR_UE_MAC_DIR}/nr_ra_procedures.c
|
${NR_UE_MAC_DIR}/nr_ra_procedures.c
|
||||||
${NR_UE_MAC_DIR}/rar_tools_nrUE.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set (ENB_APP_SRC
|
set (ENB_APP_SRC
|
||||||
@@ -2135,7 +2135,23 @@ set (MCE_APP_SRC
|
|||||||
${OPENAIR2_DIR}/MCE_APP/mce_app.c
|
${OPENAIR2_DIR}/MCE_APP/mce_app.c
|
||||||
${OPENAIR2_DIR}/MCE_APP/mce_config.c
|
${OPENAIR2_DIR}/MCE_APP/mce_config.c
|
||||||
)
|
)
|
||||||
|
set (MISC_NFAPI_LTE
|
||||||
|
${OPENAIR1_DIR}/SCHED/nfapi_lte_dummy.c
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(MISC_NFAPI_LTE_LIB
|
||||||
|
${MISC_NFAPI_LTE}
|
||||||
|
)
|
||||||
|
|
||||||
|
set (MISC_NFAPI_NR
|
||||||
|
${OPENAIR1_DIR}/SCHED/nfapi_nr_dummy.c
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(MISC_NFAPI_NR_LIB
|
||||||
|
${MISC_NFAPI_NR}
|
||||||
|
)
|
||||||
add_library(L2
|
add_library(L2
|
||||||
${L2_SRC}
|
${L2_SRC}
|
||||||
${MAC_SRC}
|
${MAC_SRC}
|
||||||
@@ -2888,7 +2904,7 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
|
|||||||
target_link_libraries (lte-softmodem
|
target_link_libraries (lte-softmodem
|
||||||
-Wl,--start-group
|
-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 LFDS7
|
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}
|
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
@@ -2929,7 +2945,7 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l
|
|||||||
target_link_libraries (ocp-enb
|
target_link_libraries (ocp-enb
|
||||||
-Wl,--start-group
|
-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 LFDS7 SIMU_COMMON
|
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}
|
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
|
target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
|
||||||
@@ -2999,7 +3015,7 @@ target_link_libraries (lte-uesoftmodem
|
|||||||
-Wl,--start-group
|
-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
|
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
|
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}
|
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES}
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
@@ -3126,7 +3142,13 @@ target_link_libraries (nr-uesoftmodem
|
|||||||
-Wl,--start-group
|
-Wl,--start-group
|
||||||
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
|
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
|
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
|
||||||
|
<<<<<<< HEAD
|
||||||
NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
|
NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_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
|
||||||
|
>>>>>>> origin/develop
|
||||||
${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
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
|
|||||||
@@ -1292,7 +1292,9 @@
|
|||||||
(Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
|
(Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
|
||||||
(Test9: SC-FDMA, 50 PRBs),
|
(Test9: SC-FDMA, 50 PRBs),
|
||||||
(Test10: SC-FDMA, 75 PRBs),
|
(Test10: SC-FDMA, 75 PRBs),
|
||||||
(Test11: SC-FDMA, 3 DMRS)</desc>
|
(Test11: SC-FDMA, 216 PRBs),
|
||||||
|
(Test12: SC-FDMA, 273 PRBs),
|
||||||
|
(Test13: SC-FDMA, 3 DMRS)</desc>
|
||||||
<pre_compile_prog></pre_compile_prog>
|
<pre_compile_prog></pre_compile_prog>
|
||||||
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
||||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||||
@@ -1307,10 +1309,13 @@
|
|||||||
-n100 -s5 -T 2 1 2 -U 2 0 2
|
-n100 -s5 -T 2 1 2 -U 2 0 2
|
||||||
-n100 -s5 -T 2 2 2 -U 2 1 2
|
-n100 -s5 -T 2 2 2 -U 2 1 2
|
||||||
-n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3
|
-n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3
|
||||||
-n100 -s20 -Z
|
-n100 -s2 -Z
|
||||||
-n100 -s20 -Z -r75
|
-n100 -s2 -Z -r75
|
||||||
-n100 -s20 -Z -U 2 0 2</main_exec_args>
|
-n100 -s2 -Z -r216 -R217
|
||||||
<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</tags>
|
-n100 -s2 -Z -r270 -R273
|
||||||
|
-n100 -s2 -Z -U 2 0 2</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>
|
||||||
<search_expr_true>PUSCH test OK</search_expr_true>
|
<search_expr_true>PUSCH test OK</search_expr_true>
|
||||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||||
<nruns>3</nruns>
|
<nruns>3</nruns>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
#include "config_userapi.h"
|
#include "config_userapi.h"
|
||||||
#include "../utils/LOG/log.h"
|
#include "../utils/LOG/log.h"
|
||||||
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
|
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
|
||||||
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
|
||||||
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
||||||
void *lib_handle;
|
void *lib_handle;
|
||||||
@@ -331,9 +331,10 @@ void end_configmodule(void) {
|
|||||||
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
|
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
|
||||||
|
|
||||||
for(int i=0; i<cfgptr->numptrs ; i++) {
|
for(int i=0; i<cfgptr->numptrs ; i++) {
|
||||||
if (cfgptr->ptrs[i] != NULL) {
|
if (cfgptr->ptrs[i] != NULL && cfgptr->ptrsAllocated[i] == true) {
|
||||||
free(cfgptr->ptrs[i]);
|
free(cfgptr->ptrs[i]);
|
||||||
cfgptr->ptrs[i]=NULL;
|
cfgptr->ptrs[i]=NULL;
|
||||||
|
cfgptr->ptrsAllocated[i] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include "common/config/config_paramdesc.h"
|
#include "common/config/config_paramdesc.h"
|
||||||
#include "common/utils/T/T.h"
|
#include "common/utils/T/T.h"
|
||||||
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
|
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
|
||||||
@@ -74,6 +76,7 @@ typedef struct configmodule_interface {
|
|||||||
uint32_t numptrs;
|
uint32_t numptrs;
|
||||||
uint32_t rtflags;
|
uint32_t rtflags;
|
||||||
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
|
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
|
||||||
|
bool ptrsAllocated[CONFIG_MAX_ALLOCATEDPTRS];
|
||||||
} configmodule_interface_t;
|
} configmodule_interface_t;
|
||||||
|
|
||||||
#ifdef CONFIG_LOADCONFIG_MAIN
|
#ifdef CONFIG_LOADCONFIG_MAIN
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
|||||||
|
|
||||||
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
||||||
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
|
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
|
||||||
|
config_get_if()->ptrsAllocated[config_get_if()->numptrs] = true;
|
||||||
config_get_if()->numptrs++;
|
config_get_if()->numptrs++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -82,7 +83,9 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr == NULL) {
|
if (*ptr == NULL) {
|
||||||
*ptr = malloc(length>40?length:40); // LTS: dummy fix, waiting Francois full fix in 4G branch
|
*ptr = malloc(length>40?length:40);
|
||||||
|
// LTS: dummy fix, waiting Francois full fix in 4G branch
|
||||||
|
// the issue is we don't know at this point the size we will get
|
||||||
|
|
||||||
if ( *ptr != NULL) {
|
if ( *ptr != NULL) {
|
||||||
memset(*ptr,0,length);
|
memset(*ptr,0,length);
|
||||||
|
|||||||
@@ -346,6 +346,7 @@ int config_libconfig_init(char *cfgP[], int numP) {
|
|||||||
libconfig_privdata.configfile = strdup((char *)cfgP[0]);
|
libconfig_privdata.configfile = strdup((char *)cfgP[0]);
|
||||||
config_get_if()->numptrs=0;
|
config_get_if()->numptrs=0;
|
||||||
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
|
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
|
||||||
|
memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated));
|
||||||
|
|
||||||
/* Read the file. If there is an error, report it and exit. */
|
/* Read the file. If there is an error, report it and exit. */
|
||||||
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
|
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
|
||||||
|
|||||||
+32
-1
@@ -88,16 +88,19 @@ int write_file_matlab(const char *fname,
|
|||||||
void *data,
|
void *data,
|
||||||
int length,
|
int length,
|
||||||
int dec,
|
int dec,
|
||||||
char format)
|
unsigned int format)
|
||||||
{
|
{
|
||||||
FILE *fp=NULL;
|
FILE *fp=NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
AssertFatal((format&~MATLAB_RAW) <16,"");
|
||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
||||||
|
|
||||||
|
|
||||||
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
|
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
|
||||||
fp = fopen(fname,"a+");
|
fp = fopen(fname,"a+");
|
||||||
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
|
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
|
||||||
@@ -109,6 +112,32 @@ int write_file_matlab(const char *fname,
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( (format&MATLAB_RAW) == MATLAB_RAW ) {
|
||||||
|
int sz[16]={sizeof(short), 2*sizeof(short),
|
||||||
|
sizeof(int), 2*sizeof(int),
|
||||||
|
sizeof(char), 2*sizeof(char),
|
||||||
|
sizeof(long long),
|
||||||
|
sizeof(double), 2*sizeof(double),
|
||||||
|
sizeof(unsigned char),
|
||||||
|
sizeof(short),
|
||||||
|
sizeof(short),
|
||||||
|
sizeof(short),
|
||||||
|
sizeof(short),
|
||||||
|
sizeof(short),
|
||||||
|
sizeof(short)
|
||||||
|
};
|
||||||
|
int eltSz= sz[format&~MATLAB_RAW];
|
||||||
|
if (dec==1)
|
||||||
|
fwrite(data, eltSz, length, fp);
|
||||||
|
else
|
||||||
|
for (i=0; i<length; i+=dec)
|
||||||
|
fwrite(data+i*eltSz, eltSz, 1, fp);
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
|
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
|
||||||
fprintf(fp,"%s = [",vname);
|
fprintf(fp,"%s = [",vname);
|
||||||
|
|
||||||
@@ -214,6 +243,8 @@ int write_file_matlab(const char *fname,
|
|||||||
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||||
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(false, "unknown dump format: %d\n", format);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
|
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
|
||||||
|
|||||||
+19
-1
@@ -336,7 +336,25 @@ typedef struct {
|
|||||||
@param dec decimation level
|
@param dec decimation level
|
||||||
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
|
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
|
||||||
*/
|
*/
|
||||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
|
#define MATLAB_RAW (1<<31)
|
||||||
|
#define MATLAB_SHORT 0
|
||||||
|
#define MATLAB_CSHORT 1
|
||||||
|
#define MATLAB_INT 2
|
||||||
|
#define MATLAB_CINT 3
|
||||||
|
#define MATLAB_INT8 4
|
||||||
|
#define MATLAB_CINT8 5
|
||||||
|
#define MATLAB_LLONG 6
|
||||||
|
#define MATLAB_DOUBLE 7
|
||||||
|
#define MATLAB_CDOUBLE 8
|
||||||
|
#define MATLAB_UINT8 9
|
||||||
|
#define MATLEB_EREN1 10
|
||||||
|
#define MATLEB_EREN2 11
|
||||||
|
#define MATLEB_EREN3 12
|
||||||
|
#define MATLAB_CSHORT_BRACKET1 13
|
||||||
|
#define MATLAB_CSHORT_BRACKET2 14
|
||||||
|
#define MATLAB_CSHORT_BRACKET3 15
|
||||||
|
|
||||||
|
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format);
|
||||||
|
|
||||||
/*----------------macro definitions for reading log configuration from the config module */
|
/*----------------macro definitions for reading log configuration from the config module */
|
||||||
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
||||||
|
|||||||
Executable
+48
@@ -0,0 +1,48 @@
|
|||||||
|
<table style="border-collapse: collapse; border: none;">
|
||||||
|
<tr style="border-collapse: collapse; border: none;">
|
||||||
|
<td style="border-collapse: collapse; border: none;">
|
||||||
|
<a href="http://www.openairinterface.org/">
|
||||||
|
<img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150>
|
||||||
|
</img>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td style="border-collapse: collapse; border: none; vertical-align: center;">
|
||||||
|
<b><font size = "5">Running L3 ITTI simulator</font></b>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
This page is valid on the following branches:
|
||||||
|
|
||||||
|
- `develop` starting from tag `2020.w48`
|
||||||
|
|
||||||
|
# 1. Building the ITTI simulator.
|
||||||
|
|
||||||
|
The ITTI simulator is available directly from the standard build.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ source oaienv
|
||||||
|
$ cd cmake_targets
|
||||||
|
$ sudo ./build_oai -x -w None -c -ittiSIM
|
||||||
|
```
|
||||||
|
|
||||||
|
# 2. Running the ITTI simulator.
|
||||||
|
|
||||||
|
The ITTI simulator establishes ITTI-threaded communication between the gNB RRC task and the UE RRC task.
|
||||||
|
|
||||||
|
This allows to test the sequence of NGAP/RRC/NAS messages.
|
||||||
|
|
||||||
|
The main limitations are:
|
||||||
|
|
||||||
|
- NAS is a simple stub that just sends and receives messages
|
||||||
|
- only initial Attach sequence
|
||||||
|
|
||||||
|
## 2.1. Starting the ITTI simulator
|
||||||
|
|
||||||
|
The ITTI simulator is able to run with a connected 5GC or without any.
|
||||||
|
The develop branch tag `2020.w48` only works RRC without 5GC connection.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo -E ./ran_build/build/nr-ittisim -O gnb.conf
|
||||||
|
```
|
||||||
|
|
||||||
+1
-1
@@ -186,7 +186,7 @@ development], for FR2 does not exist yet.
|
|||||||
3) allocate a CCE for the UE (and return if it is not possible)
|
3) allocate a CCE for the UE (and return if it is not possible)
|
||||||
4) Calculate DMRS stuff (nr_save_pusch_fields()) and the TBS.
|
4) Calculate DMRS stuff (nr_save_pusch_fields()) and the TBS.
|
||||||
5) Mark used resources in vrb_map_UL.
|
5) Mark used resources in vrb_map_UL.
|
||||||
* loop through all users: get a free HARQ PID using select_ul_harq_pid() and
|
* loop through all users: get a free HARQ PID and
|
||||||
update statistics. Fill nFAPI structures directly for PUSCH, and call
|
update statistics. Fill nFAPI structures directly for PUSCH, and call
|
||||||
config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH messages.
|
config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH messages.
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ int config_sync_var=-1;
|
|||||||
volatile int oai_exit = 0;
|
volatile int oai_exit = 0;
|
||||||
double cpuf;
|
double cpuf;
|
||||||
uint16_t sf_ahead=4;
|
uint16_t sf_ahead=4;
|
||||||
|
//uint16_t slot_ahead=6;
|
||||||
int otg_enabled;
|
int otg_enabled;
|
||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
//#define DEBUG_THREADS 1
|
//#define DEBUG_THREADS 1
|
||||||
|
|
||||||
//#define USRP_DEBUG 1
|
//#define USRP_DEBUG 1
|
||||||
@@ -137,6 +137,7 @@ void wakeup_prach_gNB(PHY_VARS_gNB *gNB, RU_t *ru, int frame, int subframe);
|
|||||||
|
|
||||||
extern uint8_t nfapi_mode;
|
extern uint8_t nfapi_mode;
|
||||||
extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
||||||
|
extern void oai_slot_ind(uint16_t sfn, uint16_t slot);
|
||||||
extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
|
extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
|
||||||
|
|
||||||
//#define TICK_TO_US(ts) (ts.diff)
|
//#define TICK_TO_US(ts) (ts.diff)
|
||||||
@@ -151,13 +152,14 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
|
|||||||
|
|
||||||
// *******************************************************************
|
// *******************************************************************
|
||||||
// NFAPI not yet supported for NR - this code has to be revised
|
// NFAPI not yet supported for NR - this code has to be revised
|
||||||
if (nfapi_mode == 1) {
|
if (NFAPI_MODE == NFAPI_MODE_PNF) {
|
||||||
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
|
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
|
||||||
//add_subframe(&frame, &subframe, 4);
|
//add_subframe(&frame, &subframe, 4);
|
||||||
//oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
|
//oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
|
||||||
//LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
|
//LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
|
||||||
start_meas(&nfapi_meas);
|
start_meas(&nfapi_meas);
|
||||||
oai_subframe_ind(frame_rx, slot_rx);
|
// oai_subframe_ind(frame_rx, slot_rx);
|
||||||
|
oai_slot_ind(frame_rx, slot_rx);
|
||||||
stop_meas(&nfapi_meas);
|
stop_meas(&nfapi_meas);
|
||||||
|
|
||||||
/*if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
|
/*if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
|
||||||
@@ -873,10 +875,7 @@ void init_gNB_proc(int inst) {
|
|||||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||||
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||||
int numCPU = sysconf(_SC_NPROCESSORS_ONLN);
|
int numCPU = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
uint32_t num_threads_pusch;
|
int threadCnt = min(numCPU, gNB->pusch_proc_threads);
|
||||||
paramdef_t PUSCHThreads[] = NUM_THREADS_DESC;
|
|
||||||
config_get( PUSCHThreads,sizeof(PUSCHThreads)/sizeof(paramdef_t),NULL);
|
|
||||||
int threadCnt = min(numCPU, num_threads_pusch);
|
|
||||||
char ul_pool[80];
|
char ul_pool[80];
|
||||||
sprintf(ul_pool,"-1");
|
sprintf(ul_pool,"-1");
|
||||||
int s_offset = 0;
|
int s_offset = 0;
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ int attach_rru(RU_t *ru);
|
|||||||
int connect_rau(RU_t *ru);
|
int connect_rau(RU_t *ru);
|
||||||
|
|
||||||
uint16_t sf_ahead;
|
uint16_t sf_ahead;
|
||||||
|
uint16_t slot_ahead;
|
||||||
uint16_t sl_ahead;
|
uint16_t sl_ahead;
|
||||||
|
|
||||||
extern int emulate_rf;
|
extern int emulate_rf;
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
|
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
|
||||||
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
|
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
|
||||||
#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
|
#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
|
||||||
|
#define CONFIG_HLP_MAC "Disable the MAC procedures at UE side (default is enabled)\n"
|
||||||
#define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n"
|
#define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n"
|
||||||
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
|
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
|
||||||
#define CONFIG_HLP_TPORT "tracer port\n"
|
#define CONFIG_HLP_TPORT "tracer port\n"
|
||||||
|
|||||||
@@ -87,13 +87,13 @@ unsigned short config_frames[4] = {2,9,11,13};
|
|||||||
#include "gnb_paramdef.h"
|
#include "gnb_paramdef.h"
|
||||||
#include "f1ap_cu_task.h"
|
#include "f1ap_cu_task.h"
|
||||||
#include "f1ap_du_task.h"
|
#include "f1ap_du_task.h"
|
||||||
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
|
||||||
pthread_cond_t nfapi_sync_cond;
|
pthread_cond_t nfapi_sync_cond;
|
||||||
pthread_mutex_t nfapi_sync_mutex;
|
pthread_mutex_t nfapi_sync_mutex;
|
||||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||||
|
|
||||||
uint8_t nfapi_mode = 0; // Default to monolithic mode
|
extern uint8_t nfapi_mode; // Default to monolithic mode
|
||||||
|
|
||||||
pthread_cond_t sync_cond;
|
pthread_cond_t sync_cond;
|
||||||
pthread_mutex_t sync_mutex;
|
pthread_mutex_t sync_mutex;
|
||||||
@@ -836,7 +836,7 @@ if(!IS_SOFTMODEM_NOS1)
|
|||||||
nr_read_config_and_init();
|
nr_read_config_and_init();
|
||||||
} else {
|
} else {
|
||||||
printf("No ITTI, Initializing L1\n");
|
printf("No ITTI, Initializing L1\n");
|
||||||
RCconfig_L1();
|
RCconfig_NR_L1();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RC.nb_nr_inst > 0) {
|
if (RC.nb_nr_inst > 0) {
|
||||||
@@ -874,7 +874,7 @@ if(!IS_SOFTMODEM_NOS1)
|
|||||||
|
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
||||||
if (nfapi_mode) {
|
if (NFAPI_MODE) {
|
||||||
printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
|
printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
|
||||||
pthread_cond_init(&sync_cond,NULL);
|
pthread_cond_init(&sync_cond,NULL);
|
||||||
pthread_mutex_init(&sync_mutex, NULL);
|
pthread_mutex_init(&sync_mutex, NULL);
|
||||||
@@ -882,7 +882,7 @@ if(!IS_SOFTMODEM_NOS1)
|
|||||||
|
|
||||||
const char *nfapi_mode_str = "<UNKNOWN>";
|
const char *nfapi_mode_str = "<UNKNOWN>";
|
||||||
|
|
||||||
switch(nfapi_mode) {
|
switch(NFAPI_MODE) {
|
||||||
case 0:
|
case 0:
|
||||||
nfapi_mode_str = "MONOLITHIC";
|
nfapi_mode_str = "MONOLITHIC";
|
||||||
break;
|
break;
|
||||||
@@ -902,7 +902,7 @@ if(!IS_SOFTMODEM_NOS1)
|
|||||||
|
|
||||||
printf("NFAPI MODE:%s\n", nfapi_mode_str);
|
printf("NFAPI MODE:%s\n", nfapi_mode_str);
|
||||||
|
|
||||||
if (nfapi_mode==2) // VNF
|
if (NFAPI_MODE==NFAPI_MODE_VNF)
|
||||||
wait_nfapi_init("main?");
|
wait_nfapi_init("main?");
|
||||||
|
|
||||||
printf("START MAIN THREADS\n");
|
printf("START MAIN THREADS\n");
|
||||||
@@ -931,10 +931,11 @@ if(!IS_SOFTMODEM_NOS1)
|
|||||||
|
|
||||||
config_sync_var=0;
|
config_sync_var=0;
|
||||||
|
|
||||||
if (nfapi_mode==1) { // PNF
|
if (NFAPI_MODE==NFAPI_MODE_PNF) {
|
||||||
wait_nfapi_init("main?");
|
wait_nfapi_init("main?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (NODE_IS_DU(node_type) || (node_type == ngran_gNB)) {
|
if (NODE_IS_DU(node_type) || (node_type == ngran_gNB)) {
|
||||||
printf("wait RUs\n");
|
printf("wait RUs\n");
|
||||||
wait_RUs();
|
wait_RUs();
|
||||||
@@ -951,6 +952,13 @@ if(!IS_SOFTMODEM_NOS1)
|
|||||||
p.ru=RC.ru[0];
|
p.ru=RC.ru[0];
|
||||||
load_softscope("nr",&p);
|
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 != 1 && nfapi_mode != 2) {
|
if (nfapi_mode != 1 && nfapi_mode != 2) {
|
||||||
printf("Not NFAPI mode - call init_eNB_afterRU()\n");
|
printf("Not NFAPI mode - call init_eNB_afterRU()\n");
|
||||||
|
|||||||
+32
-82
@@ -18,49 +18,16 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
#include "executables/thread-common.h"
|
|
||||||
#include "executables/nr-uesoftmodem.h"
|
#include "executables/nr-uesoftmodem.h"
|
||||||
|
|
||||||
#include "NR_MAC_UE/mac.h"
|
|
||||||
//#include "RRC/LTE/rrc_extern.h"
|
|
||||||
#include "PHY_INTERFACE/phy_interface_extern.h"
|
|
||||||
|
|
||||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
|
||||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
|
||||||
|
|
||||||
#include "fapi_nr_ue_l1.h"
|
|
||||||
#include "PHY/phy_extern_nr_ue.h"
|
#include "PHY/phy_extern_nr_ue.h"
|
||||||
#include "PHY/INIT/phy_init.h"
|
#include "PHY/INIT/phy_init.h"
|
||||||
#include "PHY/MODULATION/modulation_UE.h"
|
|
||||||
#include "NR_MAC_UE/mac_proto.h"
|
#include "NR_MAC_UE/mac_proto.h"
|
||||||
#include "RRC/NR_UE/rrc_proto.h"
|
#include "RRC/NR_UE/rrc_proto.h"
|
||||||
|
|
||||||
#include "SCHED_NR_UE/phy_frame_config_nr.h"
|
#include "SCHED_NR_UE/phy_frame_config_nr.h"
|
||||||
#include "SCHED_NR_UE/defs.h"
|
#include "SCHED_NR_UE/defs.h"
|
||||||
|
|
||||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||||
|
|
||||||
#include "common/utils/LOG/log.h"
|
|
||||||
#include "common/utils/system.h"
|
|
||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
|
||||||
#include "executables/nr-softmodem.h"
|
|
||||||
|
|
||||||
#include "T.h"
|
|
||||||
|
|
||||||
#ifdef XFORMS
|
|
||||||
#include "PHY/TOOLS/nr_phy_scope.h"
|
|
||||||
|
|
||||||
extern char do_forms;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Missing stuff?
|
|
||||||
int next_ra_frame = 0;
|
|
||||||
module_id_t next_Mod_id = 0;
|
|
||||||
|
|
||||||
extern double cpuf;
|
|
||||||
//static nfapi_nr_config_request_t config_t;
|
|
||||||
//static nfapi_nr_config_request_t* config =&config_t;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NR SLOT PROCESSING SEQUENCE
|
* NR SLOT PROCESSING SEQUENCE
|
||||||
*
|
*
|
||||||
@@ -124,16 +91,12 @@ extern double cpuf;
|
|||||||
#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 */
|
#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
|
#endif
|
||||||
|
|
||||||
#define FRAME_PERIOD 100000000ULL
|
|
||||||
#define DAQ_PERIOD 66667ULL
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
pss=0,
|
pss = 0,
|
||||||
pbch=1,
|
pbch = 1,
|
||||||
si=2
|
si = 2
|
||||||
} sync_mode_t;
|
} sync_mode_t;
|
||||||
|
|
||||||
|
|
||||||
void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t UE_id,
|
uint8_t UE_id,
|
||||||
uint8_t abstraction_flag)
|
uint8_t abstraction_flag)
|
||||||
@@ -258,7 +221,7 @@ static void UE_synch(void *arg) {
|
|||||||
double rx_gain_off = 0;
|
double rx_gain_off = 0;
|
||||||
nr_get_carrier_frequencies(&UE->frame_parms, &dl_carrier, &ul_carrier);
|
nr_get_carrier_frequencies(&UE->frame_parms, &dl_carrier, &ul_carrier);
|
||||||
|
|
||||||
if (nr_initial_sync( &syncD->proc, UE, UE->mode,2) == 0) {
|
if (nr_initial_sync(&syncD->proc, UE, 2) == 0) {
|
||||||
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
|
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
|
||||||
hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) +
|
hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) +
|
||||||
round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0);
|
round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0);
|
||||||
@@ -394,26 +357,17 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
|||||||
|
|
||||||
if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
|
if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
|
||||||
nr_downlink_indication_t dl_indication;
|
nr_downlink_indication_t dl_indication;
|
||||||
memset((void*)&dl_indication, 0, sizeof(dl_indication));
|
nr_fill_dl_indication(&dl_indication, NULL, NULL, proc, UE, gNB_id);
|
||||||
|
|
||||||
dl_indication.module_id = UE->Mod_id;
|
|
||||||
dl_indication.gNB_index = gNB_id;
|
|
||||||
dl_indication.cc_id = UE->CC_id;
|
|
||||||
dl_indication.frame = proc->frame_rx;
|
|
||||||
dl_indication.slot = proc->nr_slot_rx;
|
|
||||||
dl_indication.thread_id = proc->thread_id;
|
|
||||||
|
|
||||||
UE->if_inst->dl_indication(&dl_indication, NULL);
|
UE->if_inst->dl_indication(&dl_indication, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process Rx data for one sub-frame
|
// Process Rx data for one sub-frame
|
||||||
#ifdef UE_SLOT_PARALLELISATION
|
#ifdef UE_SLOT_PARALLELISATION
|
||||||
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL );
|
||||||
#else
|
#else
|
||||||
uint64_t a=rdtsc();
|
uint64_t a=rdtsc();
|
||||||
phy_procedures_nrUE_RX( UE, proc, 0, UE->mode,get_nrUE_params()->nr_dlsch_parallel);
|
phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel);
|
||||||
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_slot_rx, (rdtsc()-a)/3500);
|
LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500);
|
||||||
//printf(">>> nr_ue_pdcch_procedures ended\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(IS_SOFTMODEM_NOS1){
|
if(IS_SOFTMODEM_NOS1){
|
||||||
@@ -424,23 +378,6 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no UL for now
|
|
||||||
/*
|
|
||||||
if (UE->mac_enabled==1) {
|
|
||||||
// trigger L2 to run ue_scheduler thru IF module
|
|
||||||
// [TODO] mapping right after NR initial sync
|
|
||||||
if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
|
|
||||||
UE->ul_indication.module_id = 0;
|
|
||||||
UE->ul_indication.gNB_index = 0;
|
|
||||||
UE->ul_indication.cc_id = 0;
|
|
||||||
UE->ul_indication.frame = proc->frame_rx;
|
|
||||||
UE->ul_indication.slot = proc->nr_slot_rx;
|
|
||||||
UE->ul_indication.thread_id = proc->thread_id;
|
|
||||||
UE->if_inst->ul_indication(&UE->ul_indication);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -705,8 +642,7 @@ void *UE_thread(void *arg) {
|
|||||||
UE->rx_offset_diff = computeSamplesShift(UE);
|
UE->rx_offset_diff = computeSamplesShift(UE);
|
||||||
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) -
|
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) -
|
||||||
UE->rx_offset_diff;
|
UE->rx_offset_diff;
|
||||||
writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms)-
|
writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff;
|
||||||
UE->rx_offset_diff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertFatal(readBlockSize ==
|
AssertFatal(readBlockSize ==
|
||||||
@@ -765,14 +701,28 @@ void *UE_thread(void *arg) {
|
|||||||
timing_advance = UE->timing_advance;
|
timing_advance = UE->timing_advance;
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertFatal( writeBlockSize ==
|
int flags = 0;
|
||||||
UE->rfdevice.trx_write_func(&UE->rfdevice,
|
int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH;
|
||||||
writeTimestamp,
|
uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
|
||||||
txp,
|
uint8_t num_UL_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots +
|
||||||
writeBlockSize,
|
(mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0);
|
||||||
UE->frame_parms.nb_antennas_tx,
|
uint8_t first_tx_slot = tdd_period - num_UL_slots;
|
||||||
1),"");
|
if (slot_tx_usrp%tdd_period==first_tx_slot)
|
||||||
|
flags=2;
|
||||||
|
else if (slot_tx_usrp%tdd_period==first_tx_slot+num_UL_slots-1)
|
||||||
|
flags = 3;
|
||||||
|
else if (slot_tx_usrp%tdd_period>first_tx_slot)
|
||||||
|
flags = 1;
|
||||||
|
|
||||||
|
if (flags || IS_SOFTMODEM_RFSIM)
|
||||||
|
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++)
|
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
|
||||||
memset(txp[i], 0, writeBlockSize);
|
memset(txp[i], 0, writeBlockSize);
|
||||||
|
|
||||||
@@ -780,7 +730,7 @@ void *UE_thread(void *arg) {
|
|||||||
msgToPush->key=slot_nr;
|
msgToPush->key=slot_nr;
|
||||||
pushTpool(&(get_nrUE_params()->Tpool), msgToPush);
|
pushTpool(&(get_nrUE_params()->Tpool), msgToPush);
|
||||||
|
|
||||||
if ( IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR")
|
if (IS_SOFTMODEM_RFSIM) { //getenv("RFSIMULATOR")
|
||||||
// FixMe: Wait previous thread is done, because race conditions seems too bad
|
// FixMe: Wait previous thread is done, because race conditions seems too bad
|
||||||
// in case of actual RF board, the overlap between threads mitigate the issue
|
// in case of actual RF board, the overlap between threads mitigate the issue
|
||||||
// We must receive one message, that proves the slot processing is done
|
// We must receive one message, that proves the slot processing is done
|
||||||
|
|||||||
@@ -298,7 +298,6 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
|||||||
tx_gain[0][CC_id] = tx_gain[0][0];
|
tx_gain[0][CC_id] = tx_gain[0][0];
|
||||||
|
|
||||||
// Set UE variables
|
// Set UE variables
|
||||||
|
|
||||||
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
||||||
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
|
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
|
||||||
UE->tx_power_max_dBm = tx_max_power[CC_id];
|
UE->tx_power_max_dBm = tx_max_power[CC_id];
|
||||||
@@ -576,22 +575,15 @@ int main( int argc, char **argv ) {
|
|||||||
|
|
||||||
|
|
||||||
init_NR_UE_threads(1);
|
init_NR_UE_threads(1);
|
||||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
|
||||||
printf("UE threads created by %ld\n", gettid());
|
printf("UE threads created by %ld\n", gettid());
|
||||||
|
|
||||||
// wait for end of program
|
// wait for end of program
|
||||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||||
protocol_ctxt_t ctxt_pP = {0};
|
// Sleep a while before checking all parameters have been used
|
||||||
ctxt_pP.enb_flag = ENB_FLAG_NO;
|
// Some are used directly in external threads, asynchronously
|
||||||
ctxt_pP.rnti = 0x1234;
|
sleep(20);
|
||||||
RC.nrrrc = (gNB_RRC_INST **)malloc(1*sizeof(gNB_RRC_INST *));
|
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||||
RC.nrrrc[0] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST));
|
|
||||||
RC.nrrrc[0]->node_type = ngran_gNB;
|
|
||||||
rrc_ue_generate_RRCSetupRequest(&ctxt_pP, 0);
|
|
||||||
if (create_tasks_nrue(1) < 0) {
|
|
||||||
printf("cannot create ITTI tasks\n");
|
|
||||||
exit(-1); // need a softer mode
|
|
||||||
}
|
|
||||||
while(true)
|
while(true)
|
||||||
sleep(3600);
|
sleep(3600);
|
||||||
|
|
||||||
|
|||||||
@@ -50,15 +50,15 @@
|
|||||||
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
|
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
|
||||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
|
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
|
||||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \
|
{"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-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}, \
|
{"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, iptr:&(fp->N_RB_DL), defintval:25, TYPE_UINT, 0}, \
|
||||||
{"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 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}, \
|
{"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}, \
|
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||||
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
|
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,14 @@
|
|||||||
#include "executables/thread-common.h"
|
#include "executables/thread-common.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "softmodem-common.h"
|
#include "softmodem-common.h"
|
||||||
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
|
||||||
|
|
||||||
static softmodem_params_t softmodem_params;
|
static softmodem_params_t softmodem_params;
|
||||||
char *parallel_config=NULL;
|
char *parallel_config=NULL;
|
||||||
char *worker_config=NULL;
|
char *worker_config=NULL;
|
||||||
|
|
||||||
|
uint8_t nfapi_mode=0;
|
||||||
|
|
||||||
static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS;
|
static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS;
|
||||||
static struct timespec start;
|
static struct timespec start;
|
||||||
@@ -143,6 +146,7 @@ void get_common_options(uint32_t execmask) {
|
|||||||
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
||||||
|
|
||||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||||
|
nfapi_setmode(nfapi_mode);
|
||||||
}
|
}
|
||||||
void softmodem_printresources(int sig, telnet_printfunc_t pf) {
|
void softmodem_printresources(int sig, telnet_printfunc_t pf) {
|
||||||
struct rusage usage;
|
struct rusage usage;
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ extern "C"
|
|||||||
#define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n"
|
#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_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_DISABLNBIOT "disable nb-iot, even if defined in config\n"
|
||||||
|
#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
/* command line parameters common to eNodeB and UE */
|
/* command line parameters common to eNodeB and UE */
|
||||||
@@ -112,6 +113,7 @@ extern "C"
|
|||||||
#define SEND_DMRSSYNC softmodem_params.send_dmrs_sync
|
#define SEND_DMRSSYNC softmodem_params.send_dmrs_sync
|
||||||
#define USIM_TEST softmodem_params.usim_test
|
#define USIM_TEST softmodem_params.usim_test
|
||||||
#define USE_256QAM_TABLE softmodem_params.use_256qam_table
|
#define USE_256QAM_TABLE softmodem_params.use_256qam_table
|
||||||
|
#define NFAPI softmodem_params.nfapi
|
||||||
|
|
||||||
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
|
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
|
||||||
|
|
||||||
@@ -142,6 +144,7 @@ extern "C"
|
|||||||
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
|
{"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}, \
|
{"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}, \
|
{"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \
|
||||||
|
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -229,6 +232,7 @@ typedef struct {
|
|||||||
int hw_timing_advance;
|
int hw_timing_advance;
|
||||||
uint32_t send_dmrs_sync;
|
uint32_t send_dmrs_sync;
|
||||||
int use_256qam_table;
|
int use_256qam_table;
|
||||||
|
uint8_t nfapi;
|
||||||
} softmodem_params_t;
|
} softmodem_params_t;
|
||||||
|
|
||||||
extern uint64_t get_softmodem_optmask(void);
|
extern uint64_t get_softmodem_optmask(void);
|
||||||
@@ -240,6 +244,7 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
|
|||||||
extern void set_softmodem_sighandler(void);
|
extern void set_softmodem_sighandler(void);
|
||||||
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
extern uint8_t nfapi_mode;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# Procedure to run nFAPI in 5G NR
|
||||||
|
|
||||||
|
## Conributed by 5G Testbed IISC
|
||||||
|
### Developers: Sudhakar B,Mahesh K,Gokul S,Aniq U.R
|
||||||
|
|
||||||
|
## Procedure to Build gNB and UE
|
||||||
|
|
||||||
|
The regular commands to build gNB and UE can be used
|
||||||
|
```
|
||||||
|
sudo ./build_oai --gNB --UE
|
||||||
|
|
||||||
|
```
|
||||||
|
## Procedure to run NR nFAPI using RF-Simulator
|
||||||
|
|
||||||
|
### VNF command
|
||||||
|
```
|
||||||
|
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test
|
||||||
|
|
||||||
|
```
|
||||||
|
### PNF command
|
||||||
|
```
|
||||||
|
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --rfsim --phy-test --rfsimulator.serveraddr server
|
||||||
|
|
||||||
|
```
|
||||||
|
### UE command
|
||||||
|
```
|
||||||
|
sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path . -d
|
||||||
|
|
||||||
|
```
|
||||||
|
## Procedure to run NR nFAPI using Hardware
|
||||||
|
Will be updated as we have not yet currently tested on hardware
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
* In order to acheive the synchronization between VNF and PNF and receive the P7 messages within the timing window the order in which we should run the modules on different terminals is UE->VNF->PNF
|
||||||
|
* Currently only downlink is functional and working as we are still working on uplink functionality
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -23,5 +23,8 @@
|
|||||||
#define NFAPI_PNF_H__
|
#define NFAPI_PNF_H__
|
||||||
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
|
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_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);
|
||||||
|
|
||||||
void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
||||||
|
void oai_slot_ind(uint16_t sfn, uint16_t slot);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,8 +39,12 @@
|
|||||||
#include "nfapi_vnf.h"
|
#include "nfapi_vnf.h"
|
||||||
#include "PHY/defs_eNB.h"
|
#include "PHY/defs_eNB.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||||
|
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||||
|
|
||||||
#include "common/ran_context.h"
|
#include "common/ran_context.h"
|
||||||
|
|
||||||
|
#define TEST
|
||||||
|
|
||||||
extern RAN_CONTEXT_t RC;
|
extern RAN_CONTEXT_t RC;
|
||||||
extern UL_RCC_IND_t UL_RCC_INFO;
|
extern UL_RCC_IND_t UL_RCC_INFO;
|
||||||
|
|
||||||
@@ -189,11 +193,12 @@ int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t
|
|||||||
int vnf_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *codec) {
|
int vnf_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *codec) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst);
|
||||||
void install_schedule_handlers(IF_Module_t *if_inst);
|
void install_schedule_handlers(IF_Module_t *if_inst);
|
||||||
extern int single_thread_flag;
|
extern int single_thread_flag;
|
||||||
extern void init_eNB_afterRU(void);
|
extern void init_eNB_afterRU(void);
|
||||||
extern uint16_t sf_ahead;
|
extern uint16_t sf_ahead;
|
||||||
|
extern uint16_t slot_ahead;
|
||||||
|
|
||||||
void oai_create_enb(void) {
|
void oai_create_enb(void) {
|
||||||
int bodge_counter=0;
|
int bodge_counter=0;
|
||||||
@@ -231,6 +236,39 @@ void oai_enb_init(void) {
|
|||||||
init_eNB_afterRU();
|
init_eNB_afterRU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void oai_create_gnb(void) {
|
||||||
|
int bodge_counter=0;
|
||||||
|
PHY_VARS_gNB *gNB = RC.gNB[0];
|
||||||
|
RC.nb_nr_CC = (int *)malloc(sizeof(int)); // TODO: find a better function to place this in
|
||||||
|
|
||||||
|
gNB->Mod_id = bodge_counter;
|
||||||
|
gNB->CC_id = bodge_counter;
|
||||||
|
gNB->abstraction_flag = 0;
|
||||||
|
gNB->single_thread_flag = 0;//single_thread_flag;
|
||||||
|
RC.nb_nr_CC[bodge_counter] = 1;
|
||||||
|
|
||||||
|
if (gNB->if_inst==0) {
|
||||||
|
gNB->if_inst = NR_IF_Module_init(bodge_counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This will cause phy_config_request to be installed. That will result in RRC configuring the PHY
|
||||||
|
// that will result in gNB->configured being set to TRUE.
|
||||||
|
// See we need to wait for that to happen otherwise the NFAPI message exchanges won't contain the right parameter values
|
||||||
|
if (RC.gNB[0]->if_inst==0 || RC.gNB[0]->if_inst->NR_PHY_config_req==0 || RC.gNB[0]->if_inst->NR_Schedule_response==0) {
|
||||||
|
printf("RC.gNB[0][0]->if_inst->NR_PHY_config_req is not installed - install it\n");
|
||||||
|
install_nr_schedule_handlers(RC.gNB[0]->if_inst);
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
printf("%s() Waiting for gNB to become configured (by RRC/PHY) - need to wait otherwise NFAPI messages won't contain correct values\n", __FUNCTION__);
|
||||||
|
usleep(50000);
|
||||||
|
} while(gNB->configured != 1);
|
||||||
|
|
||||||
|
printf("%s() gNB is now configured\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
int pnf_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
int pnf_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||||
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
|
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
|
||||||
oai_create_enb();
|
oai_create_enb();
|
||||||
@@ -241,6 +279,16 @@ int pnf_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pnf_nr_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||||
|
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
|
||||||
|
oai_create_gnb();
|
||||||
|
nfapi_nr_pnf_param_request_t req;
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST;
|
||||||
|
nfapi_nr_vnf_pnf_param_req(config, p5_idx, &req);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
int pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||||
printf("[VNF] pnf disconnection indication idx:%d\n", p5_idx);
|
printf("[VNF] pnf disconnection indication idx:%d\n", p5_idx);
|
||||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
@@ -251,6 +299,42 @@ int pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pnf_nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_param_response_t *resp) {
|
||||||
|
printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
|
||||||
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
|
pnf_info *pnf = vnf->pnfs;
|
||||||
|
|
||||||
|
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i) {
|
||||||
|
phy_info phy;
|
||||||
|
memset(&phy,0,sizeof(phy));
|
||||||
|
phy.index = resp->pnf_phy.phy[i].phy_config_index;
|
||||||
|
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
|
||||||
|
nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
|
||||||
|
|
||||||
|
for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j) {
|
||||||
|
printf("[VNF] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
|
||||||
|
phy.rfs[0] = resp->pnf_phy.phy[i].rf_config[j].rf_config_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf->phys[0] = phy;
|
||||||
|
}
|
||||||
|
nfapi_nr_pnf_config_request_t req;
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
|
||||||
|
req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
|
||||||
|
req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
|
||||||
|
printf("DJP:Hard coded num phy rf to 2\n");
|
||||||
|
|
||||||
|
for(unsigned i = 0; i < 2; ++i) {
|
||||||
|
req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf->phys[i].id;
|
||||||
|
req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf->phys[i].index;
|
||||||
|
req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf->phys[i].rfs[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
nfapi_nr_vnf_pnf_config_req(config, p5_idx, &req);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_response_t *resp) {
|
int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_response_t *resp) {
|
||||||
printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
|
printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
|
||||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
@@ -270,7 +354,6 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
|
|||||||
|
|
||||||
pnf->phys[0] = phy;
|
pnf->phys[0] = phy;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
|
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
|
||||||
rf_info rf;
|
rf_info rf;
|
||||||
memset(&rf,0,sizeof(rf));
|
memset(&rf,0,sizeof(rf));
|
||||||
@@ -278,7 +361,6 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
|
|||||||
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
|
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
|
||||||
pnf->rfs[0] = rf;
|
pnf->rfs[0] = rf;
|
||||||
}
|
}
|
||||||
|
|
||||||
nfapi_pnf_config_request_t req;
|
nfapi_pnf_config_request_t req;
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
|
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
|
||||||
@@ -296,6 +378,31 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pnf_nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_config_response_t *resp) {
|
||||||
|
printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
|
||||||
|
|
||||||
|
if(1) {
|
||||||
|
nfapi_nr_pnf_start_request_t req;
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.header.phy_id = resp->header.phy_id;
|
||||||
|
req.header.message_id = NFAPI_PNF_START_REQUEST;
|
||||||
|
nfapi_nr_vnf_pnf_start_req(config, p5_idx, &req);
|
||||||
|
} else {
|
||||||
|
// Rather than send the pnf_start_request we will demonstrate
|
||||||
|
// sending a vendor extention message. The start request will be
|
||||||
|
// send when the vendor extension response is received
|
||||||
|
//vnf_info* vnf = (vnf_info*)(config->user_data);
|
||||||
|
vendor_ext_p5_req req;
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.header.message_id = P5_VENDOR_EXT_REQ;
|
||||||
|
req.dummy1 = 45;
|
||||||
|
req.dummy2 = 1977;
|
||||||
|
nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_response_t *resp) {
|
int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_response_t *resp) {
|
||||||
printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
|
printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
|
||||||
|
|
||||||
@@ -321,6 +428,70 @@ int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) {
|
||||||
|
struct timespec curr_t;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC,&curr_t);
|
||||||
|
//printf("\n wake_gNB_rxtx before assignment sfn:%d slot:%d TIME %d.%d",sfn,slot,curr_t.tv_sec,curr_t.tv_nsec);
|
||||||
|
gNB_L1_proc_t *proc=&gNB->proc;
|
||||||
|
gNB_L1_rxtx_proc_t *L1_proc= (slot&1)? &proc->L1_proc : &proc->L1_proc_tx;
|
||||||
|
|
||||||
|
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||||
|
//printf("%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
|
||||||
|
//int i;
|
||||||
|
struct timespec wait;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &wait);
|
||||||
|
wait.tv_sec = 0;
|
||||||
|
wait.tv_nsec +=5000L;
|
||||||
|
//wait.tv_nsec = 0;
|
||||||
|
// wake up TX for subframe n+sf_ahead
|
||||||
|
// lock the TX mutex and make sure the thread is ready
|
||||||
|
if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) {
|
||||||
|
LOG_E( PHY, "[gNB] ERROR pthread_mutex_lock for gNB RXTX thread %d (IC %d)\n", L1_proc->slot_rx&1,L1_proc->instance_cnt );
|
||||||
|
exit_fun( "error locking mutex_rxtx" );
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
static uint16_t old_slot = 0;
|
||||||
|
static uint16_t old_sfn = 0;
|
||||||
|
proc->slot_rx = old_slot;
|
||||||
|
proc->frame_rx = old_sfn;
|
||||||
|
// Try to be 1 frame back
|
||||||
|
old_slot = slot;
|
||||||
|
old_sfn = sfn;
|
||||||
|
//printf("\n wake_gNB_rxtx after assignment sfn:%d slot:%d",proc->frame_rx,proc->slot_rx);
|
||||||
|
if (old_slot == 0 && old_sfn % 100 == 0) LOG_W( PHY,"[gNB] sfn/slot:%d%d old_sfn/slot:%d%d proc[rx:%d%d]\n", sfn, slot, old_sfn, old_slot, proc->frame_rx, proc->slot_rx);
|
||||||
|
}
|
||||||
|
|
||||||
|
++L1_proc->instance_cnt;
|
||||||
|
//LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] L1_proc->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx);
|
||||||
|
// We have just received and processed the common part of a subframe, say n.
|
||||||
|
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
|
||||||
|
// transmitted timestamp of the next TX slot (first).
|
||||||
|
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
|
||||||
|
// we want to generate subframe (n+N), so TS_tx = TX_rx+N*samples_per_tti,
|
||||||
|
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
|
||||||
|
L1_proc->timestamp_tx = proc->timestamp_rx + (slot_ahead *fp->samples_per_subframe);
|
||||||
|
L1_proc->frame_rx = proc->frame_rx;
|
||||||
|
L1_proc->slot_rx = proc->slot_rx;
|
||||||
|
L1_proc->frame_tx = (L1_proc->slot_rx > (19-slot_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
|
||||||
|
L1_proc->slot_tx = (L1_proc->slot_rx + slot_ahead)%20;
|
||||||
|
|
||||||
|
//LOG_I(PHY, "sfn/sf:%d%d proc[rx:%d%d] rx:%d%d] About to wake rxtx thread\n\n", sfn, slot, proc->frame_rx, proc->slot_rx, L1_proc->frame_rx, L1_proc->slot_rx);
|
||||||
|
//printf("\nEntering wake_gNB_rxtx sfn %d slot %d\n",L1_proc->frame_rx,L1_proc->slot_rx);
|
||||||
|
// the thread can now be woken up
|
||||||
|
if (pthread_cond_signal(&L1_proc->cond) != 0) {
|
||||||
|
LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB RXn-TXnp4 thread\n");
|
||||||
|
exit_fun( "ERROR pthread_clond_signal" );
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//LOG_D(PHY,"%s() About to attempt pthread_mutex_unlock\n", __FUNCTION__);
|
||||||
|
pthread_mutex_unlock( &L1_proc->mutex );
|
||||||
|
//LOG_D(PHY,"%s() UNLOCKED pthread_mutex_unlock\n", __FUNCTION__);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
|
int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
|
||||||
L1_proc_t *proc=&eNB->proc;
|
L1_proc_t *proc=&eNB->proc;
|
||||||
L1_rxtx_proc_t *L1_proc= (sf&1)? &proc->L1_proc : &proc->L1_proc_tx;
|
L1_rxtx_proc_t *L1_proc= (sf&1)? &proc->L1_proc : &proc->L1_proc_tx;
|
||||||
@@ -416,6 +587,7 @@ int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) {
|
|||||||
printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
|
printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
|
||||||
|
|
||||||
if (sync==1 && nfapi_sync_var!=0) {
|
if (sync==1 && nfapi_sync_var!=0) {
|
||||||
|
|
||||||
printf("[VNF] Signal to OAI main code that it can go\n");
|
printf("[VNF] Signal to OAI main code that it can go\n");
|
||||||
pthread_mutex_lock(&nfapi_sync_mutex);
|
pthread_mutex_lock(&nfapi_sync_mutex);
|
||||||
nfapi_sync_var=0;
|
nfapi_sync_var=0;
|
||||||
@@ -426,6 +598,29 @@ int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn, uint16_t slot) {
|
||||||
|
static uint8_t first_time = 1;
|
||||||
|
|
||||||
|
if (first_time) {
|
||||||
|
printf("[VNF] slot indication %d\n", NFAPI_SFNSLOT2DEC(sfn, slot));
|
||||||
|
first_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RC.gNB && RC.gNB[0]->configured) {
|
||||||
|
// uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
|
||||||
|
// uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
|
||||||
|
LOG_D(PHY,"[VNF] slot indication sfn:%d sf:%d\n", sfn, slot);
|
||||||
|
wake_gNB_rxtx(RC.gNB[0], sfn, slot); // DONE: find NR equivalent
|
||||||
|
} else {
|
||||||
|
printf("[VNF] %s() RC.gNB:%p\n", __FUNCTION__, RC.gNB);
|
||||||
|
|
||||||
|
if (RC.gNB) printf("RC.gNB[0]->configured:%d\n", RC.gNB[0]->configured);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn_sf) {
|
int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn_sf) {
|
||||||
static uint8_t first_time = 1;
|
static uint8_t first_time = 1;
|
||||||
|
|
||||||
@@ -937,6 +1132,14 @@ int vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_
|
|||||||
static pthread_t vnf_start_pthread;
|
static pthread_t vnf_start_pthread;
|
||||||
static pthread_t vnf_p7_start_pthread;
|
static pthread_t vnf_p7_start_pthread;
|
||||||
|
|
||||||
|
void *vnf_nr_p7_start_thread(void *ptr) {
|
||||||
|
printf("%s()\n", __FUNCTION__);
|
||||||
|
pthread_setname_np(pthread_self(), "VNF_P7");
|
||||||
|
nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
|
||||||
|
nfapi_nr_vnf_p7_start(config);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
void *vnf_p7_start_thread(void *ptr) {
|
void *vnf_p7_start_thread(void *ptr) {
|
||||||
printf("%s()\n", __FUNCTION__);
|
printf("%s()\n", __FUNCTION__);
|
||||||
pthread_setname_np(pthread_self(), "VNF_P7");
|
pthread_setname_np(pthread_self(), "VNF_P7");
|
||||||
@@ -947,12 +1150,13 @@ void *vnf_p7_start_thread(void *ptr) {
|
|||||||
|
|
||||||
void set_thread_priority(int priority);
|
void set_thread_priority(int priority);
|
||||||
|
|
||||||
void *vnf_p7_thread_start(void *ptr) {
|
void *vnf_nr_p7_thread_start(void *ptr) {
|
||||||
set_thread_priority(79);
|
set_thread_priority(79);
|
||||||
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
|
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
|
||||||
p7_vnf->config->port = p7_vnf->local_port;
|
p7_vnf->config->port = p7_vnf->local_port;
|
||||||
p7_vnf->config->sync_indication = &phy_sync_indication;
|
p7_vnf->config->sync_indication = &phy_sync_indication;
|
||||||
p7_vnf->config->subframe_indication = &phy_subframe_indication;
|
p7_vnf->config->slot_indication = &phy_slot_indication;
|
||||||
|
|
||||||
p7_vnf->config->harq_indication = &phy_harq_indication;
|
p7_vnf->config->harq_indication = &phy_harq_indication;
|
||||||
p7_vnf->config->crc_indication = &phy_crc_indication;
|
p7_vnf->config->crc_indication = &phy_crc_indication;
|
||||||
p7_vnf->config->rx_indication = &phy_rx_indication;
|
p7_vnf->config->rx_indication = &phy_rx_indication;
|
||||||
@@ -977,11 +1181,72 @@ void *vnf_p7_thread_start(void *ptr) {
|
|||||||
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
|
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
|
||||||
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
|
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
|
||||||
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
|
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI P7 start thread %s\n", __FUNCTION__);
|
||||||
|
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_nr_p7_start_thread, p7_vnf->config);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *vnf_p7_thread_start(void *ptr) {
|
||||||
|
set_thread_priority(79);
|
||||||
|
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
|
||||||
|
p7_vnf->config->port = p7_vnf->local_port;
|
||||||
|
p7_vnf->config->sync_indication = &phy_sync_indication;
|
||||||
|
p7_vnf->config->subframe_indication = &phy_subframe_indication;
|
||||||
|
p7_vnf->config->slot_indication = &phy_slot_indication;
|
||||||
|
|
||||||
|
p7_vnf->config->harq_indication = &phy_harq_indication;
|
||||||
|
p7_vnf->config->crc_indication = &phy_crc_indication;
|
||||||
|
p7_vnf->config->rx_indication = &phy_rx_indication;
|
||||||
|
p7_vnf->config->rach_indication = &phy_rach_indication;
|
||||||
|
p7_vnf->config->srs_indication = &phy_srs_indication;
|
||||||
|
p7_vnf->config->sr_indication = &phy_sr_indication;
|
||||||
|
p7_vnf->config->cqi_indication = &phy_cqi_indication;
|
||||||
|
p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
|
||||||
|
p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
|
||||||
|
p7_vnf->config->nrach_indication = &phy_nrach_indication;
|
||||||
|
p7_vnf->config->malloc = &vnf_allocate;
|
||||||
|
p7_vnf->config->free = &vnf_deallocate;
|
||||||
|
p7_vnf->config->trace = &vnf_trace;
|
||||||
|
p7_vnf->config->vendor_ext = &phy_vendor_ext;
|
||||||
|
p7_vnf->config->user_data = p7_vnf;
|
||||||
|
p7_vnf->mac->user_data = p7_vnf;
|
||||||
|
p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
|
||||||
|
p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
|
||||||
|
p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
|
||||||
|
p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
|
||||||
|
p7_vnf->config->codec_config.allocate = &vnf_allocate;
|
||||||
|
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
|
||||||
|
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
|
||||||
|
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI P7 start thread %s\n", __FUNCTION__);
|
||||||
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config);
|
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pnf_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_start_response_t *resp) {
|
||||||
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
|
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||||
|
pnf_info *pnf = vnf->pnfs;
|
||||||
|
nfapi_nr_param_request_scf_t req;
|
||||||
|
printf("[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n", p5_idx, config, config->user_data, vnf->p7_vnfs[0].config, vnf->p7_vnfs[0].thread_started);
|
||||||
|
|
||||||
|
if(p7_vnf->thread_started == 0) {
|
||||||
|
pthread_t vnf_p7_thread;
|
||||||
|
pthread_create(&vnf_p7_thread, NULL, &vnf_nr_p7_thread_start, p7_vnf);
|
||||||
|
p7_vnf->thread_started = 1;
|
||||||
|
} else {
|
||||||
|
// P7 thread already running.
|
||||||
|
}
|
||||||
|
|
||||||
|
// start all the phys in the pnf.
|
||||||
|
printf("[VNF] Sending NFAPI_VNF_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST;
|
||||||
|
req.header.phy_id = pnf->phys[0].id;
|
||||||
|
nfapi_nr_vnf_param_req(config, p5_idx, &req);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_response_t *resp) {
|
int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_response_t *resp) {
|
||||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||||
@@ -998,7 +1263,7 @@ int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_re
|
|||||||
}
|
}
|
||||||
|
|
||||||
// start all the phys in the pnf.
|
// start all the phys in the pnf.
|
||||||
printf("[VNF] Sending NFAPI_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
|
printf("[VNF] Sending NFAPI_VNF_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.header.message_id = NFAPI_PARAM_REQUEST;
|
req.header.message_id = NFAPI_PARAM_REQUEST;
|
||||||
req.header.phy_id = pnf->phys[0].id;
|
req.header.phy_id = pnf->phys[0].id;
|
||||||
@@ -1008,6 +1273,69 @@ int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_re
|
|||||||
|
|
||||||
extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
|
extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
|
||||||
|
|
||||||
|
int nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_response_scf_t *resp) {
|
||||||
|
|
||||||
|
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||||
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
|
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||||
|
pnf_info *pnf = vnf->pnfs;
|
||||||
|
phy_info *phy = pnf->phys;
|
||||||
|
struct sockaddr_in pnf_p7_sockaddr;
|
||||||
|
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0]; // check
|
||||||
|
phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
|
||||||
|
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
|
||||||
|
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
|
||||||
|
// for now just 1
|
||||||
|
printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled,
|
||||||
|
p7_vnf->periodic_timing_period);
|
||||||
|
req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST;
|
||||||
|
req->header.phy_id = phy->id;
|
||||||
|
printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
|
||||||
|
//printf("\n NR bandP =%d\n",req->nfapi_config.rf_bands.rf_band[0]);
|
||||||
|
|
||||||
|
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NR_NFAPI_P7_VNF_PORT_TAG;
|
||||||
|
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
|
||||||
|
req->num_tlv++;
|
||||||
|
printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port);
|
||||||
|
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
|
||||||
|
struct sockaddr_in vnf_p7_sockaddr;
|
||||||
|
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
|
||||||
|
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
|
||||||
|
req->num_tlv++;
|
||||||
|
printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
|
||||||
|
req->nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
|
||||||
|
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
|
||||||
|
printf("\n[VNF]Timing window tag : %d Timing window:%u\n",NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, p7_vnf->timing_window);
|
||||||
|
req->num_tlv++;
|
||||||
|
|
||||||
|
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
|
||||||
|
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG;
|
||||||
|
req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled);
|
||||||
|
req->num_tlv++;
|
||||||
|
|
||||||
|
if(p7_vnf->periodic_timing_enabled) {
|
||||||
|
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG;
|
||||||
|
req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period;
|
||||||
|
req->num_tlv++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TODO: Assign tag and value for P7 message offsets
|
||||||
|
req->nfapi_config.dl_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_DL_TTI_TIMING_OFFSET;
|
||||||
|
req->nfapi_config.ul_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_TTI_TIMING_OFFSET;
|
||||||
|
req->nfapi_config.ul_dci_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_DCI_TIMING_OFFSET;
|
||||||
|
req->nfapi_config.tx_data_timing_offset.tl.tag = NFAPI_NR_NFAPI_TX_DATA_TIMING_OFFSET;
|
||||||
|
|
||||||
|
vendor_ext_tlv_2 ve2;
|
||||||
|
memset(&ve2, 0, sizeof(ve2));
|
||||||
|
ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
|
||||||
|
ve2.dummy = 2016;
|
||||||
|
req->vendor_extension = &ve2.tl;
|
||||||
|
nfapi_nr_vnf_config_req(config, p5_idx, req);
|
||||||
|
printf("[VNF] Sent NFAPI_VNF_CONFIG_REQ num_tlv:%u\n",req->num_tlv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t *resp) {
|
int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t *resp) {
|
||||||
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
@@ -1016,7 +1344,7 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
|
|||||||
phy_info *phy = pnf->phys;
|
phy_info *phy = pnf->phys;
|
||||||
struct sockaddr_in pnf_p7_sockaddr;
|
struct sockaddr_in pnf_p7_sockaddr;
|
||||||
nfapi_config_request_t *req = &RC.mac[0]->config[0];
|
nfapi_config_request_t *req = &RC.mac[0]->config[0];
|
||||||
phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
|
phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
|
||||||
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
|
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
|
||||||
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
|
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
|
||||||
// for now just 1
|
// for now just 1
|
||||||
@@ -1062,6 +1390,19 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_response_scf_t *resp) {
|
||||||
|
nfapi_nr_start_request_scf_t req;
|
||||||
|
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||||
|
printf("[VNF] Calling oai_enb_init()\n");
|
||||||
|
oai_enb_init(); // TODO: change to gnb
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_REQUEST;
|
||||||
|
req.header.phy_id = resp->header.phy_id;
|
||||||
|
nfapi_nr_vnf_start_req(config, p5_idx, &req);
|
||||||
|
printf("[VNF] Send NFAPI_VNF_START_REQUEST idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response_t *resp) {
|
int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response_t *resp) {
|
||||||
nfapi_start_request_t req;
|
nfapi_start_request_t req;
|
||||||
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||||
@@ -1085,6 +1426,17 @@ int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_response_scf_t *resp) {
|
||||||
|
printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||||
|
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||||
|
pnf_info *pnf = vnf->pnfs;
|
||||||
|
phy_info *phy = pnf->phys;
|
||||||
|
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||||
|
|
||||||
|
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, phy->remote_port, phy->id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg) {
|
int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg) {
|
||||||
printf("[VNF] %s\n", __FUNCTION__);
|
printf("[VNF] %s\n", __FUNCTION__);
|
||||||
|
|
||||||
@@ -1129,6 +1481,13 @@ void vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header) {
|
|||||||
|
|
||||||
nfapi_vnf_config_t *config = 0;
|
nfapi_vnf_config_t *config = 0;
|
||||||
|
|
||||||
|
void vnf_nr_start_thread(void *ptr) {
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
|
||||||
|
pthread_setname_np(pthread_self(), "VNF");
|
||||||
|
config = (nfapi_vnf_config_t *)ptr;
|
||||||
|
nfapi_nr_vnf_start(config);
|
||||||
|
}
|
||||||
|
|
||||||
void vnf_start_thread(void *ptr) {
|
void vnf_start_thread(void *ptr) {
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
|
||||||
pthread_setname_np(pthread_self(), "VNF");
|
pthread_setname_np(pthread_self(), "VNF");
|
||||||
@@ -1138,7 +1497,57 @@ void vnf_start_thread(void *ptr) {
|
|||||||
|
|
||||||
static vnf_info vnf;
|
static vnf_info vnf;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
||||||
|
nfapi_setmode(NFAPI_MODE_VNF);
|
||||||
|
memset(&vnf, 0, sizeof(vnf));
|
||||||
|
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
|
||||||
|
vnf.p7_vnfs[0].timing_window = 32;
|
||||||
|
vnf.p7_vnfs[0].periodic_timing_enabled = 1;
|
||||||
|
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
|
||||||
|
vnf.p7_vnfs[0].periodic_timing_period = 10;
|
||||||
|
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
|
||||||
|
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
|
||||||
|
//vnf.p7_vnfs[0].local_port = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
|
||||||
|
vnf.p7_vnfs[0].local_port = 50011;
|
||||||
|
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
|
||||||
|
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
|
||||||
|
config->malloc = malloc;
|
||||||
|
config->free = free;
|
||||||
|
config->trace = &vnf_trace;
|
||||||
|
config->vnf_p5_port = vnf_p5_port;
|
||||||
|
config->vnf_ipv4 = 1;
|
||||||
|
config->vnf_ipv6 = 0;
|
||||||
|
config->pnf_list = 0;
|
||||||
|
config->phy_list = 0;
|
||||||
|
|
||||||
|
config->pnf_nr_connection_indication = &pnf_nr_connection_indication_cb;
|
||||||
|
config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
|
||||||
|
|
||||||
|
config->pnf_nr_param_resp = &pnf_nr_param_resp_cb;
|
||||||
|
config->pnf_nr_config_resp = &pnf_nr_config_resp_cb;
|
||||||
|
config->pnf_nr_start_resp = &pnf_nr_start_resp_cb;
|
||||||
|
config->nr_param_resp = &nr_param_resp_cb;
|
||||||
|
config->nr_config_resp = &nr_config_resp_cb;
|
||||||
|
config->nr_start_resp = &nr_start_resp_cb;
|
||||||
|
config->vendor_ext = &vendor_ext_cb;
|
||||||
|
config->user_data = &vnf;
|
||||||
|
// To allow custom vendor extentions to be added to nfapi
|
||||||
|
config->codec_config.unpack_vendor_extension_tlv = &vnf_unpack_vendor_extension_tlv;
|
||||||
|
config->codec_config.pack_vendor_extension_tlv = &vnf_pack_vendor_extension_tlv;
|
||||||
|
config->codec_config.unpack_p4_p5_vendor_extension = &vnf_unpack_p4_p5_vendor_extension;
|
||||||
|
config->codec_config.pack_p4_p5_vendor_extension = &vnf_pack_p4_p5_vendor_extension;
|
||||||
|
config->allocate_p4_p5_vendor_ext = &vnf_allocate_p4_p5_vendor_ext;
|
||||||
|
config->deallocate_p4_p5_vendor_ext = &vnf_deallocate_p4_p5_vendor_ext;
|
||||||
|
config->codec_config.allocate = &vnf_allocate;
|
||||||
|
config->codec_config.deallocate = &vnf_deallocate;
|
||||||
|
memset(&UL_RCC_INFO,0,sizeof(UL_RCC_IND_t));
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||||
|
pthread_create(&vnf_start_pthread, NULL, (void *)&vnf_nr_start_thread, config);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
||||||
nfapi_setmode(NFAPI_MODE_VNF);
|
nfapi_setmode(NFAPI_MODE_VNF);
|
||||||
memset(&vnf, 0, sizeof(vnf));
|
memset(&vnf, 0, sizeof(vnf));
|
||||||
@@ -1150,7 +1559,8 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
|||||||
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
|
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
|
||||||
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
|
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
|
||||||
vnf.p7_vnfs[0].local_port = 50001;
|
//vnf.p7_vnfs[0].local_port = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
|
||||||
|
vnf.p7_vnfs[0].local_port = 50011;
|
||||||
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
|
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
|
||||||
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
|
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
|
||||||
config->malloc = malloc;
|
config->malloc = malloc;
|
||||||
@@ -1161,8 +1571,10 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
|||||||
config->vnf_ipv6 = 0;
|
config->vnf_ipv6 = 0;
|
||||||
config->pnf_list = 0;
|
config->pnf_list = 0;
|
||||||
config->phy_list = 0;
|
config->phy_list = 0;
|
||||||
|
|
||||||
config->pnf_connection_indication = &pnf_connection_indication_cb;
|
config->pnf_connection_indication = &pnf_connection_indication_cb;
|
||||||
config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
|
config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
|
||||||
|
|
||||||
config->pnf_param_resp = &pnf_param_resp_cb;
|
config->pnf_param_resp = &pnf_param_resp_cb;
|
||||||
config->pnf_config_resp = &pnf_config_resp_cb;
|
config->pnf_config_resp = &pnf_config_resp_cb;
|
||||||
config->pnf_start_resp = &pnf_start_resp_cb;
|
config->pnf_start_resp = &pnf_start_resp_cb;
|
||||||
@@ -1203,15 +1615,17 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||||
{
|
{
|
||||||
|
//LOG_I(PHY, "sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
|
||||||
|
//printf("\nEntering oai_nfapi_nr_dl_config_req sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
|
||||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||||
|
dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
|
||||||
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||||
|
|
||||||
int retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
|
int retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
|
||||||
|
|
||||||
dl_config_req->dl_tti_request_body.nPDUs = 0;
|
dl_config_req->dl_tti_request_body.nPDUs = 0;
|
||||||
dl_config_req->dl_tti_request_body.nGroup = 0;
|
dl_config_req->dl_tti_request_body.nGroup = 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -1221,6 +1635,23 @@ int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
|
||||||
|
{
|
||||||
|
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||||
|
tx_data_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||||
|
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
|
||||||
|
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
|
||||||
|
int retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
|
||||||
|
|
||||||
|
if (retval!=0) {
|
||||||
|
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||||
|
} else {
|
||||||
|
tx_data_req->Number_of_PDUs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
|
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
|
||||||
{
|
{
|
||||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||||
@@ -1238,6 +1669,22 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
|
||||||
|
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||||
|
ul_dci_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||||
|
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
|
||||||
|
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
|
||||||
|
int retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
|
||||||
|
|
||||||
|
if (retval!=0) {
|
||||||
|
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||||
|
} else {
|
||||||
|
ul_dci_req->numPdus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
|
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
|
||||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||||
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||||
@@ -1255,6 +1702,26 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) {
|
||||||
|
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||||
|
|
||||||
|
ul_tti_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||||
|
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
|
||||||
|
|
||||||
|
int retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
|
||||||
|
|
||||||
|
if (retval!=0) {
|
||||||
|
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||||
|
} else {
|
||||||
|
// Reset number of PDUs so that it is not resent
|
||||||
|
ul_tti_req->n_pdus = 0;
|
||||||
|
ul_tti_req->n_group = 0;
|
||||||
|
ul_tti_req->n_ulcch = 0;
|
||||||
|
ul_tti_req->n_ulsch = 0;
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||||
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||||
|
|||||||
@@ -23,5 +23,5 @@
|
|||||||
#define NFAPI_VNF_H__
|
#define NFAPI_VNF_H__
|
||||||
|
|
||||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
|
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
|
||||||
|
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1019,6 +1019,7 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t tdd_period;//DL UL Transmission Periodicity. Value:0: ms0p5 1: ms0p625 2: ms1 3: ms1p25 4: ms2 5: ms2p5 6: ms5 7: ms10 8: ms3 9: ms4
|
uint8_t tdd_period;//DL UL Transmission Periodicity. Value:0: ms0p5 1: ms0p625 2: ms1 3: ms1p25 4: ms2 5: ms2p5 6: ms5 7: ms10 8: ms3 9: ms4
|
||||||
|
uint8_t tdd_period_in_slots;
|
||||||
fapi_nr_max_tdd_periodicity_t* max_tdd_periodicity_list;
|
fapi_nr_max_tdd_periodicity_t* max_tdd_periodicity_list;
|
||||||
|
|
||||||
} fapi_nr_tdd_table_t;
|
} fapi_nr_tdd_table_t;
|
||||||
|
|||||||
@@ -120,6 +120,17 @@ typedef struct {
|
|||||||
} nfapi_tl_t;
|
} nfapi_tl_t;
|
||||||
#define NFAPI_TAG_LENGTH_PACKED_LEN 4
|
#define NFAPI_TAG_LENGTH_PACKED_LEN 4
|
||||||
|
|
||||||
|
// Convenience methods to convert between SFN/SLOT formats
|
||||||
|
#define NFAPI_SFNSLOT2DEC(_sfn,_slot) ( _sfn*20 + _slot ) // total count of slots
|
||||||
|
#define NFAPI_SFNSLOTDEC2SFNSLOT(_sfnslot_dec) ((((_sfnslot_dec) / 20) << 4) | (((_sfnslot_dec) - (((_sfnslot_dec) / 20) * 10)) & 0x3F))
|
||||||
|
|
||||||
|
#define NFAPI_SFNSLOT2SFN(_sfnslot) ((_sfnslot) >> 6)
|
||||||
|
#define NFAPI_SFNSLOT2SLOT(_sfnslot) ((_sfnslot) & 0x3F)
|
||||||
|
#define NFAPI_SFNSLOTDEC2SFN(_sfnslot_dec) ((_sfnslot_dec) / 20)
|
||||||
|
#define NFAPI_SFNSLOTDEC2SLOT(_sfnslot_dec) ((_sfnslot_dec) % 20)
|
||||||
|
|
||||||
|
#define NFAPI_MAX_SFNSLOTDEC 1024*20 // 20 is for numerology 1
|
||||||
|
|
||||||
// Convenience methods to convert between SFN/SFN formats
|
// Convenience methods to convert between SFN/SFN formats
|
||||||
#define NFAPI_SFNSF2DEC(_sfnsf) ((((_sfnsf) >> 4) * 10) + ((_sfnsf) & 0xF))
|
#define NFAPI_SFNSF2DEC(_sfnsf) ((((_sfnsf) >> 4) * 10) + ((_sfnsf) & 0xF))
|
||||||
#define NFAPI_SFNSFDEC2SFNSF(_sfnsf_dec) ((((_sfnsf_dec) / 10) << 4) | (((_sfnsf_dec) - (((_sfnsf_dec) / 10) * 10)) & 0xF))
|
#define NFAPI_SFNSFDEC2SFNSF(_sfnsf_dec) ((((_sfnsf_dec) / 10) << 4) | (((_sfnsf_dec) - (((_sfnsf_dec) / 10) * 10)) & 0xF))
|
||||||
@@ -176,7 +187,6 @@ typedef enum {
|
|||||||
NFAPI_DL_NODE_SYNC,
|
NFAPI_DL_NODE_SYNC,
|
||||||
NFAPI_TIMING_INFO,
|
NFAPI_TIMING_INFO,
|
||||||
|
|
||||||
|
|
||||||
NFAPI_RSSI_REQUEST = 0x0200,
|
NFAPI_RSSI_REQUEST = 0x0200,
|
||||||
NFAPI_RSSI_RESPONSE,
|
NFAPI_RSSI_RESPONSE,
|
||||||
NFAPI_RSSI_INDICATION,
|
NFAPI_RSSI_INDICATION,
|
||||||
@@ -587,6 +597,26 @@ typedef struct {
|
|||||||
#define NFAPI_PNF_PHY_RF_TAG 0x1003
|
#define NFAPI_PNF_PHY_RF_TAG 0x1003
|
||||||
|
|
||||||
// Generic strucutre for single tlv value.
|
// Generic strucutre for single tlv value.
|
||||||
|
typedef struct {
|
||||||
|
nfapi_tl_t tl;
|
||||||
|
int32_t value;
|
||||||
|
} nfapi_int32_tlv_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_tl_t tl;
|
||||||
|
uint32_t value;
|
||||||
|
} nfapi_uint32_tlv_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_tl_t tl;
|
||||||
|
int64_t value;
|
||||||
|
} nfapi_int64_tlv_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_tl_t tl;
|
||||||
|
uint64_t value;
|
||||||
|
} nfapi_uint64_tlv_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_tl_t tl;
|
nfapi_tl_t tl;
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
@@ -1106,6 +1136,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_p4_p5_message_header_t header;
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint8_t num_tlvs;
|
||||||
nfapi_pnf_phy_rf_config_t pnf_phy_rf_config;
|
nfapi_pnf_phy_rf_config_t pnf_phy_rf_config;
|
||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
} nfapi_pnf_config_request_t;
|
} nfapi_pnf_config_request_t;
|
||||||
@@ -2466,7 +2497,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_p7_message_header_t header;
|
nfapi_p7_message_header_t header;
|
||||||
uint32_t t1;
|
uint32_t t1;
|
||||||
int32_t delta_sfn_sf;
|
int32_t delta_sfn_sf;
|
||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
} nfapi_dl_node_sync_t;
|
} nfapi_dl_node_sync_t;
|
||||||
|
|
||||||
@@ -2481,22 +2512,50 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_p7_message_header_t header;
|
nfapi_p7_message_header_t header;
|
||||||
uint32_t last_sfn_sf;
|
uint32_t last_sfn_sf;
|
||||||
|
|
||||||
uint32_t time_since_last_timing_info;
|
uint32_t time_since_last_timing_info;
|
||||||
uint32_t dl_config_jitter;
|
uint32_t dl_config_jitter;
|
||||||
uint32_t tx_request_jitter;
|
uint32_t tx_request_jitter;
|
||||||
uint32_t ul_config_jitter;
|
uint32_t ul_config_jitter;
|
||||||
uint32_t hi_dci0_jitter;
|
uint32_t hi_dci0_jitter;
|
||||||
|
|
||||||
int32_t dl_config_latest_delay;
|
int32_t dl_config_latest_delay;
|
||||||
int32_t tx_request_latest_delay;
|
int32_t tx_request_latest_delay;
|
||||||
int32_t ul_config_latest_delay;
|
int32_t ul_config_latest_delay;
|
||||||
int32_t hi_dci0_latest_delay;
|
int32_t hi_dci0_latest_delay;
|
||||||
|
|
||||||
int32_t dl_config_earliest_arrival;
|
int32_t dl_config_earliest_arrival;
|
||||||
int32_t tx_request_earliest_arrival;
|
int32_t tx_request_earliest_arrival;
|
||||||
int32_t ul_config_earliest_arrival;
|
int32_t ul_config_earliest_arrival;
|
||||||
int32_t hi_dci0_earliest_arrival;
|
int32_t hi_dci0_earliest_arrival;
|
||||||
|
|
||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
} nfapi_timing_info_t;
|
} nfapi_timing_info_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p7_message_header_t header;
|
||||||
|
|
||||||
|
uint32_t last_sfn;
|
||||||
|
uint32_t last_slot;
|
||||||
|
uint32_t time_since_last_timing_info;
|
||||||
|
|
||||||
|
uint32_t dl_tti_jitter;
|
||||||
|
uint32_t tx_data_request_jitter;
|
||||||
|
uint32_t ul_tti_jitter;
|
||||||
|
uint32_t ul_dci_jitter;
|
||||||
|
|
||||||
|
int32_t dl_tti_latest_delay;
|
||||||
|
int32_t tx_data_request_latest_delay;
|
||||||
|
int32_t ul_tti_latest_delay;
|
||||||
|
int32_t ul_dci_latest_delay;
|
||||||
|
|
||||||
|
int32_t dl_tti_earliest_arrival;
|
||||||
|
int32_t tx_data_request_earliest_arrival;
|
||||||
|
int32_t ul_tti_earliest_arrival;
|
||||||
|
int32_t ul_dci_earliest_arrival;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_timing_info_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_tl_t tl;
|
nfapi_tl_t tl;
|
||||||
uint32_t handle;
|
uint32_t handle;
|
||||||
@@ -3653,6 +3712,50 @@ typedef struct {
|
|||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
} nfapi_nmm_stop_response_t;
|
} nfapi_nmm_stop_response_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// TODO: see if this needs to be uncommented
|
||||||
|
|
||||||
|
// These TLVs are used to setup the transport connection between VNF and PNF
|
||||||
|
nfapi_ipv4_address_t p7_vnf_address_ipv4;
|
||||||
|
nfapi_ipv6_address_t p7_vnf_address_ipv6;
|
||||||
|
nfapi_uint16_tlv_t p7_vnf_port;
|
||||||
|
|
||||||
|
nfapi_ipv4_address_t p7_pnf_address_ipv4;
|
||||||
|
nfapi_ipv6_address_t p7_pnf_address_ipv6;
|
||||||
|
nfapi_uint16_tlv_t p7_pnf_port;
|
||||||
|
|
||||||
|
nfapi_uint8_tlv_t timing_window; //Value: 0 → 30,000 microseconds
|
||||||
|
nfapi_uint8_tlv_t timing_info_mode;
|
||||||
|
nfapi_uint8_tlv_t timing_info_period;
|
||||||
|
|
||||||
|
nfapi_uint32_tlv_t dl_tti_timing_offset;
|
||||||
|
nfapi_uint32_tlv_t ul_tti_timing_offset;
|
||||||
|
nfapi_uint32_tlv_t ul_dci_timing_offset;
|
||||||
|
nfapi_uint32_tlv_t tx_data_timing_offset;
|
||||||
|
|
||||||
|
// These TLVs are used to setup the transport connection between VNF and PNF
|
||||||
|
/*
|
||||||
|
nfapi_uint8_tlv_t dl_ue_per_sf;
|
||||||
|
nfapi_uint8_tlv_t ul_ue_per_sf;
|
||||||
|
|
||||||
|
// These TLVs are used by PNF to report its RF capabilities to the VNF software
|
||||||
|
nfapi_rf_bands_t rf_bands;
|
||||||
|
*/
|
||||||
|
// These TLVs are used by the VNF to configure the synchronization with the PNF.
|
||||||
|
|
||||||
|
|
||||||
|
// These TLVs are used by the VNF to configure the RF in the PNF
|
||||||
|
//nfapi_uint16_tlv_t max_transmit_power;
|
||||||
|
//nfapi_uint32_tlv_t nrarfcn;
|
||||||
|
|
||||||
|
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
|
||||||
|
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
|
||||||
|
// nfapi_nmm_frequency_bands_t nmm_lte_frequency_bands;
|
||||||
|
// nfapi_uint8_tlv_t nmm_uplink_rssi_supported;
|
||||||
|
|
||||||
|
} nfapi_nr_nfapi_t;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configuration options for the encode decode functions
|
// Configuration options for the encode decode functions
|
||||||
//
|
//
|
||||||
@@ -3864,6 +3967,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||||
|
int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||||
|
|
||||||
/*! \brief Decodes an NFAPI P5 message header
|
/*! \brief Decodes an NFAPI P5 message header
|
||||||
* \param pMessageBuf A pointer to an encoded P5 message header
|
* \param pMessageBuf A pointer to an encoded P5 message header
|
||||||
@@ -3887,6 +3991,7 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
|||||||
*
|
*
|
||||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
|
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
|
||||||
*/
|
*/
|
||||||
|
int nfapi_nr_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||||
int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config);
|
int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||||
|
|
||||||
/*! \brief Encodes an NFAPI P7 message to a buffer
|
/*! \brief Encodes an NFAPI P7 message to a buffer
|
||||||
@@ -3900,6 +4005,7 @@ int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||||
|
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||||
|
|
||||||
/*! \brief Decodes an NFAPI P7 message header
|
/*! \brief Decodes an NFAPI P7 message header
|
||||||
* \param pMessageBuf A pointer to an encoded P7 message header
|
* \param pMessageBuf A pointer to an encoded P7 message header
|
||||||
@@ -3925,6 +4031,7 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
|||||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf
|
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf
|
||||||
*/
|
*/
|
||||||
int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config);
|
int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config);
|
||||||
|
int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config);
|
||||||
|
|
||||||
/*! \brief Calculates the checksum of a message
|
/*! \brief Calculates the checksum of a message
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define _NFAPI_NR_INTERFACE_H_
|
#define _NFAPI_NR_INTERFACE_H_
|
||||||
|
|
||||||
#include "nfapi_interface.h"
|
#include "nfapi_interface.h"
|
||||||
#include <nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h>
|
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
|
||||||
|
|
||||||
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
|
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
|
||||||
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
|
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
|
||||||
@@ -22,62 +22,32 @@
|
|||||||
// nFAPI enums
|
// nFAPI enums
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//These TLVs are used exclusively by nFAPI
|
//These TLVs are used exclusively by nFAPI
|
||||||
typedef struct
|
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x0100
|
||||||
{
|
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x0101
|
||||||
// These TLVs are used to setup the transport connection between VNF and PNF
|
#define NFAPI_NR_NFAPI_P7_VNF_PORT_TAG 0x0102
|
||||||
// nfapi_ipv4_address_t p7_vnf_address_ipv4;
|
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG 0x0103
|
||||||
// nfapi_ipv6_address_t p7_vnf_address_ipv6;
|
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG 0x0104
|
||||||
// nfapi_uint16_tlv_t p7_vnf_port;
|
#define NFAPI_NR_NFAPI_P7_PNF_PORT_TAG 0x0105
|
||||||
|
#define NFAPI_NR_NFAPI_DL_TTI_TIMING_OFFSET 0x0106
|
||||||
// nfapi_ipv4_address_t p7_pnf_address_ipv4;
|
#define NFAPI_NR_NFAPI_UL_TTI_TIMING_OFFSET 0x0107
|
||||||
// nfapi_ipv6_address_t p7_pnf_address_ipv6;
|
#define NFAPI_NR_NFAPI_UL_DCI_TIMING_OFFSET 0x0108
|
||||||
// nfapi_uint16_tlv_t p7_pnf_port;
|
#define NFAPI_NR_NFAPI_TX_DATA_TIMING_OFFSET 0x0109
|
||||||
|
#define NFAPI_NR_NFAPI_TIMING_WINDOW_TAG 0x011E
|
||||||
// // These TLVs are used to setup the transport connection between VNF and PNF
|
#define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x011F
|
||||||
// nfapi_uint8_tlv_t dl_ue_per_sf;
|
#define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x0120
|
||||||
// nfapi_uint8_tlv_t ul_ue_per_sf;
|
|
||||||
|
|
||||||
// These TLVs are used by PNF to report its RF capabilities to the VNF software
|
|
||||||
nfapi_rf_bands_t rf_bands;
|
|
||||||
|
|
||||||
// These TLVs are used by the VNF to configure the synchronization with the PNF.
|
|
||||||
// nfapi_uint8_tlv_t timing_window;
|
|
||||||
// nfapi_uint8_tlv_t timing_info_mode;
|
|
||||||
// nfapi_uint8_tlv_t timing_info_period;
|
|
||||||
|
|
||||||
// These TLVs are used by the VNF to configure the RF in the PNF
|
|
||||||
// nfapi_uint16_tlv_t max_transmit_power;
|
|
||||||
nfapi_uint32_tlv_t nrarfcn;
|
|
||||||
|
|
||||||
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
|
|
||||||
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
|
|
||||||
// nfapi_nmm_frequency_bands_t nmm_lte_frequency_bands;
|
|
||||||
// nfapi_uint8_tlv_t nmm_uplink_rssi_supported;
|
|
||||||
|
|
||||||
} nfapi_nr_nfapi_t;
|
|
||||||
|
|
||||||
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x5100
|
|
||||||
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x5101
|
|
||||||
#define NFAPI_NR_NFAPI_P7_VNF_PORT_TAG 0x5102
|
|
||||||
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG 0x5103
|
|
||||||
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG 0x5104
|
|
||||||
#define NFAPI_NR_NFAPI_P7_PNF_PORT_TAG 0x5105
|
|
||||||
|
|
||||||
|
/*
|
||||||
#define NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG 0x510A
|
#define NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG 0x510A
|
||||||
#define NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG 0x510B
|
#define NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG 0x510B
|
||||||
#define NFAPI_NR_NFAPI_RF_BANDS_TAG 0x5114
|
#define NFAPI_NR_NFAPI_RF_BANDS_TAG 0x5114
|
||||||
#define NFAPI_NR_NFAPI_TIMING_WINDOW_TAG 0x511E
|
|
||||||
#define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x511F
|
|
||||||
#define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x5120
|
|
||||||
#define NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG 0x5128
|
#define NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG 0x5128
|
||||||
#define NFAPI_NR_NFAPI_NRARFCN_TAG 0x5129
|
#define NFAPI_NR_NFAPI_NRARFCN_TAG 0x5129
|
||||||
#define NFAPI_NR_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG 0x5130
|
#define NFAPI_NR_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG 0x5130
|
||||||
#define NFAPI_NR_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG 0x5131
|
#define NFAPI_NR_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG 0x5131
|
||||||
#define NFAPI_NR_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG 0x5132
|
#define NFAPI_NR_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG 0x5132
|
||||||
#define NFAPI_NR_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG 0x5133
|
#define NFAPI_NR_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG 0x5133
|
||||||
|
*/
|
||||||
// P5 Message Structures
|
// P5 Message Structures
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -323,7 +293,7 @@ typedef enum {
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED=0,
|
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED=0,
|
||||||
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED
|
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED=1
|
||||||
} nfapi_nr_cce_reg_mapping_type_e;
|
} nfapi_nr_cce_reg_mapping_type_e;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|||||||
Binary file not shown.
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "stddef.h"
|
#include "stddef.h"
|
||||||
#include "nfapi_interface.h"
|
#include "nfapi_interface.h"
|
||||||
|
#include "nfapi_nr_interface.h"
|
||||||
|
|
||||||
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
|
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
|
||||||
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
|
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
|
||||||
@@ -24,25 +25,7 @@
|
|||||||
#define NFAPI_MAX_NUM_CB 8
|
#define NFAPI_MAX_NUM_CB 8
|
||||||
|
|
||||||
// Extension to the generic structures for single tlv values
|
// Extension to the generic structures for single tlv values
|
||||||
typedef struct {
|
|
||||||
nfapi_tl_t tl;
|
|
||||||
int32_t value;
|
|
||||||
} nfapi_int32_tlv_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
nfapi_tl_t tl;
|
|
||||||
uint32_t value;
|
|
||||||
} nfapi_uint32_tlv_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
nfapi_tl_t tl;
|
|
||||||
int64_t value;
|
|
||||||
} nfapi_int64_tlv_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
nfapi_tl_t tl;
|
|
||||||
uint64_t value;
|
|
||||||
} nfapi_uint64_tlv_t;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NFAPI_NR_DMRS_TYPE1=0,
|
NFAPI_NR_DMRS_TYPE1=0,
|
||||||
@@ -76,35 +59,42 @@ typedef enum {
|
|||||||
NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST= 0X05,
|
NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST= 0X05,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION=0X06,
|
NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION=0X06,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION=0X07,
|
NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION=0X07,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE=0X010D,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE=0X010F,
|
||||||
//RESERVED 0X08 ~ 0X7F
|
//RESERVED 0X08 ~ 0X7F
|
||||||
NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST= 0X80,
|
NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST= 0X80,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST= 0X81,
|
NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST= 0X81,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION=0X82,
|
NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION=0X82,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST= 0X83,
|
NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST= 0X83,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST=0X54,
|
NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST=0X84, // CHANGED TO 0X84
|
||||||
NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION=0X85,
|
NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION=0X85,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION= 0X86,
|
NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION= 0X86,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION= 0X87,
|
NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION= 0X87,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION= 0X88,
|
NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION= 0X88,
|
||||||
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89
|
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89,
|
||||||
//RESERVED 0X8a ~ 0xff
|
//RESERVED 0X8a ~ 0xff
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST = 0x0100,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE = 0x0101,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST= 0x0102,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE= 0x0103,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST= 0x0104,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE= 0x0105,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST= 0x0106,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE= 0x0107,
|
||||||
|
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC = 0x0180,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC,
|
||||||
|
NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO
|
||||||
} nfapi_nr_phy_msg_type_e;
|
} nfapi_nr_phy_msg_type_e;
|
||||||
|
|
||||||
// SCF222_5G-FAPI_PHY_SPI_Specificayion.pdf Section 3.3
|
// SCF222_5G-FAPI_PHY_SPI_Specificayion.pdf Section 3.3
|
||||||
|
|
||||||
//3.3.1 PARAM
|
//3.3.1 PARAM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//same with nfapi_param_request_t
|
//same with nfapi_param_request_t
|
||||||
typedef struct {
|
|
||||||
nfapi_p4_p5_message_header_t header;
|
|
||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
|
||||||
} nfapi_nr_param_request_t;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
NFAPI_NR_PARAM_MSG_OK = 0,
|
|
||||||
NFAPI_NR_PARAM_MSG_INVALID_STATE
|
|
||||||
|
|
||||||
} nfapi_nr_param_errors_e;
|
|
||||||
|
|
||||||
/*typedef struct {
|
/*typedef struct {
|
||||||
nfapi_nr_param_errors_e error_code;
|
nfapi_nr_param_errors_e error_code;
|
||||||
@@ -278,12 +268,6 @@ typedef struct
|
|||||||
//-------------------------------------------//
|
//-------------------------------------------//
|
||||||
//3.3.2 CONFIG
|
//3.3.2 CONFIG
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
NFAPI_NR_CONFIG_MSG_OK = 0,
|
|
||||||
NFAPI_NR_CONFIG_MSG_INVALID_CONFIG //The configuration provided has missing mandatory TLVs, or TLVs that are invalid or unsupported in this state.
|
|
||||||
} nfapi_nr_config_errors_e;
|
|
||||||
|
|
||||||
/*typedef struct {
|
/*typedef struct {
|
||||||
nfapi_nr_config_errors_e error_code;
|
nfapi_nr_config_errors_e error_code;
|
||||||
uint8_t number_of_invalid_tlvs_that_can_only_be_configured_in_idle;
|
uint8_t number_of_invalid_tlvs_that_can_only_be_configured_in_idle;
|
||||||
@@ -465,9 +449,108 @@ typedef struct
|
|||||||
|
|
||||||
} nfapi_nr_measurement_config_t;
|
} nfapi_nr_measurement_config_t;
|
||||||
|
|
||||||
|
// ERROR enums
|
||||||
|
typedef enum { // Table 2-22
|
||||||
|
NFAPI_NR_PARAM_MSG_OK = 0,
|
||||||
|
NFAPI_NR_PARAM_MSG_INVALID_STATE
|
||||||
|
} nfapi_nr_param_errors_e;
|
||||||
|
|
||||||
|
typedef enum { // Table 2-25
|
||||||
|
NFAPI_NR_CONFIG_MSG_OK = 0,
|
||||||
|
NFAPI_NR_CONFIG_MSG_INVALID_STATE, //The CONFIG.request was received when the PHY was not in the IDLE state or the CONFIGURED state.
|
||||||
|
NFAPI_NR_CONFIG_MSG_INVALID_CONFIG //The configuration provided has missing mandatory TLVs, or TLVs that are invalid or unsupported in this state.
|
||||||
|
} nfapi_nr_config_errors_e;
|
||||||
|
|
||||||
|
typedef enum { // Table 2-27
|
||||||
|
NFAPI_NR_START_MSG_OK = 0,
|
||||||
|
NFAPI_NR_START_MSG_INVALID_STATE
|
||||||
|
} nfapi_nr_start_errors_e;
|
||||||
|
|
||||||
|
//PNF P5 NR
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_param_request_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t num_tlv;
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint32_t error_code;
|
||||||
|
nfapi_pnf_param_general_t pnf_param_general;
|
||||||
|
nfapi_pnf_phy_t pnf_phy;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_param_response_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint8_t num_tlvs;
|
||||||
|
nfapi_pnf_phy_rf_config_t pnf_phy_rf_config;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_config_request_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint32_t error_code;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_config_response_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_start_request_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint32_t error_code;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_start_response_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_stop_request_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint32_t error_code;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_pnf_stop_response_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* PARAM.REQUEST */
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_param_request_scf_t;
|
||||||
|
|
||||||
|
/* PARAM.RESPONSE */
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint8_t error_code;
|
||||||
|
|
||||||
|
uint8_t num_tlv;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
|
||||||
|
nfapi_nr_cell_param_t cell_param;
|
||||||
|
nfapi_nr_carrier_param_t carrier_param;
|
||||||
|
nfapi_nr_pdcch_param_t pdcch_param;
|
||||||
|
nfapi_nr_pucch_param_t pucch_param;
|
||||||
|
nfapi_nr_pdsch_param_t pdsch_param;
|
||||||
|
nfapi_nr_pusch_param_t pusch_param;
|
||||||
|
nfapi_nr_prach_param_t prach_param;
|
||||||
|
nfapi_nr_measurement_param_t measurement_param;
|
||||||
|
nfapi_nr_nfapi_t nfapi_config;
|
||||||
|
} nfapi_nr_param_response_scf_t;
|
||||||
|
|
||||||
|
//------------------------------//
|
||||||
|
//3.3.2 CONFIG
|
||||||
|
|
||||||
|
/* CONFIG.REQUEST */
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
|
||||||
|
uint8_t num_tlv;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
|
||||||
nfapi_nr_carrier_config_t carrier_config;
|
nfapi_nr_carrier_config_t carrier_config;
|
||||||
nfapi_nr_cell_config_t cell_config;
|
nfapi_nr_cell_config_t cell_config;
|
||||||
nfapi_nr_ssb_config_t ssb_config;
|
nfapi_nr_ssb_config_t ssb_config;
|
||||||
@@ -475,20 +558,32 @@ typedef struct {
|
|||||||
nfapi_nr_ssb_table_t ssb_table;
|
nfapi_nr_ssb_table_t ssb_table;
|
||||||
nfapi_nr_tdd_table_t tdd_table;
|
nfapi_nr_tdd_table_t tdd_table;
|
||||||
nfapi_nr_measurement_config_t measurement_config;
|
nfapi_nr_measurement_config_t measurement_config;
|
||||||
|
nfapi_nr_nfapi_t nfapi_config;
|
||||||
} nfapi_nr_config_request_scf_t;
|
} nfapi_nr_config_request_scf_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* CONFIG.RESPONSE */
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
uint8_t error_code;
|
||||||
|
//uint8_t num_invalid_tlvs;
|
||||||
|
// TODO: add list of invalid/unsupported TLVs (see Table 3.18)
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_config_response_scf_t;
|
||||||
|
|
||||||
//------------------------------//
|
//------------------------------//
|
||||||
//3.3.3 START
|
//3.3.3 START
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_p4_p5_message_header_t header;
|
nfapi_p4_p5_message_header_t header;
|
||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
} nfapi_nr_start_request_t;
|
} nfapi_nr_start_request_scf_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef struct {
|
||||||
NFAPI_NR_START_MSG_INVALID_STATE
|
nfapi_p4_p5_message_header_t header;
|
||||||
} nfapi_nr_start_errors_e;
|
nfapi_nr_start_errors_e error_code;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_start_response_scf_t;
|
||||||
|
|
||||||
//3.3.4 STOP
|
//3.3.4 STOP
|
||||||
|
|
||||||
@@ -497,6 +592,7 @@ typedef struct {
|
|||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
} nfapi_nr_stop_request_t;
|
} nfapi_nr_stop_request_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_p4_p5_message_header_t header;
|
nfapi_p4_p5_message_header_t header;
|
||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
@@ -580,7 +676,7 @@ typedef struct {
|
|||||||
uint16_t sfn; //0->1023
|
uint16_t sfn; //0->1023
|
||||||
uint16_t slot;//0->319
|
uint16_t slot;//0->319
|
||||||
|
|
||||||
} nfapi_nr_slot_indication_t;
|
} nfapi_nr_slot_indication_scf_t;
|
||||||
|
|
||||||
// 3.4.2
|
// 3.4.2
|
||||||
|
|
||||||
@@ -619,8 +715,10 @@ typedef struct {
|
|||||||
uint16_t prgSize;
|
uint16_t prgSize;
|
||||||
/// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
|
/// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
|
||||||
uint8_t digBFInterfaces;
|
uint8_t digBFInterfaces;
|
||||||
|
// Depends on numPRGs
|
||||||
uint16_t PMIdx[275];
|
uint16_t PMIdx[275];
|
||||||
uint16_t *beamIdx[275];
|
// Depends on digBFInterfaces
|
||||||
|
uint16_t beamIdx[256];
|
||||||
} nfapi_nr_tx_precoding_and_beamforming_t;
|
} nfapi_nr_tx_precoding_and_beamforming_t;
|
||||||
|
|
||||||
//table 3-37
|
//table 3-37
|
||||||
@@ -630,30 +728,30 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// The RNTI used for identifying the UE when receiving the PDU Value: 1 -> 65535.
|
// The RNTI used for identifying the UE when receiving the PDU Value: 1 -> 65535.
|
||||||
uint16_t RNTI[MAX_DCI_CORESET];
|
uint16_t RNTI;
|
||||||
// For a UE-specific search space it equals the higher-layer parameter PDCCH-DMRSScrambling-ID if configured,
|
// For a UE-specific search space it equals the higher-layer parameter PDCCH-DMRSScrambling-ID if configured,
|
||||||
// otherwise it should be set to the phy cell ID. [TS38.211, sec 7.3.2.3] Value: 0->65535
|
// otherwise it should be set to the phy cell ID. [TS38.211, sec 7.3.2.3] Value: 0->65535
|
||||||
uint16_t ScramblingId[MAX_DCI_CORESET];
|
uint16_t ScramblingId;
|
||||||
// For a UE-specific search space where PDCCH-DMRSScrambling- ID is configured This param equals the CRNTI.
|
// For a UE-specific search space where PDCCH-DMRSScrambling- ID is configured This param equals the CRNTI.
|
||||||
// Otherwise, it should be set to 0. [TS38.211, sec 7.3.2.3] Value: 0 -> 65535
|
// Otherwise, it should be set to 0. [TS38.211, sec 7.3.2.3] Value: 0 -> 65535
|
||||||
uint16_t ScramblingRNTI[MAX_DCI_CORESET];
|
uint16_t ScramblingRNTI;
|
||||||
// CCE start Index used to send the DCI Value: 0->135
|
// CCE start Index used to send the DCI Value: 0->135
|
||||||
uint8_t CceIndex[MAX_DCI_CORESET];
|
uint8_t CceIndex;
|
||||||
// Aggregation level used [TS38.211, sec 7.3.2.1] Value: 1,2,4,8,16
|
// Aggregation level used [TS38.211, sec 7.3.2.1] Value: 1,2,4,8,16
|
||||||
uint8_t AggregationLevel[MAX_DCI_CORESET];
|
uint8_t AggregationLevel;
|
||||||
// Precoding and Beamforming structure See Table 3-43
|
// Precoding and Beamforming structure See Table 3-43
|
||||||
nfapi_nr_tx_precoding_and_beamforming_t precodingAndBeamforming[MAX_DCI_CORESET];
|
nfapi_nr_tx_precoding_and_beamforming_t precodingAndBeamforming;
|
||||||
// PDCCH power value used for PDCCH Format 1_0 with CRC scrambled by SI-RNTI, PI-RNTI or RA-RNTI.
|
// PDCCH power value used for PDCCH Format 1_0 with CRC scrambled by SI-RNTI, PI-RNTI or RA-RNTI.
|
||||||
// This is ratio of SSB/PBCH EPRE to PDCCH and PDCCH DMRS EPRE [TS38.213, sec 4.1]
|
// This is ratio of SSB/PBCH EPRE to PDCCH and PDCCH DMRS EPRE [TS38.213, sec 4.1]
|
||||||
// Value :0->17 Report title: 5G FAPI: PHY API Specification Issue date: 29 June 2019 Version: 222.10.17 68 Field Type Description representing -8 to 8 dB in 1dB steps
|
// Value :0->17 Report title: 5G FAPI: PHY API Specification Issue date: 29 June 2019 Version: 222.10.17 68 Field Type Description representing -8 to 8 dB in 1dB steps
|
||||||
uint8_t beta_PDCCH_1_0[MAX_DCI_CORESET];
|
uint8_t beta_PDCCH_1_0;
|
||||||
// PDCCH power value used for all other PDCCH Formats.
|
// PDCCH power value used for all other PDCCH Formats.
|
||||||
// This is ratio of SSB/PBCH block EPRE to PDCCH and PDCCH DMRS EPRE [TS38.214, sec 4.1] Values: 0: -3dB,1: 0dB,2: 3dB,3: 6dB
|
// This is ratio of SSB/PBCH block EPRE to PDCCH and PDCCH DMRS EPRE [TS38.214, sec 4.1] Values: 0: -3dB,1: 0dB,2: 3dB,3: 6dB
|
||||||
uint8_t powerControlOffsetSS[MAX_DCI_CORESET];
|
uint8_t powerControlOffsetSS;
|
||||||
// The total DCI length (in bits) including padding bits [TS38.212 sec 7.3.1] Range 0->DCI_PAYLOAD_BYTE_LEN*8
|
// The total DCI length (in bits) including padding bits [TS38.212 sec 7.3.1] Range 0->DCI_PAYLOAD_BYTE_LEN*8
|
||||||
uint16_t PayloadSizeBits[MAX_DCI_CORESET];
|
uint16_t PayloadSizeBits;
|
||||||
// DCI payload, where the actual size is defined by PayloadSizeBits. The bit order is as following bit0-bit7 are mapped to first byte of MSB - LSB
|
// DCI payload, where the actual size is defined by PayloadSizeBits. The bit order is as following bit0-bit7 are mapped to first byte of MSB - LSB
|
||||||
uint8_t Payload[MAX_DCI_CORESET][DCI_PAYLOAD_BYTE_LEN];
|
uint8_t Payload[DCI_PAYLOAD_BYTE_LEN];
|
||||||
|
|
||||||
} nfapi_nr_dl_dci_pdu_t;
|
} nfapi_nr_dl_dci_pdu_t;
|
||||||
|
|
||||||
@@ -698,7 +796,7 @@ typedef struct {
|
|||||||
///Number of DCIs in this CORESET.Value: 0->MaxDciPerSlot
|
///Number of DCIs in this CORESET.Value: 0->MaxDciPerSlot
|
||||||
uint16_t numDlDci;
|
uint16_t numDlDci;
|
||||||
///DL DCI PDU
|
///DL DCI PDU
|
||||||
nfapi_nr_dl_dci_pdu_t dci_pdu;
|
nfapi_nr_dl_dci_pdu_t dci_pdu[MAX_DCI_CORESET];
|
||||||
} nfapi_nr_dl_tti_pdcch_pdu_rel15_t;
|
} nfapi_nr_dl_tti_pdcch_pdu_rel15_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -941,6 +1039,7 @@ typedef struct {
|
|||||||
} nfapi_nr_dl_tti_request_pdu_t;
|
} nfapi_nr_dl_tti_request_pdu_t;
|
||||||
|
|
||||||
#define NFAPI_NR_MAX_DL_TTI_PDUS 32
|
#define NFAPI_NR_MAX_DL_TTI_PDUS 32
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
|
/// Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
|
||||||
uint8_t nPDUs;
|
uint8_t nPDUs;
|
||||||
@@ -954,11 +1053,28 @@ typedef struct {
|
|||||||
uint8_t PduIdx[256][12];
|
uint8_t PduIdx[256][12];
|
||||||
} nfapi_nr_dl_tti_request_body_t;
|
} nfapi_nr_dl_tti_request_body_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p7_message_header_t header;
|
||||||
|
uint32_t t1;
|
||||||
|
int32_t delta_sfn_slot;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_dl_node_sync_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
nfapi_p7_message_header_t header;
|
||||||
|
uint32_t t1;
|
||||||
|
uint32_t t2;
|
||||||
|
uint32_t t3;
|
||||||
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
|
} nfapi_nr_ul_node_sync_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nfapi_p7_message_header_t header;
|
nfapi_p7_message_header_t header;
|
||||||
/// System Frame Number (0-1023)
|
/// System Frame Number (0-1023)
|
||||||
uint16_t SFN;
|
uint16_t SFN;
|
||||||
/// Slot number (0-319)
|
/// Slot number (0-19)
|
||||||
uint16_t Slot;
|
uint16_t Slot;
|
||||||
nfapi_nr_dl_tti_request_body_t dl_tti_request_body;
|
nfapi_nr_dl_tti_request_body_t dl_tti_request_body;
|
||||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||||
@@ -973,7 +1089,7 @@ typedef struct
|
|||||||
nfapi_nr_dl_tti_ssb_pdu_t* ssb_pdu;
|
nfapi_nr_dl_tti_ssb_pdu_t* ssb_pdu;
|
||||||
} nfapi_nr_dl_pdu_configuration_t;
|
} nfapi_nr_dl_pdu_configuration_t;
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint16_t pdu_type;//0: PDCCH PDU 1: PDSCH PDU 2: CSI-RS PDU 3: SSB PDU,
|
uint16_t pdu_type;//0: PDCCH PDU 1: PDSCH PDU 2: CSI-RS PDU 3: SSB PDU,
|
||||||
@@ -1272,6 +1388,7 @@ typedef struct
|
|||||||
} nfapi_nr_ul_tti_request_number_of_groups_t;
|
} nfapi_nr_ul_tti_request_number_of_groups_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
nfapi_p7_message_header_t header;
|
||||||
uint16_t SFN; //0->1023
|
uint16_t SFN; //0->1023
|
||||||
uint16_t Slot;//0->319
|
uint16_t Slot;//0->319
|
||||||
uint8_t n_pdus;//Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
|
uint8_t n_pdus;//Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
|
||||||
@@ -1318,6 +1435,7 @@ typedef struct {
|
|||||||
} nfapi_nr_ul_dci_request_pdus_t;
|
} nfapi_nr_ul_dci_request_pdus_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
nfapi_p7_message_header_t header;
|
||||||
uint16_t SFN;
|
uint16_t SFN;
|
||||||
uint16_t Slot;
|
uint16_t Slot;
|
||||||
uint8_t numPdus;
|
uint8_t numPdus;
|
||||||
@@ -1363,6 +1481,7 @@ typedef struct
|
|||||||
#define NFAPI_NR_MAX_TX_REQUEST_PDUS 16
|
#define NFAPI_NR_MAX_TX_REQUEST_PDUS 16
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
nfapi_p7_message_header_t header;
|
||||||
uint16_t SFN;
|
uint16_t SFN;
|
||||||
uint16_t Slot;
|
uint16_t Slot;
|
||||||
uint16_t Number_of_PDUs;
|
uint16_t Number_of_PDUs;
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ int unpack_tlv_list(unpack_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPa
|
|||||||
|
|
||||||
for(idx = 0; idx < size; ++idx)
|
for(idx = 0; idx < size; ++idx)
|
||||||
{
|
{
|
||||||
if(unpack_fns[idx].tag == generic_tl.tag)
|
if(unpack_fns[idx].tag == generic_tl.tag) // match the extracted tag value with all the tags in unpack_fn list
|
||||||
{
|
{
|
||||||
tagMatch = 1;
|
tagMatch = 1;
|
||||||
nfapi_tl_t* tl = (nfapi_tl_t*)(unpack_fns[idx].tlv);
|
nfapi_tl_t* tl = (nfapi_tl_t*)(unpack_fns[idx].tlv);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+2135
-187
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,9 @@ typedef struct {
|
|||||||
|
|
||||||
int pnf_connect(pnf_t *pnf);
|
int pnf_connect(pnf_t *pnf);
|
||||||
int pnf_message_pump(pnf_t *pnf);
|
int pnf_message_pump(pnf_t *pnf);
|
||||||
|
int pnf_nr_message_pump(pnf_t *pnf);
|
||||||
|
|
||||||
|
int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
||||||
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
||||||
int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
||||||
int pnf_send_message(pnf_t* pnf, uint8_t* msg, uint32_t msg_len, uint16_t stream_id);
|
int pnf_send_message(pnf_t* pnf, uint8_t* msg, uint32_t msg_len, uint16_t stream_id);
|
||||||
|
|||||||
@@ -29,15 +29,37 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_t dl_conf_ontime;
|
uint16_t dl_conf_ontime;
|
||||||
|
uint16_t dl_tti_ontime;
|
||||||
uint16_t dl_conf_late;
|
uint16_t dl_conf_late;
|
||||||
|
uint16_t dl_tti_late;
|
||||||
uint16_t ul_conf_ontime;
|
uint16_t ul_conf_ontime;
|
||||||
|
uint16_t ul_tti_ontime;
|
||||||
uint16_t ul_conf_late;
|
uint16_t ul_conf_late;
|
||||||
|
uint16_t ul_tti_late;
|
||||||
uint16_t hi_dci0_ontime;
|
uint16_t hi_dci0_ontime;
|
||||||
uint16_t hi_dci0_late;
|
uint16_t hi_dci0_late;
|
||||||
|
uint16_t ul_dci_ontime;
|
||||||
|
uint16_t ul_dci_late;
|
||||||
uint16_t tx_ontime;
|
uint16_t tx_ontime;
|
||||||
uint16_t tx_late;
|
uint16_t tx_late;
|
||||||
|
uint16_t tx_data_ontime;
|
||||||
|
uint16_t tx_data_late;
|
||||||
} pnf_p7_stats_t;
|
} pnf_p7_stats_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct { // TODO: replace with the stats
|
||||||
|
uint16_t dl_tti_ontime;
|
||||||
|
uint16_t dl_tti_late;
|
||||||
|
uint16_t ul_tti_ontime;
|
||||||
|
uint16_t ul_tti_late;
|
||||||
|
uint16_t ul_dci_ontime;
|
||||||
|
uint16_t ul_dci_late;
|
||||||
|
uint16_t tx_data_ontime;
|
||||||
|
uint16_t tx_data_late;
|
||||||
|
} pnf_p7_nr_stats_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t* buffer;
|
uint8_t* buffer;
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
@@ -82,7 +104,7 @@ typedef struct {
|
|||||||
pthread_mutex_t pack_mutex; // should we allow the client to specifiy
|
pthread_mutex_t pack_mutex; // should we allow the client to specifiy
|
||||||
|
|
||||||
nfapi_pnf_p7_subframe_buffer_t subframe_buffer[30/*NFAPI_MAX_TIMING_WINDOW_SIZE*/];
|
nfapi_pnf_p7_subframe_buffer_t subframe_buffer[30/*NFAPI_MAX_TIMING_WINDOW_SIZE*/];
|
||||||
|
nfapi_pnf_p7_slot_buffer_t slot_buffer[30/*NFAPI_MAX_TIMING_WINDOW_SIZE*/];
|
||||||
uint32_t sequence_number;
|
uint32_t sequence_number;
|
||||||
uint16_t max_num_segments;
|
uint16_t max_num_segments;
|
||||||
|
|
||||||
@@ -94,6 +116,12 @@ typedef struct {
|
|||||||
uint16_t sfn_sf;
|
uint16_t sfn_sf;
|
||||||
uint32_t sf_start_time_hr;
|
uint32_t sf_start_time_hr;
|
||||||
int32_t sfn_sf_shift;
|
int32_t sfn_sf_shift;
|
||||||
|
|
||||||
|
uint16_t sfn;
|
||||||
|
uint16_t slot;
|
||||||
|
uint16_t sfn_slot;
|
||||||
|
uint32_t slot_start_time_hr;
|
||||||
|
int32_t slot_shift;
|
||||||
|
|
||||||
uint8_t timing_info_period_counter;
|
uint8_t timing_info_period_counter;
|
||||||
uint8_t timing_info_aperiodic_send; // 0:false 1:true
|
uint8_t timing_info_aperiodic_send; // 0:false 1:true
|
||||||
@@ -104,18 +132,26 @@ typedef struct {
|
|||||||
uint32_t ul_config_jitter;
|
uint32_t ul_config_jitter;
|
||||||
uint32_t hi_dci0_jitter;
|
uint32_t hi_dci0_jitter;
|
||||||
uint32_t tx_jitter;
|
uint32_t tx_jitter;
|
||||||
|
|
||||||
|
//P7 NR
|
||||||
|
uint32_t dl_tti_jitter;
|
||||||
|
uint32_t ul_tti_jitter;
|
||||||
|
uint32_t ul_dci_jitter;
|
||||||
|
uint32_t tx_data_jitter;
|
||||||
|
|
||||||
uint32_t tick;
|
uint32_t tick;
|
||||||
pnf_p7_stats_t stats;
|
pnf_p7_stats_t stats;
|
||||||
|
pnf_p7_nr_stats_t nr_stats;
|
||||||
|
|
||||||
} pnf_p7_t;
|
} pnf_p7_t;
|
||||||
|
|
||||||
int pnf_p7_message_pump(pnf_p7_t* pnf_p7);
|
int pnf_p7_message_pump(pnf_p7_t* pnf_p7);
|
||||||
|
int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7);
|
||||||
int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* msg, uint32_t msg_len);
|
int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* msg, uint32_t msg_len);
|
||||||
int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
|
int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
|
||||||
|
|
||||||
|
|
||||||
|
int pnf_p7_slot_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
||||||
int pnf_p7_subframe_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn_sf);
|
int pnf_p7_subframe_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn_sf);
|
||||||
|
|
||||||
pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len);
|
pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len);
|
||||||
|
|||||||
@@ -25,8 +25,14 @@ extern "C" {
|
|||||||
#include "nfapi_interface.h"
|
#include "nfapi_interface.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include <openair2/PHY_INTERFACE/IF_Module.h>
|
#include <openair2/PHY_INTERFACE/IF_Module.h>
|
||||||
|
#include "nfapi_nr_interface.h"
|
||||||
|
#include "nfapi_nr_interface_scf.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include "openair1/PHY/defs_gNB.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! This enum is used to describe the states of the pnf
|
/*! This enum is used to describe the states of the pnf
|
||||||
*/
|
*/
|
||||||
@@ -121,6 +127,7 @@ typedef struct nfapi_pnf_config
|
|||||||
* The client is expected to send the PNF_PARAM.response after receiving the
|
* The client is expected to send the PNF_PARAM.response after receiving the
|
||||||
* PNF_PARAM.request. This can be done in the call back.
|
* PNF_PARAM.request. This can be done in the call back.
|
||||||
*/
|
*/
|
||||||
|
int (*pnf_nr_param_req)(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_request_t* req);
|
||||||
int (*pnf_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req);
|
int (*pnf_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the PNF_CONFIG.request
|
/*! A callback for the PNF_CONFIG.request
|
||||||
@@ -133,7 +140,8 @@ typedef struct nfapi_pnf_config
|
|||||||
* PNF_CONFIG.request. This can be done in the call back.
|
* PNF_CONFIG.request. This can be done in the call back.
|
||||||
*/
|
*/
|
||||||
int (*pnf_config_req)(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req);
|
int (*pnf_config_req)(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req);
|
||||||
|
int (*pnf_nr_config_req)(nfapi_pnf_config_t* config, nfapi_nr_pnf_config_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the PNF_START.request
|
/*! A callback for the PNF_START.request
|
||||||
* \param config A pointer to the pnf configuration
|
* \param config A pointer to the pnf configuration
|
||||||
* \param req A data structure for the decoded PNF_CONFIG.request. This will have
|
* \param req A data structure for the decoded PNF_CONFIG.request. This will have
|
||||||
@@ -144,7 +152,8 @@ typedef struct nfapi_pnf_config
|
|||||||
* PNF_START.request. This can be done in the call back.
|
* PNF_START.request. This can be done in the call back.
|
||||||
*/
|
*/
|
||||||
int (*pnf_start_req)(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req);
|
int (*pnf_start_req)(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req);
|
||||||
|
int (*pnf_nr_start_req)(nfapi_pnf_config_t* config, nfapi_nr_pnf_start_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the PNF_STOP.request
|
/*! A callback for the PNF_STOP.request
|
||||||
* \param config A pointer to the pnf configuration
|
* \param config A pointer to the pnf configuration
|
||||||
* \param req A data structure for the decoded PNF_STOP.request. This will have
|
* \param req A data structure for the decoded PNF_STOP.request. This will have
|
||||||
@@ -167,7 +176,8 @@ typedef struct nfapi_pnf_config
|
|||||||
* PARAM.request. This can be done in the call back.
|
* PARAM.request. This can be done in the call back.
|
||||||
*/
|
*/
|
||||||
int (*param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req);
|
int (*param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req);
|
||||||
|
int (*nr_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_param_request_scf_t* req);
|
||||||
|
|
||||||
/*! A callback for the CONFIG.request
|
/*! A callback for the CONFIG.request
|
||||||
* \param config A pointer to the pnf configuration
|
* \param config A pointer to the pnf configuration
|
||||||
* \param phy A pointer to the pnf phy configuration
|
* \param phy A pointer to the pnf phy configuration
|
||||||
@@ -179,6 +189,7 @@ typedef struct nfapi_pnf_config
|
|||||||
* CONFIG.request. This can be done in the call back.
|
* CONFIG.request. This can be done in the call back.
|
||||||
*/
|
*/
|
||||||
int (*config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req);
|
int (*config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req);
|
||||||
|
int (*nr_config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_config_request_scf_t* req);
|
||||||
|
|
||||||
/*! A callback for the START.request
|
/*! A callback for the START.request
|
||||||
* \param config A pointer to the pnf configuration
|
* \param config A pointer to the pnf configuration
|
||||||
@@ -190,8 +201,8 @@ typedef struct nfapi_pnf_config
|
|||||||
* The client is expected to send the START.response after the client has received the
|
* The client is expected to send the START.response after the client has received the
|
||||||
* first subframe indication from FAPI.
|
* first subframe indication from FAPI.
|
||||||
*/
|
*/
|
||||||
int (*start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req);
|
int (*start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req);
|
||||||
|
int (*nr_start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_start_request_scf_t* req);
|
||||||
/*! A callback for the STOP.request
|
/*! A callback for the STOP.request
|
||||||
* \param config A pointer to the pnf configuration
|
* \param config A pointer to the pnf configuration
|
||||||
* \param phy A pointer to the pnf phy configuration
|
* \param phy A pointer to the pnf phy configuration
|
||||||
@@ -203,7 +214,8 @@ typedef struct nfapi_pnf_config
|
|||||||
* STOP.request. This can be done in the call back.
|
* STOP.request. This can be done in the call back.
|
||||||
*/
|
*/
|
||||||
int (*stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_stop_request_t* req);
|
int (*stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_stop_request_t* req);
|
||||||
|
int (*nr_stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_stop_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the MEASUREMENT.request
|
/*! A callback for the MEASUREMENT.request
|
||||||
* \param config A pointer to the pnf configuration
|
* \param config A pointer to the pnf configuration
|
||||||
* \param phy A pointer to the pnf phy configuration
|
* \param phy A pointer to the pnf phy configuration
|
||||||
@@ -355,6 +367,7 @@ int nfapi_pnf_config_destroy(nfapi_pnf_config_t* config);
|
|||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_start(nfapi_pnf_config_t* config);
|
int nfapi_pnf_start(nfapi_pnf_config_t* config);
|
||||||
|
int nfapi_nr_pnf_start(nfapi_pnf_config_t* config);
|
||||||
|
|
||||||
/*! Stop the PNF library.
|
/*! Stop the PNF library.
|
||||||
* \param config A pointer to the pnf configuration
|
* \param config A pointer to the pnf configuration
|
||||||
@@ -371,6 +384,8 @@ int nfapi_pnf_stop(nfapi_pnf_config_t* config);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp);
|
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp);
|
||||||
|
int nfapi_nr_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_response_t* resp);
|
||||||
|
|
||||||
|
|
||||||
/*! Send the PNF_CONFIG.response
|
/*! Send the PNF_CONFIG.response
|
||||||
* \param config A pointer to a pnf configuraiton
|
* \param config A pointer to a pnf configuraiton
|
||||||
@@ -379,6 +394,7 @@ int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_respons
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_response_t* resp);
|
int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_response_t* resp);
|
||||||
|
int nfapi_nr_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_config_response_t* resp);
|
||||||
|
|
||||||
/*! Send the PNF_START.response
|
/*! Send the PNF_START.response
|
||||||
* \param config A pointer to a pnf configuraiton
|
* \param config A pointer to a pnf configuraiton
|
||||||
@@ -387,7 +403,7 @@ int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_respo
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp);
|
int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp);
|
||||||
|
int nfapi_nr_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_start_response_t* resp);
|
||||||
/*! Send the PNF_STOP.response
|
/*! Send the PNF_STOP.response
|
||||||
* \param config A pointer to a pnf configuraiton
|
* \param config A pointer to a pnf configuraiton
|
||||||
* \param resp A pointer to the message structure
|
* \param resp A pointer to the message structure
|
||||||
@@ -403,6 +419,7 @@ int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp);
|
int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp);
|
||||||
|
int nfapi_nr_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_scf_t* resp);
|
||||||
|
|
||||||
/*! Send the CONFIG.response
|
/*! Send the CONFIG.response
|
||||||
* \param config A pointer to a pnf configuraiton
|
* \param config A pointer to a pnf configuraiton
|
||||||
@@ -411,7 +428,7 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* res
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp);
|
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp);
|
||||||
|
int nfapi_nr_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_scf_t* resp);
|
||||||
/*! Send the START.response
|
/*! Send the START.response
|
||||||
* \param config A pointer to a pnf configuraiton
|
* \param config A pointer to a pnf configuraiton
|
||||||
* \param resp A pointer to the message structure
|
* \param resp A pointer to the message structure
|
||||||
@@ -419,6 +436,7 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* r
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp);
|
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp);
|
||||||
|
int nfapi_nr_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_start_response_scf_t* resp);
|
||||||
|
|
||||||
/*! Send the STOP.response
|
/*! Send the STOP.response
|
||||||
* \param config A pointer to a pnf configuraiton
|
* \param config A pointer to a pnf configuraiton
|
||||||
@@ -550,6 +568,22 @@ typedef struct
|
|||||||
nfapi_ue_release_request_t* ue_release_req;
|
nfapi_ue_release_request_t* ue_release_req;
|
||||||
} nfapi_pnf_p7_subframe_buffer_t;
|
} nfapi_pnf_p7_subframe_buffer_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
//uint16_t sfn_slot
|
||||||
|
int16_t sfn;
|
||||||
|
int16_t slot;
|
||||||
|
//TODO: Change P7 structs to NR
|
||||||
|
nfapi_nr_dl_tti_request_t* dl_tti_req;//nfapi_dl_config_request_t* dl_config_req;
|
||||||
|
nfapi_nr_ul_tti_request_t* ul_tti_req;//nfapi_ul_config_request_t* ul_config_req;
|
||||||
|
nfapi_nr_ul_dci_request_t* ul_dci_req;//nfapi_hi_dci0_request_t* hi_dci0_req;
|
||||||
|
nfapi_nr_tx_data_request_t* tx_data_req;//nfapi_tx_request_t* tx_req;
|
||||||
|
|
||||||
|
//TODO: check these two later
|
||||||
|
//nfapi_lbt_dl_config_request_t* lbt_dl_config_req;
|
||||||
|
//nfapi_ue_release_request_t* ue_release_req;
|
||||||
|
} nfapi_pnf_p7_slot_buffer_t;
|
||||||
|
|
||||||
typedef struct nfapi_pnf_p7_config nfapi_pnf_p7_config_t;
|
typedef struct nfapi_pnf_p7_config nfapi_pnf_p7_config_t;
|
||||||
|
|
||||||
/*! The nfapi PNF PHY P7 configuration information created using the nfapi_pnf_p7_create function
|
/*! The nfapi PNF PHY P7 configuration information created using the nfapi_pnf_p7_create function
|
||||||
@@ -602,6 +636,8 @@ typedef struct nfapi_pnf_p7_config
|
|||||||
/*! The dummy subframe buffer structure that should be used in case there
|
/*! The dummy subframe buffer structure that should be used in case there
|
||||||
* are no 'valid' subframe messages */
|
* are no 'valid' subframe messages */
|
||||||
nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
|
nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
|
||||||
|
|
||||||
|
nfapi_pnf_p7_slot_buffer_t dummy_slot; // defining a slot equivalent for now
|
||||||
|
|
||||||
/*! Configuration options for the p7 pack unpack functions*/
|
/*! Configuration options for the p7 pack unpack functions*/
|
||||||
nfapi_p7_codec_config_t codec_config;
|
nfapi_p7_codec_config_t codec_config;
|
||||||
@@ -611,6 +647,7 @@ typedef struct nfapi_pnf_p7_config
|
|||||||
|
|
||||||
// tdb : if these should be public
|
// tdb : if these should be public
|
||||||
uint16_t subframe_buffer_size;
|
uint16_t subframe_buffer_size;
|
||||||
|
uint16_t slot_buffer_size;
|
||||||
uint8_t timing_info_mode_periodic; // 0:false 1:true
|
uint8_t timing_info_mode_periodic; // 0:false 1:true
|
||||||
uint8_t timing_info_mode_aperiodic; // 0:false 1:true
|
uint8_t timing_info_mode_aperiodic; // 0:false 1:true
|
||||||
uint8_t timing_info_period; // 1..225 in subframes
|
uint8_t timing_info_period; // 1..225 in subframes
|
||||||
@@ -620,6 +657,7 @@ typedef struct nfapi_pnf_p7_config
|
|||||||
* \param req A pointer to the dl config request message structure
|
* \param req A pointer to the dl config request message structure
|
||||||
* \return not currently used
|
* \return not currently used
|
||||||
*/
|
*/
|
||||||
|
int (*dl_tti_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_dl_tti_request_t* req);
|
||||||
int (*dl_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_dl_config_request_t* req);
|
int (*dl_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_dl_config_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the UL_CONFIG.request
|
/*! A callback for the UL_CONFIG.request
|
||||||
@@ -627,6 +665,7 @@ typedef struct nfapi_pnf_p7_config
|
|||||||
* \param req A pointer to the ul config request message structure
|
* \param req A pointer to the ul config request message structure
|
||||||
* \return not currently used
|
* \return not currently used
|
||||||
*/
|
*/
|
||||||
|
int (*ul_tti_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req);
|
||||||
int (*ul_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_ul_config_request_t* req);
|
int (*ul_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_ul_config_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the HI_DCI0.request
|
/*! A callback for the HI_DCI0.request
|
||||||
@@ -634,8 +673,9 @@ typedef struct nfapi_pnf_p7_config
|
|||||||
* \param req A pointer to the hi dci0 request message structure
|
* \param req A pointer to the hi dci0 request message structure
|
||||||
* \return not currently used
|
* \return not currently used
|
||||||
*/
|
*/
|
||||||
|
int (*ul_dci_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req);
|
||||||
int (*hi_dci0_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
|
int (*hi_dci0_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the TX_REQ.request
|
/*! A callback for the TX_REQ.request
|
||||||
* \param config A poiner to the PNF P7 config
|
* \param config A poiner to the PNF P7 config
|
||||||
* \param req A pointer to the tx request message structure
|
* \param req A pointer to the tx request message structure
|
||||||
@@ -645,6 +685,7 @@ typedef struct nfapi_pnf_p7_config
|
|||||||
* will 'keep' the pointers until they are transmitted the callee should set the pointers in the req to 0
|
* will 'keep' the pointers until they are transmitted the callee should set the pointers in the req to 0
|
||||||
* and then use the p7 codec config free function to release the pdu's when appropriate.
|
* and then use the p7 codec config free function to release the pdu's when appropriate.
|
||||||
*/
|
*/
|
||||||
|
int (*tx_data_req_fn)(nfapi_pnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req);
|
||||||
int (*tx_req)(nfapi_pnf_p7_config_t* config, nfapi_tx_request_t* req);
|
int (*tx_req)(nfapi_pnf_p7_config_t* config, nfapi_tx_request_t* req);
|
||||||
|
|
||||||
/*! A callback for the LBT_DL_CONFIG.request
|
/*! A callback for the LBT_DL_CONFIG.request
|
||||||
@@ -708,6 +749,7 @@ int nfapi_pnf_p7_config_destroy(nfapi_pnf_p7_config_t* config);
|
|||||||
* This function will not return until nfapi_pnf_p7_stop is called.
|
* This function will not return until nfapi_pnf_p7_stop is called.
|
||||||
*/
|
*/
|
||||||
int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config);
|
int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config);
|
||||||
|
int nfapi_nr_pnf_p7_start(nfapi_pnf_p7_config_t* config);
|
||||||
|
|
||||||
/*! Stop the PNF P7 library.
|
/*! Stop the PNF P7 library.
|
||||||
* \param config A pointer to a PNF P7 config
|
* \param config A pointer to a PNF P7 config
|
||||||
@@ -717,6 +759,21 @@ int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config);
|
|||||||
*/
|
*/
|
||||||
int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config);
|
int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config);
|
||||||
|
|
||||||
|
/*! NR Slot indication
|
||||||
|
* message copied from nfapi_pnf_p7_subframe_ind
|
||||||
|
* \param config A pointer to a PNF P7 config
|
||||||
|
* \param phy_id The phy_id for the phy instance
|
||||||
|
* \param sfn_sf The SFN and SF in the format of FAPI
|
||||||
|
* \return 0 means success, -1 means failure
|
||||||
|
*
|
||||||
|
* The client should call the subframe indication every 1ms. The PNF will
|
||||||
|
* respond by invoking the pnf p7 subframe callbacks with the messages from the subframe buffer
|
||||||
|
*
|
||||||
|
* If messages are not in the subframe buffer, they dummy subframe messages will be sent
|
||||||
|
*/
|
||||||
|
int nfapi_pnf_p7_slot_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
||||||
|
|
||||||
|
|
||||||
/*! Subframe indication
|
/*! Subframe indication
|
||||||
* \param config A pointer to a PNF P7 config
|
* \param config A pointer to a PNF P7 config
|
||||||
* \param phy_id The phy_id for the phy instance
|
* \param phy_id The phy_id for the phy instance
|
||||||
|
|||||||
@@ -26,9 +26,29 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include "nfapi_nr_interface.h"
|
||||||
|
#include "nfapi_nr_interface_scf.h"
|
||||||
#include "pnf.h"
|
#include "pnf.h"
|
||||||
|
|
||||||
|
# if 1 // for hard-code (remove later)
|
||||||
|
#include "COMMON/platform_types.h"
|
||||||
|
#include "COMMON/platform_constants.h"
|
||||||
|
#include "common/ran_context.h"
|
||||||
|
|
||||||
|
#include "common/utils/LOG/log.h"
|
||||||
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
|
#include "NR_BCCH-BCH-Message.h"
|
||||||
|
#include "NR_ServingCellConfigCommon.h"
|
||||||
|
|
||||||
|
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||||
|
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||||
|
|
||||||
|
#include "NR_MIB.h"
|
||||||
|
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_SCTP_STREAMS 16
|
#define MAX_SCTP_STREAMS 16
|
||||||
|
|
||||||
void nfapi_pnf_phy_config_delete_all(nfapi_pnf_config_t* config)
|
void nfapi_pnf_phy_config_delete_all(nfapi_pnf_config_t* config)
|
||||||
@@ -63,6 +83,50 @@ nfapi_pnf_phy_config_t* nfapi_pnf_phy_config_find(nfapi_pnf_config_t* config, ui
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || pnf == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_pnf_param_request_t req;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_nr_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
|
||||||
|
{
|
||||||
|
if(pnf->_public.state == NFAPI_PNF_IDLE)
|
||||||
|
{
|
||||||
|
if(pnf->_public.pnf_nr_param_req)
|
||||||
|
{
|
||||||
|
(pnf->_public.pnf_nr_param_req)(&pnf->_public, &req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
|
||||||
|
|
||||||
|
nfapi_nr_pnf_param_response_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_pnf_param_resp(&pnf->_public, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.vendor_extension)
|
||||||
|
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -173,6 +237,72 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || pnf == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_pnf_config_request_t req;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n");
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||||
|
{
|
||||||
|
// ensure correct state
|
||||||
|
if(pnf->_public.state != NFAPI_PNF_RUNNING)
|
||||||
|
{
|
||||||
|
// delete the phy records
|
||||||
|
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
||||||
|
|
||||||
|
// create the phy records
|
||||||
|
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i)
|
||||||
|
{
|
||||||
|
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
|
||||||
|
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
||||||
|
|
||||||
|
phy->state = NFAPI_PNF_PHY_IDLE;
|
||||||
|
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
||||||
|
|
||||||
|
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pnf->_public.pnf_nr_config_req)
|
||||||
|
{
|
||||||
|
(pnf->_public.pnf_nr_config_req)(&(pnf->_public), &req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state);
|
||||||
|
|
||||||
|
nfapi_nr_pnf_config_response_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_pnf_config_resp(&(pnf->_public), &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.vendor_extension)
|
||||||
|
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -215,6 +345,48 @@ void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnf_nr_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || pnf == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_pnf_start_request_t req;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n");
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||||
|
{
|
||||||
|
if(pnf->_public.state == NFAPI_PNF_CONFIGURED)
|
||||||
|
{
|
||||||
|
if(pnf->_public.pnf_nr_start_req)
|
||||||
|
{
|
||||||
|
(pnf->_public.pnf_nr_start_req)(&(pnf->_public), &req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_pnf_start_response_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_PNF_START_RESPONSE;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_pnf_start_resp(&(pnf->_public), &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.vendor_extension)
|
||||||
|
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -330,6 +502,78 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || pnf == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_param_request_scf_t req;
|
||||||
|
|
||||||
|
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n");
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
if(config->state == NFAPI_PNF_RUNNING)
|
||||||
|
{
|
||||||
|
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||||
|
if(phy)
|
||||||
|
{
|
||||||
|
if(phy->state == NFAPI_PNF_PHY_IDLE)
|
||||||
|
{
|
||||||
|
if(config->nr_param_req)
|
||||||
|
{
|
||||||
|
(config->nr_param_req)(config, phy, &req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_param_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_param_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_param_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||||
|
nfapi_nr_pnf_param_resp(config, &resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_param_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_param_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.vendor_extension)
|
||||||
|
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -401,6 +645,85 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || pnf == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_config_request_scf_t req;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
|
||||||
|
|
||||||
|
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
if(config->state == NFAPI_PNF_RUNNING)
|
||||||
|
{
|
||||||
|
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||||
|
|
||||||
|
#if 0 // emulate set_config TLV reception (hard-code)
|
||||||
|
int tdd_return = set_tdd_config_nr(&req, 1, 7, 6, 2, 4);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(phy)
|
||||||
|
{
|
||||||
|
if(phy->state != NFAPI_PNF_PHY_RUNNING)
|
||||||
|
{
|
||||||
|
if(config->nr_config_req)
|
||||||
|
{
|
||||||
|
(config->nr_config_req)(config, phy, &req);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_config_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_CONFIG_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_config_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_config_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_CONFIG_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||||
|
nfapi_nr_pnf_config_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_config_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_CONFIG_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_config_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.vendor_extension)
|
||||||
|
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -472,6 +795,77 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || pnf == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_start_request_scf_t req;
|
||||||
|
|
||||||
|
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
if(config->state == NFAPI_PNF_RUNNING)
|
||||||
|
{
|
||||||
|
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||||
|
if(phy)
|
||||||
|
{
|
||||||
|
if(phy->state != NFAPI_PNF_PHY_RUNNING)
|
||||||
|
{
|
||||||
|
if(config->nr_start_req)
|
||||||
|
{
|
||||||
|
(config->nr_start_req)(config, phy, &req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_start_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_start_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_start_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||||
|
nfapi_nr_pnf_start_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_start_response_scf_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_nr_pnf_start_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.vendor_extension)
|
||||||
|
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -543,6 +937,77 @@ void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || pnf == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_nr_stop_request_t req;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
|
||||||
|
|
||||||
|
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
if(config->state == NFAPI_PNF_RUNNING)
|
||||||
|
{
|
||||||
|
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||||
|
if(phy)
|
||||||
|
{
|
||||||
|
if(phy->state != NFAPI_PNF_PHY_RUNNING)
|
||||||
|
{
|
||||||
|
if(config->nr_stop_req)
|
||||||
|
{
|
||||||
|
(config->nr_stop_req)(config, phy, &req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_stop_response_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_pnf_stop_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_stop_response_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||||
|
nfapi_pnf_stop_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfapi_stop_response_t resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||||
|
resp.header.phy_id = req.header.phy_id;
|
||||||
|
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||||
|
nfapi_pnf_stop_resp(config, &resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.vendor_extension)
|
||||||
|
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -1071,7 +1536,101 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pnf_nr_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
|
{
|
||||||
|
nfapi_p4_p5_message_header_t messageHeader;
|
||||||
|
|
||||||
|
// validate the input params
|
||||||
|
if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unpack the message header
|
||||||
|
if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &pnf->_public.codec_config) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (messageHeader.message_id)
|
||||||
|
{
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
|
||||||
|
pnf_nr_handle_pnf_param_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
|
||||||
|
pnf_nr_handle_pnf_config_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
|
||||||
|
pnf_nr_handle_pnf_start_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_PNF_STOP_REQUEST:
|
||||||
|
pnf_handle_pnf_stop_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
|
||||||
|
pnf_nr_handle_param_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
|
||||||
|
pnf_nr_handle_config_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
|
||||||
|
pnf_nr_handle_start_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
|
||||||
|
pnf_nr_handle_stop_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_MEASUREMENT_REQUEST:
|
||||||
|
pnf_handle_measurement_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_RSSI_REQUEST:
|
||||||
|
pnf_handle_rssi_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_CELL_SEARCH_REQUEST:
|
||||||
|
pnf_handle_cell_search_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_BROADCAST_DETECT_REQUEST:
|
||||||
|
pnf_handle_broadcast_detect_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST:
|
||||||
|
pnf_handle_system_information_schedule_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_SYSTEM_INFORMATION_REQUEST:
|
||||||
|
pnf_handle_system_information_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NMM_STOP_REQUEST:
|
||||||
|
pnf_handle_nmm_stop_request(pnf, pRecvMsg, recvMsgLen);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||||
|
messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
|
||||||
|
{
|
||||||
|
pnf_handle_vendor_extension(pRecvMsg, recvMsgLen, pnf, messageHeader.message_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||||
{
|
{
|
||||||
@@ -1169,6 +1728,24 @@ void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||||
|
{
|
||||||
|
int packed_len = nfapi_nr_p5_message_pack(msg, msg_len,
|
||||||
|
pnf->tx_message_buffer,
|
||||||
|
sizeof(pnf->tx_message_buffer),
|
||||||
|
&pnf->_public.codec_config);
|
||||||
|
|
||||||
|
if (packed_len < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed (%d)\n", packed_len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pnf_send_message(pnf, pnf->tx_message_buffer, packed_len, 0/*msg->stream_id*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||||
{
|
{
|
||||||
int packed_len = nfapi_p5_message_pack(msg, msg_len,
|
int packed_len = nfapi_p5_message_pack(msg, msg_len,
|
||||||
@@ -1393,8 +1970,15 @@ int pnf_connect(pnf_t* pnf)
|
|||||||
|
|
||||||
int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
|
int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (pnf->sctp)
|
if (pnf->sctp)
|
||||||
{
|
{
|
||||||
|
printf("\nPNF SENDS: \n");
|
||||||
|
for(int i=0; i<len; i++){
|
||||||
|
printf("%d", msg[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
if (sctp_sendmsg(pnf->p5_sock, msg, len, NULL, 0, 42/*config->sctp_stream_number*/, 0, stream/*P5_STREAM_ID*/, 0, 0) < 0)
|
if (sctp_sendmsg(pnf->p5_sock, msg, len, NULL, 0, 42/*config->sctp_stream_number*/, 0, stream/*P5_STREAM_ID*/, 0, 0) < 0)
|
||||||
{
|
{
|
||||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp_sendmsg failed errno: %d\n", errno);
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp_sendmsg failed errno: %d\n", errno);
|
||||||
@@ -1412,7 +1996,6 @@ int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pnf_read_dispatch_message(pnf_t* pnf)
|
int pnf_read_dispatch_message(pnf_t* pnf)
|
||||||
{
|
{
|
||||||
int socket_connected = 1;
|
int socket_connected = 1;
|
||||||
@@ -1486,6 +2069,13 @@ int pnf_read_dispatch_message(pnf_t* pnf)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// print the received message
|
||||||
|
printf("\n MESSAGE RECEIVED: \n");
|
||||||
|
for(int i=0; i<message_size; i++){
|
||||||
|
printf("%d", read_buffer[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
if (flags & MSG_NOTIFICATION)
|
if (flags & MSG_NOTIFICATION)
|
||||||
{
|
{
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||||
@@ -1533,6 +2123,135 @@ int pnf_read_dispatch_message(pnf_t* pnf)
|
|||||||
return socket_connected;
|
return socket_connected;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int pnf_nr_read_dispatch_message(pnf_t* pnf)
|
||||||
|
{
|
||||||
|
int socket_connected = 1;
|
||||||
|
|
||||||
|
// 1. Peek the message header
|
||||||
|
// 2. If the message is larger than the stack buffer then create a dynamic buffer
|
||||||
|
// 3. Read the buffer
|
||||||
|
// 4. Handle the p5 message
|
||||||
|
|
||||||
|
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||||
|
uint8_t header_buffer[header_buffer_size];
|
||||||
|
|
||||||
|
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
|
||||||
|
uint8_t stack_buffer[stack_buffer_size];
|
||||||
|
|
||||||
|
uint8_t* dynamic_buffer = 0;
|
||||||
|
|
||||||
|
uint8_t* read_buffer = &stack_buffer[0];
|
||||||
|
uint32_t message_size = 0;
|
||||||
|
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
socklen_t addr_len = sizeof(addr);
|
||||||
|
|
||||||
|
struct sctp_sndrcvinfo sndrcvinfo;
|
||||||
|
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||||
|
|
||||||
|
{
|
||||||
|
int flags = MSG_PEEK;
|
||||||
|
message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, /*(struct sockaddr*)&addr, &addr_len*/ 0, 0, &sndrcvinfo, &flags);
|
||||||
|
|
||||||
|
if(message_size == -1)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to peek sctp message size errno:%d\n", errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
|
||||||
|
if(unpack_result < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to unpack p5 message header\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
message_size = header.message_length;
|
||||||
|
|
||||||
|
// now have the size of the mesage
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message_size > stack_buffer_size)
|
||||||
|
{
|
||||||
|
dynamic_buffer = (uint8_t*)malloc(message_size);
|
||||||
|
|
||||||
|
if(dynamic_buffer == NULL)
|
||||||
|
{
|
||||||
|
// todo : add error mesage
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
read_buffer = dynamic_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int flags = 0;
|
||||||
|
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||||
|
|
||||||
|
int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
|
||||||
|
if(recvmsg_result == -1)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// print the received message
|
||||||
|
printf("\n MESSAGE RECEIVED: \n");
|
||||||
|
for(int i=0; i<message_size; i++){
|
||||||
|
printf("%d", read_buffer[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
if (flags & MSG_NOTIFICATION)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||||
|
|
||||||
|
// todo - handle the events
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
|
||||||
|
pnf->p5_sock,
|
||||||
|
inet_ntoa(addr.sin_addr),
|
||||||
|
ntohs(addr.sin_port),
|
||||||
|
sndrcvinfo.sinfo_assoc_id,
|
||||||
|
sndrcvinfo.sinfo_stream,
|
||||||
|
ntohl(sndrcvinfo.sinfo_ppid),
|
||||||
|
message_size,
|
||||||
|
flags);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// handle now if complete message in one or more segments
|
||||||
|
if ((flags & 0x80) == 0x80)
|
||||||
|
{
|
||||||
|
pnf_nr_handle_p5_message(pnf, read_buffer, message_size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
|
||||||
|
|
||||||
|
// assume socket disconnected
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
|
||||||
|
socket_connected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dynamic_buffer)
|
||||||
|
{
|
||||||
|
free(dynamic_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return socket_connected;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1597,3 +2316,64 @@ int pnf_message_pump(pnf_t* pnf)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pnf_nr_message_pump(pnf_t* pnf)
|
||||||
|
{
|
||||||
|
uint8_t socketConnected = 1;
|
||||||
|
|
||||||
|
while(socketConnected && pnf->terminate == 0)
|
||||||
|
{
|
||||||
|
fd_set rfds;
|
||||||
|
int selectRetval = 0;
|
||||||
|
|
||||||
|
// select on a timeout and then get the message
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
FD_SET(pnf->p5_sock, &rfds);
|
||||||
|
|
||||||
|
struct timeval timeout;
|
||||||
|
timeout.tv_sec = 1;
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
|
selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout);
|
||||||
|
|
||||||
|
if(selectRetval == 0)
|
||||||
|
{
|
||||||
|
// timeout
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (selectRetval == -1 && (errno == EINTR))
|
||||||
|
{
|
||||||
|
// interrupted by signal
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 Signal Interrupt %d\n", errno);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (selectRetval == -1)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 select() failed\n");
|
||||||
|
sleep(1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(FD_ISSET(pnf->p5_sock, &rfds))
|
||||||
|
{
|
||||||
|
socketConnected = pnf_nr_read_dispatch_message(pnf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "Why are we here\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop back to idle if we have lost connection
|
||||||
|
pnf->_public.state = NFAPI_PNF_PHY_IDLE;
|
||||||
|
|
||||||
|
|
||||||
|
// close the connection and socket
|
||||||
|
if (close(pnf->p5_sock) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "close(sctpSock) failed errno: %d\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include "nfapi_nr_interface.h"
|
||||||
|
#include "nfapi_nr_interface_scf.h"
|
||||||
|
|
||||||
nfapi_pnf_config_t* nfapi_pnf_config_create()
|
nfapi_pnf_config_t* nfapi_pnf_config_create()
|
||||||
{
|
{
|
||||||
@@ -81,6 +83,40 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_start(nfapi_pnf_config_t* config)
|
||||||
|
{
|
||||||
|
// Verify that config is not null
|
||||||
|
if(config == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||||
|
if(config->trace)
|
||||||
|
nfapi_trace_g = config->trace;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||||
|
|
||||||
|
pnf_t* _this = (pnf_t*)(config);
|
||||||
|
|
||||||
|
while (_this->terminate == 0)
|
||||||
|
{
|
||||||
|
int connect_result = pnf_connect(_this);
|
||||||
|
|
||||||
|
if(connect_result > 0)
|
||||||
|
{
|
||||||
|
pnf_nr_message_pump(_this);
|
||||||
|
}
|
||||||
|
else if(connect_result < 0)
|
||||||
|
{
|
||||||
|
return connect_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_pnf_stop(nfapi_pnf_config_t* config)
|
int nfapi_pnf_stop(nfapi_pnf_config_t* config)
|
||||||
{
|
{
|
||||||
// Verify that config is not null
|
// Verify that config is not null
|
||||||
@@ -96,6 +132,21 @@ int nfapi_pnf_stop(nfapi_pnf_config_t* config)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_response_t* resp)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (config == NULL || resp == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf_t* _this = (pnf_t*)(config);
|
||||||
|
|
||||||
|
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_pnf_param_response_t));
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp)
|
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -129,6 +180,27 @@ int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_respo
|
|||||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_config_response_t));
|
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_config_response_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_config_response_t* resp)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (config == NULL || resp == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resp->error_code == NFAPI_MSG_OK)
|
||||||
|
{
|
||||||
|
config->state = NFAPI_PNF_CONFIGURED;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf_t* _this = (pnf_t*)(config);
|
||||||
|
|
||||||
|
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_pnf_config_response_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp)
|
int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -148,6 +220,26 @@ int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_respons
|
|||||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_start_response_t));
|
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_start_response_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_start_response_t* resp)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (config == NULL || resp == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resp->error_code == NFAPI_MSG_OK)
|
||||||
|
{
|
||||||
|
config->state = NFAPI_PNF_RUNNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf_t* _this = (pnf_t*)(config);
|
||||||
|
|
||||||
|
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_pnf_start_response_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_t* resp)
|
int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_t* resp)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -166,7 +258,6 @@ int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_
|
|||||||
|
|
||||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_stop_response_t));
|
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_stop_response_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp)
|
int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp)
|
||||||
{
|
{
|
||||||
if (config == NULL || resp == NULL)
|
if (config == NULL || resp == NULL)
|
||||||
@@ -180,6 +271,20 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* res
|
|||||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t));
|
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_scf_t* resp)
|
||||||
|
{
|
||||||
|
if (config == NULL || resp == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf_t* _this = (pnf_t*)(config);
|
||||||
|
|
||||||
|
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_param_response_scf_t));
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp)
|
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp)
|
||||||
{
|
{
|
||||||
if (config == NULL || resp == NULL)
|
if (config == NULL || resp == NULL)
|
||||||
@@ -208,6 +313,35 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* r
|
|||||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_config_response_t));
|
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_config_response_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_scf_t* resp)
|
||||||
|
{
|
||||||
|
if (config == NULL || resp == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf_t* _this = (pnf_t*)(config);
|
||||||
|
|
||||||
|
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
|
||||||
|
|
||||||
|
if(phy)
|
||||||
|
{
|
||||||
|
if(resp->error_code == NFAPI_NR_CONFIG_MSG_OK)
|
||||||
|
{
|
||||||
|
phy->state = NFAPI_PNF_PHY_CONFIGURED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_config_response_scf_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp)
|
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp)
|
||||||
{
|
{
|
||||||
if (config == NULL || resp == NULL)
|
if (config == NULL || resp == NULL)
|
||||||
@@ -235,6 +369,34 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res
|
|||||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_start_response_t));
|
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_start_response_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_start_response_scf_t* resp)
|
||||||
|
{
|
||||||
|
if (config == NULL || resp == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf_t* _this = (pnf_t*)(config);
|
||||||
|
|
||||||
|
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
|
||||||
|
if(phy)
|
||||||
|
{
|
||||||
|
if(resp->error_code == NFAPI_NR_START_MSG_OK)
|
||||||
|
{
|
||||||
|
phy->state = NFAPI_PNF_PHY_RUNNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_start_response_scf_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp)
|
int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp)
|
||||||
{
|
{
|
||||||
if (config == NULL || resp == NULL)
|
if (config == NULL || resp == NULL)
|
||||||
|
|||||||
+1466
-10
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@ nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create()
|
|||||||
_this->_public.segment_size = 1400;
|
_this->_public.segment_size = 1400;
|
||||||
_this->max_num_segments = 8;
|
_this->max_num_segments = 8;
|
||||||
|
|
||||||
_this->_public.subframe_buffer_size = 8;
|
_this->_public.subframe_buffer_size = 8;// TODO: Initialize the slot_buffer size
|
||||||
_this->_public.timing_info_mode_periodic = 1;
|
_this->_public.timing_info_mode_periodic = 1;
|
||||||
_this->_public.timing_info_period = 32;
|
_this->_public.timing_info_period = 32;
|
||||||
_this->_public.timing_info_mode_aperiodic = 1;
|
_this->_public.timing_info_mode_aperiodic = 1;
|
||||||
@@ -76,6 +76,26 @@ int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_pnf_p7_start(nfapi_pnf_p7_config_t* config)
|
||||||
|
{
|
||||||
|
// Verify that config is not null
|
||||||
|
if(config == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||||
|
if(config->trace)
|
||||||
|
nfapi_trace_g = config->trace;
|
||||||
|
|
||||||
|
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||||
|
|
||||||
|
pnf_nr_p7_message_pump(_this);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config)
|
int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config)
|
||||||
{
|
{
|
||||||
// Verify that config is not null
|
// Verify that config is not null
|
||||||
@@ -88,6 +108,16 @@ int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_pnf_p7_slot_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot)
|
||||||
|
{
|
||||||
|
// Verify that config is not null
|
||||||
|
if(config == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||||
|
|
||||||
|
return pnf_p7_slot_ind(_this, phy_id, sfn, slot);
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_pnf_p7_subframe_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn_sf)
|
int nfapi_pnf_p7_subframe_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn_sf)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ typedef struct phy_info
|
|||||||
uint8_t enabled;
|
uint8_t enabled;
|
||||||
uint16_t phy_id;
|
uint16_t phy_id;
|
||||||
uint16_t sfn_sf;
|
uint16_t sfn_sf;
|
||||||
|
uint16_t sfn;
|
||||||
|
uint16_t slot;
|
||||||
|
|
||||||
|
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
|
||||||
@@ -1207,6 +1210,12 @@ void send_dl_subframe_msgs_interleaved(int p7Sock, int phy_id, struct sockaddr_i
|
|||||||
//free(req.tx_request_body.tx_pdu_list);
|
//free(req.tx_request_body.tx_pdu_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void send_slot_indication(phy_info_t* phy_info)
|
||||||
|
{
|
||||||
|
// DONE: add sfn and slot as members in the phy_info
|
||||||
|
nfapi_pnf_p7_slot_ind(phy_info->config, phy_info->phy_id, phy_info->sfn, phy_info->slot);
|
||||||
|
}
|
||||||
|
|
||||||
void send_subframe_indication(phy_info_t* phy_info)
|
void send_subframe_indication(phy_info_t* phy_info)
|
||||||
{
|
{
|
||||||
nfapi_pnf_p7_subframe_ind(phy_info->config, phy_info->phy_id, phy_info->sfn_sf);
|
nfapi_pnf_p7_subframe_ind(phy_info->config, phy_info->phy_id, phy_info->sfn_sf);
|
||||||
|
|||||||
@@ -35,9 +35,13 @@ typedef struct
|
|||||||
|
|
||||||
|
|
||||||
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
||||||
|
int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
||||||
|
|
||||||
int vnf_pack_and_send_p4_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
int vnf_pack_and_send_p4_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
||||||
|
|
||||||
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf);
|
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf);
|
||||||
|
int vnf_nr_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf);
|
||||||
|
|
||||||
|
|
||||||
void nfapi_vnf_phy_info_list_add(nfapi_vnf_config_t* config, nfapi_vnf_phy_info_t* info);
|
void nfapi_vnf_phy_info_list_add(nfapi_vnf_config_t* config, nfapi_vnf_phy_info_t* info);
|
||||||
nfapi_vnf_phy_info_t* nfapi_vnf_phy_info_list_find(nfapi_vnf_config_t* config, uint16_t phy_id);
|
nfapi_vnf_phy_info_t* nfapi_vnf_phy_info_list_find(nfapi_vnf_config_t* config, uint16_t phy_id);
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ typedef struct nfapi_vnf_p7_connection_info {
|
|||||||
int32_t sf_offset_filtered;
|
int32_t sf_offset_filtered;
|
||||||
int32_t sf_offset_trend;
|
int32_t sf_offset_trend;
|
||||||
int32_t sf_offset;
|
int32_t sf_offset;
|
||||||
|
int32_t slot_offset;
|
||||||
|
int32_t slot_offset_trend;
|
||||||
|
int32_t slot_offset_filtered;
|
||||||
uint16_t zero_count;
|
uint16_t zero_count;
|
||||||
int32_t adjustment;
|
int32_t adjustment;
|
||||||
int32_t insync_minor_adjustment;
|
int32_t insync_minor_adjustment;
|
||||||
@@ -85,8 +88,10 @@ typedef struct nfapi_vnf_p7_connection_info {
|
|||||||
uint32_t previous_t1;
|
uint32_t previous_t1;
|
||||||
uint32_t previous_t2;
|
uint32_t previous_t2;
|
||||||
int32_t previous_sf_offset_filtered;
|
int32_t previous_sf_offset_filtered;
|
||||||
|
int32_t previous_slot_offset_filtered;
|
||||||
int sfn_sf;
|
int sfn_sf;
|
||||||
|
int sfn;
|
||||||
|
int slot;
|
||||||
|
|
||||||
int socket;
|
int socket;
|
||||||
struct sockaddr_in local_addr;
|
struct sockaddr_in local_addr;
|
||||||
@@ -111,6 +116,7 @@ typedef struct {
|
|||||||
nfapi_vnf_p7_connection_info_t* p7_connections;
|
nfapi_vnf_p7_connection_info_t* p7_connections;
|
||||||
int socket;
|
int socket;
|
||||||
uint32_t sf_start_time_hr;
|
uint32_t sf_start_time_hr;
|
||||||
|
uint32_t slot_start_time_hr;
|
||||||
uint8_t* rx_message_buffer; // would this be better put in the p7 conenction info?
|
uint8_t* rx_message_buffer; // would this be better put in the p7 conenction info?
|
||||||
uint16_t rx_message_buffer_size;
|
uint16_t rx_message_buffer_size;
|
||||||
|
|
||||||
@@ -120,14 +126,19 @@ uint32_t vnf_get_current_time_hr(void);
|
|||||||
|
|
||||||
uint16_t increment_sfn_sf(uint16_t sfn_sf);
|
uint16_t increment_sfn_sf(uint16_t sfn_sf);
|
||||||
int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
|
int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
|
||||||
|
int vnf_nr_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
|
||||||
|
|
||||||
int send_mac_subframe_indications(vnf_p7_t* config);
|
int send_mac_subframe_indications(vnf_p7_t* config);
|
||||||
|
int send_mac_slot_indications(vnf_p7_t* config);
|
||||||
int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7 );
|
int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7 );
|
||||||
|
int vnf_nr_p7_read_dispatch_message(vnf_p7_t* vnf_p7 );
|
||||||
|
|
||||||
void vnf_p7_connection_info_list_add(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* node);
|
void vnf_p7_connection_info_list_add(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* node);
|
||||||
nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_find(vnf_p7_t* vnf_p7, uint16_t phy_id);
|
nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_find(vnf_p7_t* vnf_p7, uint16_t phy_id);
|
||||||
nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_delete(vnf_p7_t* vnf_p7, uint16_t phy_id);
|
nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_delete(vnf_p7_t* vnf_p7, uint16_t phy_id);
|
||||||
|
|
||||||
int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
||||||
|
int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
||||||
|
|
||||||
void vnf_p7_release_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
void vnf_p7_release_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
||||||
void vnf_p7_release_pdu(vnf_p7_t* vnf_p7, void* pdu);
|
void vnf_p7_release_pdu(vnf_p7_t* vnf_p7, void* pdu);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "nfapi_interface.h"
|
#include "nfapi_interface.h"
|
||||||
#include "nfapi_nr_interface_scf.h"
|
#include "nfapi_nr_interface_scf.h"
|
||||||
|
#include "nfapi_nr_interface.h"
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
@@ -120,6 +121,7 @@ typedef struct nfapi_vnf_config
|
|||||||
*
|
*
|
||||||
* \todo Do we need to send the address information of the PNF?
|
* \todo Do we need to send the address information of the PNF?
|
||||||
*/
|
*/
|
||||||
|
int (*pnf_nr_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
|
||||||
int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
|
int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
|
||||||
|
|
||||||
/*! \brief Callback indicating that a pnf has lost connection
|
/*! \brief Callback indicating that a pnf has lost connection
|
||||||
@@ -160,6 +162,7 @@ typedef struct nfapi_vnf_config
|
|||||||
* then the substructure pointers should be set to 0 and then the client should
|
* then the substructure pointers should be set to 0 and then the client should
|
||||||
* use the codec_config.deallocate function to release it at a future point
|
* use the codec_config.deallocate function to release it at a future point
|
||||||
*/
|
*/
|
||||||
|
int (*pnf_nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_response_t* resp);
|
||||||
int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp);
|
int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp);
|
||||||
|
|
||||||
/*! A callback for the PNF_CONFIG.resp
|
/*! A callback for the PNF_CONFIG.resp
|
||||||
@@ -182,7 +185,8 @@ typedef struct nfapi_vnf_config
|
|||||||
* use the codec_config.deallocate function to release it at a future point
|
* use the codec_config.deallocate function to release it at a future point
|
||||||
*/
|
*/
|
||||||
int (*pnf_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp);
|
int (*pnf_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp);
|
||||||
|
int (*pnf_nr_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_config_response_t* resp);
|
||||||
|
|
||||||
/*! A callback for the PNF_START.resp
|
/*! A callback for the PNF_START.resp
|
||||||
* \param config A pointer to the vnf configuration
|
* \param config A pointer to the vnf configuration
|
||||||
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
||||||
@@ -203,7 +207,8 @@ typedef struct nfapi_vnf_config
|
|||||||
* use the codec_config.deallocate function to release it at a future point
|
* use the codec_config.deallocate function to release it at a future point
|
||||||
*/
|
*/
|
||||||
int (*pnf_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp);
|
int (*pnf_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp);
|
||||||
|
int (*pnf_nr_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_start_response_t* resp);
|
||||||
|
|
||||||
/*! A callback for the PNF_STOP.resp
|
/*! A callback for the PNF_STOP.resp
|
||||||
* \param config A pointer to the vnf configuration
|
* \param config A pointer to the vnf configuration
|
||||||
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
||||||
@@ -249,6 +254,7 @@ typedef struct nfapi_vnf_config
|
|||||||
* use the codec_config.deallocate function to release it at a future point
|
* use the codec_config.deallocate function to release it at a future point
|
||||||
*/
|
*/
|
||||||
int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp);
|
int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp);
|
||||||
|
int (*nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_response_scf_t* resp);
|
||||||
|
|
||||||
/*! A callback for the CONFIG.response
|
/*! A callback for the CONFIG.response
|
||||||
* \param config A pointer to the vnf configuration
|
* \param config A pointer to the vnf configuration
|
||||||
@@ -266,8 +272,9 @@ typedef struct nfapi_vnf_config
|
|||||||
* then the substructure pointers should be set to 0 and then the client should
|
* then the substructure pointers should be set to 0 and then the client should
|
||||||
* use the codec_config.deallocate function to release it at a future point
|
* use the codec_config.deallocate function to release it at a future point
|
||||||
*/
|
*/
|
||||||
|
int (*nr_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config_response_scf_t* resp);
|
||||||
int (*config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp);
|
int (*config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp);
|
||||||
|
|
||||||
/*! A callback for the START.resp
|
/*! A callback for the START.resp
|
||||||
* \param config A pointer to the vnf configuration
|
* \param config A pointer to the vnf configuration
|
||||||
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
||||||
@@ -285,6 +292,7 @@ typedef struct nfapi_vnf_config
|
|||||||
* use the codec_config.deallocate function to release it at a future point
|
* use the codec_config.deallocate function to release it at a future point
|
||||||
*/
|
*/
|
||||||
int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp);
|
int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp);
|
||||||
|
int (*nr_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_response_scf_t* resp);
|
||||||
|
|
||||||
/*! A callback for the STOP.resp
|
/*! A callback for the STOP.resp
|
||||||
* \param config A pointer to the vnf configuration
|
* \param config A pointer to the vnf configuration
|
||||||
@@ -469,6 +477,8 @@ void nfapi_vnf_config_destory(nfapi_vnf_config_t* config);
|
|||||||
*
|
*
|
||||||
* This function will not return untill nfapi_vnf_stop is called
|
* This function will not return untill nfapi_vnf_stop is called
|
||||||
*/
|
*/
|
||||||
|
int nfapi_nr_vnf_start(nfapi_vnf_config_t* config);
|
||||||
|
|
||||||
int nfapi_vnf_start(nfapi_vnf_config_t* config);
|
int nfapi_vnf_start(nfapi_vnf_config_t* config);
|
||||||
|
|
||||||
/*! Stop the VNF library.
|
/*! Stop the VNF library.
|
||||||
@@ -500,6 +510,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
|
|||||||
* \return 0 means success, -1 failure
|
* \return 0 means success, -1 failure
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req);
|
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req);
|
||||||
|
int nfapi_nr_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_request_t* req);
|
||||||
|
|
||||||
/*! Send the PNF_CONFIG.request
|
/*! Send the PNF_CONFIG.request
|
||||||
* \param config A pointer to a vnf config
|
* \param config A pointer to a vnf config
|
||||||
@@ -508,6 +519,7 @@ int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_pa
|
|||||||
* \return 0 means success, -1 failure
|
* \return 0 means success, -1 failure
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_config_request_t* req);
|
int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_config_request_t* req);
|
||||||
|
int nfapi_nr_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_nr_pnf_config_request_t* req);
|
||||||
|
|
||||||
/*! Send the PNF_START.request
|
/*! Send the PNF_START.request
|
||||||
* \param config A pointer to a vnf config
|
* \param config A pointer to a vnf config
|
||||||
@@ -516,6 +528,7 @@ int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_co
|
|||||||
* \return 0 means success, -1 failure
|
* \return 0 means success, -1 failure
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_start_request_t* req);
|
int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_start_request_t* req);
|
||||||
|
int nfapi_nr_vnf_pnf_start_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_nr_pnf_start_request_t* req);
|
||||||
|
|
||||||
/*! Send the PNF_STOP.request
|
/*! Send the PNF_STOP.request
|
||||||
* \param config A pointer to a vnf config
|
* \param config A pointer to a vnf config
|
||||||
@@ -532,6 +545,7 @@ int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_stop
|
|||||||
* \return 0 means success, -1 failure
|
* \return 0 means success, -1 failure
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req);
|
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req);
|
||||||
|
int nfapi_nr_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_request_scf_t* req);
|
||||||
|
|
||||||
/*! Send the CONFIG.request
|
/*! Send the CONFIG.request
|
||||||
* \param config A pointer to a vnf config
|
* \param config A pointer to a vnf config
|
||||||
@@ -539,6 +553,7 @@ int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_requ
|
|||||||
* \param req A pointer to a CONFIG.request message structure
|
* \param req A pointer to a CONFIG.request message structure
|
||||||
* \return 0 means success, -1 failure
|
* \return 0 means success, -1 failure
|
||||||
*/
|
*/
|
||||||
|
int nfapi_nr_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config_request_scf_t* req);
|
||||||
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req);
|
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req);
|
||||||
|
|
||||||
/*! Send the START.request
|
/*! Send the START.request
|
||||||
@@ -548,6 +563,7 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_re
|
|||||||
* \return 0 means success, -1 failure
|
* \return 0 means success, -1 failure
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req);
|
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req);
|
||||||
|
int nfapi_nr_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_request_scf_t* req);
|
||||||
|
|
||||||
/*! Send the STOP.request
|
/*! Send the STOP.request
|
||||||
* \param config A pointer to a vnf config
|
* \param config A pointer to a vnf config
|
||||||
@@ -692,6 +708,7 @@ typedef struct nfapi_vnf_p7_config
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int (*subframe_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf);
|
int (*subframe_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf);
|
||||||
|
int (*slot_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
||||||
|
|
||||||
/*! A callback for the HARQ.indication
|
/*! A callback for the HARQ.indication
|
||||||
* \param config A pointer to the vnf p7 configuration
|
* \param config A pointer to the vnf p7 configuration
|
||||||
@@ -885,6 +902,8 @@ void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config);
|
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config);
|
||||||
|
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config);
|
||||||
|
|
||||||
|
|
||||||
/*! Stop the VNF P7 library.
|
/*! Stop the VNF P7 library.
|
||||||
* \param config A pointer to an vnf p7 configuration structure
|
* \param config A pointer to an vnf p7 configuration structure
|
||||||
@@ -950,7 +969,7 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
|
|||||||
* may be released after this function call has returned or at a later pointer
|
* may be released after this function call has returned or at a later pointer
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req);
|
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req);
|
||||||
|
int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req);
|
||||||
/*! Send the HI_DCI0.request
|
/*! Send the HI_DCI0.request
|
||||||
* \param config A pointer to the vnf p7 configuration
|
* \param config A pointer to the vnf p7 configuration
|
||||||
* \param req A data structure for the decoded HI_DCI0.request.
|
* \param req A data structure for the decoded HI_DCI0.request.
|
||||||
@@ -960,7 +979,7 @@ int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_re
|
|||||||
* may be released after this function call has returned or at a later pointer
|
* may be released after this function call has returned or at a later pointer
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
|
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
|
||||||
|
int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req);
|
||||||
/*! Send the TX.req
|
/*! Send the TX.req
|
||||||
* \param config A pointer to the vnf p7 configuration
|
* \param config A pointer to the vnf p7 configuration
|
||||||
* \param req A data structure for the decoded HI_DCI0.request.
|
* \param req A data structure for the decoded HI_DCI0.request.
|
||||||
@@ -970,7 +989,7 @@ int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_reques
|
|||||||
* may be released after this function call has returned or at a later pointer
|
* may be released after this function call has returned or at a later pointer
|
||||||
*/
|
*/
|
||||||
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req);
|
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req);
|
||||||
|
int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req);
|
||||||
/*! Send the LBT_DL_CONFIG.requst
|
/*! Send the LBT_DL_CONFIG.requst
|
||||||
* \param config A pointer to the vnf p7 configuration
|
* \param config A pointer to the vnf p7 configuration
|
||||||
* \param req A data structure for the decoded LBT_DL_CONFIG.request.
|
* \param req A data structure for the decoded LBT_DL_CONFIG.request.
|
||||||
|
|||||||
@@ -21,9 +21,12 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "vnf.h"
|
#include "vnf.h"
|
||||||
|
#include "nfapi_nr_interface.h"
|
||||||
|
#include "nfapi_nr_interface_scf.h"
|
||||||
|
|
||||||
|
|
||||||
void* vnf_malloc(nfapi_vnf_config_t* config, size_t size)
|
void* vnf_malloc(nfapi_vnf_config_t* config, size_t size)
|
||||||
@@ -101,6 +104,39 @@ nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vnf_nr_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || config == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_PARAM.reponse\n");
|
||||||
|
|
||||||
|
nfapi_nr_pnf_param_response_t msg;
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
// Invoke the call back
|
||||||
|
if(config->pnf_nr_param_resp)
|
||||||
|
{
|
||||||
|
(config->pnf_nr_param_resp)(config, p5_idx, &msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure to release any dyanmic part of the message
|
||||||
|
if(msg.vendor_extension)
|
||||||
|
config->codec_config.deallocate(msg.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -134,6 +170,40 @@ void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vnf_nr_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || config == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_CONFIG_RESPONSE\n");
|
||||||
|
|
||||||
|
nfapi_nr_pnf_config_response_t msg;
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
// Invoke the call back
|
||||||
|
if(config->pnf_nr_config_resp)
|
||||||
|
{
|
||||||
|
(config->pnf_nr_config_resp)(config, p5_idx, &msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure to release any dyanmic part of the message
|
||||||
|
if(msg.vendor_extension)
|
||||||
|
config->codec_config.deallocate(msg.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void vnf_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
void vnf_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -167,6 +237,38 @@ void vnf_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vnf_nr_handle_pnf_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || config == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_START_RESPONSE\n");
|
||||||
|
|
||||||
|
nfapi_nr_pnf_start_response_t msg;
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
if(config->pnf_nr_start_resp)
|
||||||
|
{
|
||||||
|
(config->pnf_nr_start_resp)(config, p5_idx, &msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure to release any dyanmic part of the message
|
||||||
|
if(msg.vendor_extension)
|
||||||
|
config->codec_config.deallocate(msg.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void vnf_handle_pnf_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
void vnf_handle_pnf_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
{
|
{
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
@@ -298,8 +400,113 @@ void vnf_handle_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vnf_nr_handle_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
|
{
|
||||||
|
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || config == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PARAM_RESPONSE\n");
|
||||||
|
|
||||||
|
nfapi_nr_param_response_scf_t msg;
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (msg.error_code == NFAPI_NR_PARAM_MSG_OK)
|
||||||
|
{
|
||||||
|
nfapi_vnf_phy_info_t* phy_info = nfapi_vnf_phy_info_list_find(config, msg.header.phy_id);
|
||||||
|
|
||||||
|
if(msg.nfapi_config.p7_pnf_address_ipv4.tl.tag)
|
||||||
|
{
|
||||||
|
struct sockaddr_in sockAddr;
|
||||||
|
|
||||||
|
(void)memcpy(&sockAddr.sin_addr.s_addr, msg.nfapi_config.p7_pnf_address_ipv4.address, NFAPI_IPV4_ADDRESS_LENGTH);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 IPv4 address: %s\n", inet_ntoa(sockAddr.sin_addr));
|
||||||
|
|
||||||
|
// store address
|
||||||
|
phy_info->p7_pnf_address.sin_addr = sockAddr.sin_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.nfapi_config.p7_pnf_address_ipv6.tl.tag)
|
||||||
|
{
|
||||||
|
struct sockaddr_in6 sockAddr6;
|
||||||
|
char addr6[64];
|
||||||
|
(void)memcpy(&sockAddr6.sin6_addr, msg.nfapi_config.p7_pnf_address_ipv6.address, NFAPI_IPV6_ADDRESS_LENGTH);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 IPv6 address: %s\n", inet_ntop(AF_INET6, &sockAddr6.sin6_addr, addr6, sizeof(addr6)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.nfapi_config.p7_pnf_port.tl.tag)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 Port: %d\n", msg.nfapi_config.p7_pnf_port.value);
|
||||||
|
|
||||||
|
// store port
|
||||||
|
phy_info->p7_pnf_address.sin_port = htons(msg.nfapi_config.p7_pnf_port.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config->nr_param_resp)
|
||||||
|
{
|
||||||
|
(config->nr_param_resp)(config, p5_idx, &msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure to release any dyanmic part of the message
|
||||||
|
if(msg.vendor_extension)
|
||||||
|
config->codec_config.deallocate(msg.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vnf_nr_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
|
{
|
||||||
|
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || config == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received CONFIG_RESPONSE\n");
|
||||||
|
|
||||||
|
nfapi_nr_config_response_scf_t msg;
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 )
|
||||||
|
{
|
||||||
|
// check the error code:
|
||||||
|
|
||||||
|
if (msg.error_code == NFAPI_NR_CONFIG_MSG_OK){
|
||||||
|
if(config->nr_config_resp)
|
||||||
|
{
|
||||||
|
(config->nr_config_resp)(config, p5_idx, &msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure to release any dyanmic part of the message
|
||||||
|
if(msg.vendor_extension)
|
||||||
|
config->codec_config.deallocate(msg.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
{
|
{
|
||||||
|
|
||||||
// ensure it's valid
|
// ensure it's valid
|
||||||
if (pRecvMsg == NULL || config == NULL)
|
if (pRecvMsg == NULL || config == NULL)
|
||||||
{
|
{
|
||||||
@@ -314,9 +521,13 @@ void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config
|
|||||||
// unpack the message
|
// unpack the message
|
||||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 )
|
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 )
|
||||||
{
|
{
|
||||||
if(config->config_resp)
|
// check the error code:
|
||||||
{
|
|
||||||
(config->config_resp)(config, p5_idx, &msg);
|
if (msg.error_code == NFAPI_MSG_OK){
|
||||||
|
if(config->config_resp)
|
||||||
|
{
|
||||||
|
(config->config_resp)(config, p5_idx, &msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -362,6 +573,40 @@ void vnf_handle_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vnf_nr_handle_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
|
{
|
||||||
|
// ensure it's valid
|
||||||
|
if (pRecvMsg == NULL || config == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received START_RESPONSE\n");
|
||||||
|
|
||||||
|
nfapi_nr_start_response_scf_t msg;
|
||||||
|
|
||||||
|
// unpack the message
|
||||||
|
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||||
|
{ // check the error code
|
||||||
|
if (msg.error_code == NFAPI_NR_START_MSG_OK){
|
||||||
|
if(config->nr_start_resp)
|
||||||
|
{
|
||||||
|
(config->nr_start_resp)(config, p5_idx, &msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure to release any dyanmic part of the message
|
||||||
|
if(msg.vendor_extension)
|
||||||
|
config->codec_config.deallocate(msg.vendor_extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void vnf_handle_stop_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
void vnf_handle_stop_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -811,6 +1056,74 @@ void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_confi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vnf_nr_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
|
||||||
|
{
|
||||||
|
nfapi_p4_p5_message_header_t messageHeader;
|
||||||
|
|
||||||
|
// validate the input params
|
||||||
|
if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH || config == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p4_p5_message: invalid input params\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unpack the message header
|
||||||
|
if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &config->codec_config) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (messageHeader.message_id)
|
||||||
|
{
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE:
|
||||||
|
vnf_nr_handle_pnf_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
|
||||||
|
vnf_nr_handle_pnf_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
|
||||||
|
vnf_nr_handle_pnf_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_PNF_STOP_RESPONSE:
|
||||||
|
vnf_handle_pnf_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
|
||||||
|
vnf_nr_handle_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
|
||||||
|
vnf_nr_handle_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
|
||||||
|
vnf_nr_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
|
||||||
|
vnf_handle_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||||
|
messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
|
||||||
|
{
|
||||||
|
vnf_handle_vendor_extension(pRecvMsg, recvMsgLen, config, p5_idx, messageHeader.message_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
|
void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
|
||||||
{
|
{
|
||||||
nfapi_p4_p5_message_header_t messageHeader;
|
nfapi_p4_p5_message_header_t messageHeader;
|
||||||
@@ -926,6 +1239,137 @@ void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int vnf_nr_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
|
||||||
|
{
|
||||||
|
if(1)
|
||||||
|
{
|
||||||
|
int socket_connected = 1;
|
||||||
|
|
||||||
|
// 1. Peek the message header
|
||||||
|
// 2. If the message is larger than the stack buffer then create a dynamic buffer
|
||||||
|
// 3. Read the buffer
|
||||||
|
// 4. Handle the p5 message
|
||||||
|
|
||||||
|
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||||
|
uint8_t header_buffer[header_buffer_size];
|
||||||
|
|
||||||
|
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
|
||||||
|
uint8_t stack_buffer[stack_buffer_size];
|
||||||
|
|
||||||
|
uint8_t* dynamic_buffer = 0;
|
||||||
|
|
||||||
|
uint8_t* read_buffer = &stack_buffer[0];
|
||||||
|
uint32_t message_size = 0;
|
||||||
|
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
socklen_t addr_len = sizeof(addr);
|
||||||
|
|
||||||
|
struct sctp_sndrcvinfo sndrcvinfo;
|
||||||
|
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||||
|
|
||||||
|
{
|
||||||
|
int flags = MSG_PEEK;
|
||||||
|
message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
|
||||||
|
|
||||||
|
if(message_size == -1)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to peek sctp message size errno:%d\n", errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nfapi_p4_p5_message_header_t header;
|
||||||
|
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
|
||||||
|
if(unpack_result < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to decode message header %d\n", unpack_result);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
message_size = header.message_length;
|
||||||
|
|
||||||
|
// now have the size of the mesage
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message_size > stack_buffer_size)
|
||||||
|
{
|
||||||
|
dynamic_buffer = (uint8_t*)malloc(message_size);
|
||||||
|
|
||||||
|
if(dynamic_buffer == NULL)
|
||||||
|
{
|
||||||
|
// todo : add error mesage
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
read_buffer = dynamic_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int flags = 0;
|
||||||
|
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||||
|
|
||||||
|
int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
|
||||||
|
if(recvmsg_result == -1)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flags & MSG_NOTIFICATION)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||||
|
|
||||||
|
// todo - handle the events
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
|
||||||
|
pnf->p5_sock,
|
||||||
|
inet_ntoa(addr.sin_addr),
|
||||||
|
ntohs(addr.sin_port),
|
||||||
|
sndrcvinfo.sinfo_assoc_id,
|
||||||
|
sndrcvinfo.sinfo_stream,
|
||||||
|
ntohl(sndrcvinfo.sinfo_ppid),
|
||||||
|
message_size,
|
||||||
|
flags);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// handle now if complete message in one or more segments
|
||||||
|
if ((flags & 0x80) == 0x80)
|
||||||
|
{
|
||||||
|
// printf("\nVNF RECEIVES:\n");
|
||||||
|
// for(int i=0; i<message_size; i++){
|
||||||
|
// printf("%d", read_buffer[i]);
|
||||||
|
// }
|
||||||
|
// printf("\n");
|
||||||
|
|
||||||
|
vnf_nr_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
|
||||||
|
|
||||||
|
// assume socket disconnected
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
|
||||||
|
socket_connected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dynamic_buffer)
|
||||||
|
{
|
||||||
|
free(dynamic_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return socket_connected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
|
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
|
||||||
{
|
{
|
||||||
if(1)
|
if(1)
|
||||||
@@ -1024,6 +1468,12 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
|
|||||||
// handle now if complete message in one or more segments
|
// handle now if complete message in one or more segments
|
||||||
if ((flags & 0x80) == 0x80)
|
if ((flags & 0x80) == 0x80)
|
||||||
{
|
{
|
||||||
|
// printf("\nVNF RECEIVES:\n");
|
||||||
|
// for(int i=0; i<message_size; i++){
|
||||||
|
// printf("%d", read_buffer[i]);
|
||||||
|
// }
|
||||||
|
// printf("\n");
|
||||||
|
|
||||||
vnf_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
|
vnf_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1051,6 +1501,12 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
|
|||||||
|
|
||||||
static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len, uint8_t stream)
|
static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len, uint8_t stream)
|
||||||
{
|
{
|
||||||
|
// printf("\n MESSAGE SENT: \n");
|
||||||
|
// for(int i=0; i<len; i++){
|
||||||
|
// printf("%d", *(uint8_t *)(msg + i));
|
||||||
|
// }
|
||||||
|
// printf("\n");
|
||||||
|
|
||||||
//NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s len:%d stream:%d\n", __FUNCTION__, len, stream);
|
//NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s len:%d stream:%d\n", __FUNCTION__, len, stream);
|
||||||
|
|
||||||
int result = sctp_sendmsg(pnf->p5_sock, msg, len, (struct sockaddr*)&pnf->p5_pnf_sockaddr, sizeof(pnf->p5_pnf_sockaddr),1, 0, stream, 0, 4);
|
int result = sctp_sendmsg(pnf->p5_sock, msg, len, (struct sockaddr*)&pnf->p5_pnf_sockaddr, sizeof(pnf->p5_pnf_sockaddr),1, 0, stream, 0, 4);
|
||||||
@@ -1071,6 +1527,29 @@ static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
|
||||||
|
{
|
||||||
|
nfapi_vnf_pnf_info_t* pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
|
||||||
|
|
||||||
|
if(pnf)
|
||||||
|
{
|
||||||
|
// pack the message for transmission
|
||||||
|
int packedMessageLength = nfapi_nr_p5_message_pack(msg, msg_len, vnf->tx_message_buffer, sizeof(vnf->tx_message_buffer), &vnf->_public.codec_config);
|
||||||
|
|
||||||
|
if (packedMessageLength < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed with return %d\n", packedMessageLength);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return vnf_send_p5_msg(pnf, vnf->tx_message_buffer, packedMessageLength, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
|
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,418 @@ void nfapi_vnf_config_destory(nfapi_vnf_config_t* config)
|
|||||||
free(config);
|
free(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_vnf_start(nfapi_vnf_config_t* config)
|
||||||
|
{
|
||||||
|
// Verify that config is not null
|
||||||
|
if(config == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||||
|
if(config->trace)
|
||||||
|
nfapi_trace_g = (nfapi_trace_fn_t)config->trace;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
|
int p5ListenSock, p5Sock;
|
||||||
|
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
socklen_t addrSize;
|
||||||
|
|
||||||
|
struct sockaddr_in6 addr6;
|
||||||
|
|
||||||
|
struct sctp_event_subscribe events;
|
||||||
|
struct sctp_initmsg initMsg;
|
||||||
|
int noDelay;
|
||||||
|
|
||||||
|
(void)memset(&addr, 0, sizeof(struct sockaddr_in));
|
||||||
|
(void)memset(&addr6, 0, sizeof(struct sockaddr_in6));
|
||||||
|
(void)memset(&events, 0, sizeof(struct sctp_event_subscribe));
|
||||||
|
(void)memset(&initMsg, 0, sizeof(struct sctp_initmsg));
|
||||||
|
|
||||||
|
vnf_t* vnf = (vnf_t*)(config);
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port);
|
||||||
|
|
||||||
|
/*
|
||||||
|
char * host = 0;
|
||||||
|
char * port = "4242";
|
||||||
|
struct addrinfo hints;
|
||||||
|
bzero(&hints, sizeof(struct addrinfo));
|
||||||
|
//hints.ai_flags=AI_PASSIVE;
|
||||||
|
//hints.ai_flags=AI_DEFAULT;
|
||||||
|
hints.ai_family=AF_UNSPEC;
|
||||||
|
//hints.ai_family=AF_INET6;
|
||||||
|
hints.ai_socktype=SOCK_STREAM;
|
||||||
|
//hints.ai_protocol=IPPROTO_SCTP
|
||||||
|
|
||||||
|
struct addrinfo *aiHead = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int result = getaddrinfo(host, port, &hints, &aiHead);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "getaddrinfo return %d %d\n", result, errno);
|
||||||
|
|
||||||
|
while(aiHead->ai_next != NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "addr info %d (IP %d UDP %d SCTP %d)\n %d (%d)\n",
|
||||||
|
aiHead->ai_protocol, IPPROTO_IP, IPPROTO_UDP, IPPROTO_SCTP,
|
||||||
|
aiHead->ai_flags, AI_PASSIVE);
|
||||||
|
|
||||||
|
char hostBfr[ NI_MAXHOST ];
|
||||||
|
char servBfr[ NI_MAXSERV ];
|
||||||
|
|
||||||
|
getnameinfo(aiHead->ai_addr,
|
||||||
|
aiHead->ai_addrlen,
|
||||||
|
hostBfr,
|
||||||
|
sizeof( hostBfr ),
|
||||||
|
servBfr,
|
||||||
|
sizeof( servBfr ),
|
||||||
|
NI_NUMERICHOST | NI_NUMERICSERV );
|
||||||
|
|
||||||
|
switch(aiHead->ai_family)
|
||||||
|
{
|
||||||
|
case PF_INET:
|
||||||
|
{
|
||||||
|
struct sockaddr_in *pSadrIn = (struct sockaddr_in*) aiHead->ai_addr;
|
||||||
|
printf(
|
||||||
|
" ai_addr = sin_family: %d (AF_INET = %d, "
|
||||||
|
"AF_INET6 = %d)\n"
|
||||||
|
" sin_addr: %s\n"
|
||||||
|
" sin_port: %s\n",
|
||||||
|
pSadrIn->sin_family,
|
||||||
|
AF_INET,
|
||||||
|
AF_INET6,
|
||||||
|
hostBfr,
|
||||||
|
servBfr );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PF_INET6:
|
||||||
|
{
|
||||||
|
struct sockaddr_in6 *pSadrIn6 = (struct sockaddr_in6*) aiHead->ai_addr;
|
||||||
|
fprintf( stderr,
|
||||||
|
" ai_addr = sin6_family: %d (AF_INET = %d, "
|
||||||
|
"AF_INET6 = %d) \n"
|
||||||
|
" sin6_addr: %s\n"
|
||||||
|
" sin6_port: %s\n"
|
||||||
|
" sin6_flowinfo: %d\n"
|
||||||
|
" sin6_scope_id: %d\n",
|
||||||
|
pSadrIn6->sin6_family,
|
||||||
|
AF_INET,
|
||||||
|
AF_INET6,
|
||||||
|
hostBfr,
|
||||||
|
servBfr,
|
||||||
|
pSadrIn6->sin6_flowinfo,
|
||||||
|
pSadrIn6->sin6_scope_id);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Not ment to be here\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
aiHead = aiHead->ai_next;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
{
|
||||||
|
int protocol;
|
||||||
|
int domain;
|
||||||
|
|
||||||
|
if (vnf->sctp)
|
||||||
|
protocol = IPPROTO_SCTP;
|
||||||
|
else
|
||||||
|
protocol = IPPROTO_IP;
|
||||||
|
|
||||||
|
if(config->vnf_ipv6)
|
||||||
|
{
|
||||||
|
domain = PF_INET6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
domain = AF_INET;
|
||||||
|
}
|
||||||
|
|
||||||
|
// open the SCTP socket
|
||||||
|
if ((p5ListenSock = socket(domain, SOCK_STREAM, protocol)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created... %d\n", p5ListenSock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vnf->sctp)
|
||||||
|
{
|
||||||
|
// configure for MSG_NOTIFICATION
|
||||||
|
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(struct sctp_event_subscribe)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_EVENTS) errno: %d\n", errno);
|
||||||
|
close(p5ListenSock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF Setting the SCTP_INITMSG\n");
|
||||||
|
// configure the SCTP socket options
|
||||||
|
initMsg.sinit_num_ostreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
|
||||||
|
initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
|
||||||
|
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno)
|
||||||
|
close(p5ListenSock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
noDelay = 1;
|
||||||
|
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (STCP_NODELAY) errno: %d\n", errno);
|
||||||
|
close(p5ListenSock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
struct sctp_event_subscribe events;
|
||||||
|
memset( (void *)&events, 0, sizeof(events) );
|
||||||
|
events.sctp_data_io_event = 1;
|
||||||
|
|
||||||
|
if(setsockopt(p5ListenSock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
|
||||||
|
close(p5ListenSock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(config->vnf_ipv6)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV6 binding to port %d %d\n", config->vnf_p5_port, p5ListenSock);
|
||||||
|
addr6.sin6_family = AF_INET6;
|
||||||
|
addr6.sin6_port = htons(config->vnf_p5_port);
|
||||||
|
addr6.sin6_addr = in6addr_any;
|
||||||
|
|
||||||
|
// bind to the configured address and port
|
||||||
|
if (bind(p5ListenSock, (struct sockaddr *)&addr6, sizeof(struct sockaddr_in6)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
|
||||||
|
close(p5ListenSock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(config->vnf_ipv4)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV4 binding to port %d\n", config->vnf_p5_port);
|
||||||
|
addr.sin_family = AF_INET;
|
||||||
|
addr.sin_port = htons(config->vnf_p5_port);
|
||||||
|
addr.sin_addr.s_addr = INADDR_ANY;
|
||||||
|
|
||||||
|
// bind to the configured address and port
|
||||||
|
if (bind(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
|
||||||
|
//if (sctp_bindx(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), SCTP_BINDX_ADD_ADDR) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
|
||||||
|
close(p5ListenSock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "bind succeeded..%d.\n", p5ListenSock);
|
||||||
|
|
||||||
|
// put the socket into listen mode
|
||||||
|
if (listen(p5ListenSock, 2) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After listen errno: %d\n", errno);
|
||||||
|
close(p5ListenSock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "listen succeeded...\n");
|
||||||
|
|
||||||
|
struct timeval tv;
|
||||||
|
fd_set read_fd_set;
|
||||||
|
|
||||||
|
|
||||||
|
int p5_idx = 0;
|
||||||
|
while(vnf->terminate == 0)
|
||||||
|
{
|
||||||
|
FD_ZERO(&read_fd_set);
|
||||||
|
|
||||||
|
FD_SET(p5ListenSock, &read_fd_set);
|
||||||
|
int max_fd = p5ListenSock;
|
||||||
|
|
||||||
|
tv.tv_sec = 5;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
|
nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
|
||||||
|
while(pnf != 0)
|
||||||
|
{
|
||||||
|
if(pnf->connected)
|
||||||
|
{
|
||||||
|
FD_SET(pnf->p5_sock, &read_fd_set);
|
||||||
|
if (pnf->p5_sock > max_fd)
|
||||||
|
{
|
||||||
|
max_fd = pnf->p5_sock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf = pnf->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
int select_result = select(max_fd + 1, &read_fd_set, 0, 0, &tv);
|
||||||
|
|
||||||
|
if(select_result == -1)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "select result %d errno %d\n", select_result, errno);
|
||||||
|
close(p5ListenSock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if(select_result)
|
||||||
|
{
|
||||||
|
if(FD_ISSET(p5ListenSock, &read_fd_set))
|
||||||
|
{
|
||||||
|
addrSize = sizeof(struct sockaddr_in);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Accepting connection from PNF...\n");
|
||||||
|
|
||||||
|
p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
|
||||||
|
|
||||||
|
if (p5Sock < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to accept PNF connection reason:%d\n", errno);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||||
|
nfapi_vnf_pnf_info_t* pnf = (nfapi_vnf_pnf_info_t*)malloc(sizeof(nfapi_vnf_pnf_info_t));
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
|
||||||
|
memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
|
||||||
|
pnf->p5_sock = p5Sock;
|
||||||
|
pnf->p5_idx = p5_idx++;
|
||||||
|
pnf->p5_pnf_sockaddr = addr;
|
||||||
|
pnf->connected = 1;
|
||||||
|
|
||||||
|
nfapi_vnf_pnf_list_add(config, pnf);
|
||||||
|
|
||||||
|
// Inform mac that a pnf connection has been established
|
||||||
|
// todo : allow mac to 'accept' the connection. i.e. to
|
||||||
|
// reject it.
|
||||||
|
if(config->pnf_nr_connection_indication != 0)
|
||||||
|
{
|
||||||
|
(config->pnf_nr_connection_indication)(config, pnf->p5_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// check the connection status
|
||||||
|
{
|
||||||
|
struct sctp_status status;
|
||||||
|
(void)memset(&status, 0, sizeof(struct sctp_status));
|
||||||
|
socklen_t optLen = (socklen_t) sizeof(struct sctp_status);
|
||||||
|
if (getsockopt(p5Sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Association ID = %d\n", status.sstat_assoc_id);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Receiver window size = %d\n", status.sstat_rwnd);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF In Streams = %d\n", status.sstat_instrms);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Out Streams = %d\n", status.sstat_outstrms);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint8_t delete_pnfs = 0;
|
||||||
|
|
||||||
|
nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
|
||||||
|
while(pnf != 0)
|
||||||
|
{
|
||||||
|
if(FD_ISSET(pnf->p5_sock, &read_fd_set))
|
||||||
|
{
|
||||||
|
if(vnf_nr_read_dispatch_message(config, pnf) == 0)
|
||||||
|
{
|
||||||
|
if(config->pnf_disconnect_indication != 0)
|
||||||
|
{
|
||||||
|
(config->pnf_disconnect_indication)(config, pnf->p5_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(pnf->p5_sock);
|
||||||
|
|
||||||
|
pnf->to_delete = 1;
|
||||||
|
delete_pnfs = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf = pnf->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(delete_pnfs)
|
||||||
|
{
|
||||||
|
nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
|
||||||
|
nfapi_vnf_pnf_info_t* prev = 0;
|
||||||
|
while(pnf != 0)
|
||||||
|
{
|
||||||
|
nfapi_vnf_pnf_info_t* curr = pnf;
|
||||||
|
|
||||||
|
if(pnf->to_delete == 1)
|
||||||
|
{
|
||||||
|
if(prev == 0)
|
||||||
|
{
|
||||||
|
config->pnf_list = pnf->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prev->next = pnf->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnf = pnf->next;
|
||||||
|
|
||||||
|
free(curr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prev = pnf;
|
||||||
|
pnf = pnf->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// timeout
|
||||||
|
|
||||||
|
// Should we test for socket closure here every second?
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Sock socket's\n");
|
||||||
|
{
|
||||||
|
nfapi_vnf_pnf_info_t* curr = config->pnf_list;
|
||||||
|
while(curr != NULL)
|
||||||
|
{
|
||||||
|
if(config->pnf_disconnect_indication)
|
||||||
|
{
|
||||||
|
(config->pnf_disconnect_indication)(config, curr->p5_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(curr->p5_sock);
|
||||||
|
curr = curr->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Listen socket\n");
|
||||||
|
close(p5ListenSock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_vnf_start(nfapi_vnf_config_t* config)
|
int nfapi_vnf_start(nfapi_vnf_config_t* config)
|
||||||
{
|
{
|
||||||
// Verify that config is not null
|
// Verify that config is not null
|
||||||
@@ -486,6 +898,16 @@ int nfapi_vnf_stop(nfapi_vnf_config_t* config)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_request_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_t* _this = (vnf_t*)(config);
|
||||||
|
|
||||||
|
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_param_request_t));
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req)
|
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
@@ -496,6 +918,17 @@ int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_pa
|
|||||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_param_request_t));
|
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_param_request_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_config_request_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_t* _this = (vnf_t*)(config);
|
||||||
|
|
||||||
|
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_config_request_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_request_t* req)
|
int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
@@ -516,6 +949,16 @@ int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_st
|
|||||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_start_request_t));
|
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_start_request_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_vnf_pnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_start_request_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_t* _this = (vnf_t*)(config);
|
||||||
|
|
||||||
|
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_start_request_t));
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_request_t* req)
|
int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
@@ -526,6 +969,16 @@ int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_sto
|
|||||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_stop_request_t));
|
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_stop_request_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_request_scf_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_t* _this = (vnf_t*)(config);
|
||||||
|
|
||||||
|
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_param_request_scf_t));
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req)
|
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
@@ -535,6 +988,38 @@ int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_requ
|
|||||||
|
|
||||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_param_request_t));
|
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_param_request_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config_request_scf_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_t* _this = (vnf_t*)(config);
|
||||||
|
|
||||||
|
nfapi_vnf_phy_info_t* phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id);
|
||||||
|
|
||||||
|
if(phy == NULL)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "%s failed to find phy information phy_id:%d\n", __FUNCTION__, req->header.phy_id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the timing parameters
|
||||||
|
req->nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
|
||||||
|
req->nfapi_config.timing_window.value = phy->timing_window;
|
||||||
|
req->num_tlv++;
|
||||||
|
|
||||||
|
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG;
|
||||||
|
req->nfapi_config.timing_info_mode.value = phy->timing_info_mode;
|
||||||
|
req->num_tlv++;
|
||||||
|
|
||||||
|
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG;
|
||||||
|
req->nfapi_config.timing_info_period.value = phy->timing_info_period;
|
||||||
|
req->num_tlv++;
|
||||||
|
|
||||||
|
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_config_request_scf_t));
|
||||||
|
}
|
||||||
|
|
||||||
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req)
|
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
@@ -565,7 +1050,8 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_re
|
|||||||
|
|
||||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_config_request_t));
|
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_config_request_t));
|
||||||
}
|
}
|
||||||
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req)
|
|
||||||
|
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t * req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -574,6 +1060,18 @@ int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_requ
|
|||||||
|
|
||||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_start_request_t));
|
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_start_request_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nfapi_nr_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_request_scf_t * req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_t* _this = (vnf_t*)(config);
|
||||||
|
|
||||||
|
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_start_request_scf_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_vnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_request_t* req)
|
int nfapi_vnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
@@ -664,7 +1162,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
|
|||||||
info->p5_idx = p5_idx;
|
info->p5_idx = p5_idx;
|
||||||
info->phy_id = vnf->next_phy_id++;
|
info->phy_id = vnf->next_phy_id++;
|
||||||
|
|
||||||
info->timing_window = 30; // This seems to override what gets set by the user - why???
|
info->timing_window = 30; // This seems to override what gets set by the user - why??? //TODO: Change in NR in terms of microsecends,what should be the value?
|
||||||
info->timing_info_mode = 0x03;
|
info->timing_info_mode = 0x03;
|
||||||
info->timing_info_period = 128;
|
info->timing_info_period = 128;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#define FAPI2_IP_DSCP 0
|
#define FAPI2_IP_DSCP 0
|
||||||
|
|
||||||
|
|
||||||
nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
|
nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
|
||||||
{
|
{
|
||||||
vnf_p7_t* _this = (vnf_p7_t*)calloc(1, sizeof(vnf_p7_t));
|
vnf_p7_t* _this = (vnf_p7_t*)calloc(1, sizeof(vnf_p7_t));
|
||||||
@@ -90,6 +91,368 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
|
|||||||
|
|
||||||
// monitor the p7 endpoints and the timing loop and
|
// monitor the p7 endpoints and the timing loop and
|
||||||
// send indications to mac
|
// send indications to mac
|
||||||
|
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||||
|
{
|
||||||
|
if(config == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
|
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||||
|
|
||||||
|
// Create p7 receive udp port
|
||||||
|
// todo : this needs updating for Ipv6
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
|
||||||
|
|
||||||
|
// open the UDP socket
|
||||||
|
if ((vnf_p7->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 socket created...\n");
|
||||||
|
|
||||||
|
// configure the UDP socket options
|
||||||
|
int iptos_value = FAPI2_IP_DSCP << 2;
|
||||||
|
if (setsockopt(vnf_p7->socket, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n");
|
||||||
|
|
||||||
|
// Create the address structure
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
memset(&addr, 0, sizeof(addr));
|
||||||
|
addr.sin_family = AF_INET;
|
||||||
|
addr.sin_port = htons(config->port);
|
||||||
|
addr.sin_addr.s_addr = INADDR_ANY;
|
||||||
|
|
||||||
|
// bind to the configured port
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 binding too %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||||
|
if (bind(vnf_p7->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
|
||||||
|
//if (sctp_bindx(config->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), 0) < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
|
||||||
|
|
||||||
|
|
||||||
|
//struct timespec original_pselect_timeout;
|
||||||
|
struct timespec pselect_timeout;
|
||||||
|
pselect_timeout.tv_sec = 0;
|
||||||
|
pselect_timeout.tv_nsec = 500000; // ns in a 0.5 ms
|
||||||
|
//pselect_timeout.tv_nsec = 500000;
|
||||||
|
|
||||||
|
struct timespec pselect_start;
|
||||||
|
struct timespec pselect_stop;
|
||||||
|
|
||||||
|
//struct timespec sf_end;
|
||||||
|
|
||||||
|
long last_millisecond = -1;
|
||||||
|
|
||||||
|
|
||||||
|
// struct timespec sf_duration; //Change to slot_duration?
|
||||||
|
// sf_duration.tv_sec = 0;
|
||||||
|
// sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
|
||||||
|
struct timespec slot_duration;
|
||||||
|
slot_duration.tv_sec = 0;
|
||||||
|
//slot_duration.tv_nsec = 0.5e6;
|
||||||
|
slot_duration.tv_nsec = 0.5e6;
|
||||||
|
|
||||||
|
|
||||||
|
// struct timespec sf_start; //Change to slot_start?
|
||||||
|
struct timespec slot_start;
|
||||||
|
// clock_gettime(CLOCK_MONOTONIC, &sf_start);
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &slot_start);
|
||||||
|
long millisecond = slot_start.tv_nsec / 1e6; //Check if we have to change
|
||||||
|
//long millisecond = slot_start.tv_nsec / 0.5e6;
|
||||||
|
// sf_start = timespec_add(sf_start, sf_duration);
|
||||||
|
slot_start = timespec_add(slot_start, slot_duration);
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec);
|
||||||
|
|
||||||
|
while(vnf_p7->terminate == 0)
|
||||||
|
{
|
||||||
|
fd_set rfds;
|
||||||
|
int maxSock = 0;
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
int selectRetval = 0;
|
||||||
|
|
||||||
|
// Add the p7 socket
|
||||||
|
FD_SET(vnf_p7->socket, &rfds);
|
||||||
|
maxSock = vnf_p7->socket;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
|
||||||
|
//long millisecond = pselect_start.tv_nsec / 1e6;
|
||||||
|
|
||||||
|
if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
|
||||||
|
{
|
||||||
|
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
|
||||||
|
|
||||||
|
|
||||||
|
//if((pselect_start.tv_sec > sf_start.tv_sec) ||
|
||||||
|
// ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
|
||||||
|
if((pselect_start.tv_sec > slot_start.tv_sec) || ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec)))
|
||||||
|
{
|
||||||
|
// overran the end of the subframe we do not want to wait
|
||||||
|
pselect_timeout.tv_sec = 0;
|
||||||
|
pselect_timeout.tv_nsec = 0;
|
||||||
|
|
||||||
|
//struct timespec overrun = timespec_sub(pselect_start, sf_start);
|
||||||
|
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// still time before the end of the subframe wait
|
||||||
|
//pselect_timeout = timespec_sub(sf_start, pselect_start);
|
||||||
|
pselect_timeout = timespec_sub(slot_start, pselect_start);
|
||||||
|
}
|
||||||
|
|
||||||
|
//original_pselect_timeout = pselect_timeout;
|
||||||
|
|
||||||
|
// detemine how long to sleep in ns before the start of the next 1ms
|
||||||
|
//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
|
||||||
|
|
||||||
|
//uint8_t underrun_possible =0;
|
||||||
|
|
||||||
|
// if we are not sleeping until the next milisecond due to the
|
||||||
|
// insycn minor adjment flag it so we don't consider it an error
|
||||||
|
//uint8_t underrun_possible =0;
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
|
||||||
|
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0 && pselect_start.tv_nsec != 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %d (%d->%d)\n", phy->insync_minor_adjustment,
|
||||||
|
pselect_timeout.tv_nsec, pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000))
|
||||||
|
if(phy->insync_minor_adjustment > 0)
|
||||||
|
{
|
||||||
|
// todo check we don't go below 0
|
||||||
|
if((phy->insync_minor_adjustment * 1000) > pselect_timeout.tv_nsec)
|
||||||
|
pselect_timeout.tv_nsec = 0;
|
||||||
|
else
|
||||||
|
pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
|
||||||
|
|
||||||
|
|
||||||
|
//underrun_possible = 1;
|
||||||
|
}
|
||||||
|
else if(phy->insync_minor_adjustment < 0)
|
||||||
|
{
|
||||||
|
// todo check we don't go below 0
|
||||||
|
pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
|
||||||
|
|
||||||
|
|
||||||
|
//phy->insync_minor_adjustment = 0;
|
||||||
|
phy->insync_minor_adjustment_duration--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//long wraps = pselect_timeout.tv_nsec % 1e9;
|
||||||
|
|
||||||
|
|
||||||
|
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||||
|
// selectRetval = pselect(120, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
|
||||||
|
|
||||||
|
nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
|
||||||
|
|
||||||
|
if (selectRetval==-1 && errno == 22)
|
||||||
|
{
|
||||||
|
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
|
||||||
|
// pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||||
|
// phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||||
|
// sf_duration.tv_sec, sf_duration.tv_nsec);
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
|
||||||
|
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||||
|
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||||
|
slot_duration.tv_sec, slot_duration.tv_nsec);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(selectRetval == 0)
|
||||||
|
{
|
||||||
|
// calculate the start of the next slot
|
||||||
|
//sf_start = timespec_add(sf_start, sf_duration);
|
||||||
|
slot_start = timespec_add(slot_start, slot_duration);
|
||||||
|
//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||||
|
|
||||||
|
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
|
||||||
|
{
|
||||||
|
long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
|
||||||
|
|
||||||
|
//sf_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||||
|
slot_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
/* if (sf_start.tv_nsec > 1e9) //Change to 0.5e6?
|
||||||
|
{
|
||||||
|
sf_start.tv_sec++;
|
||||||
|
sf_start.tv_nsec-=1e9;
|
||||||
|
}
|
||||||
|
else if (sf_start.tv_nsec < 0)
|
||||||
|
{
|
||||||
|
sf_start.tv_sec--;
|
||||||
|
sf_start.tv_nsec+=1e9;
|
||||||
|
}*/
|
||||||
|
if (slot_start.tv_nsec > 1e9)
|
||||||
|
{
|
||||||
|
slot_start.tv_sec++;
|
||||||
|
slot_start.tv_nsec-=1e9;
|
||||||
|
}
|
||||||
|
else if (slot_start.tv_nsec < 0)
|
||||||
|
{
|
||||||
|
slot_start.tv_sec--;
|
||||||
|
slot_start.tv_nsec+=1e9;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
|
||||||
|
if(phy->insync_minor_adjustment > 0)
|
||||||
|
{
|
||||||
|
// decrease the subframe duration a little
|
||||||
|
if (sf_start.tv_nsec > insync_minor_adjustment_ns)
|
||||||
|
sf_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
|
||||||
|
sf_start.tv_sec--;
|
||||||
|
sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(phy->insync_minor_adjustment < 0)
|
||||||
|
{
|
||||||
|
// todo check we don't go below 0
|
||||||
|
// increase the subframe duration a little
|
||||||
|
sf_start.tv_nsec += insync_minor_adjustment_ns;
|
||||||
|
|
||||||
|
if (sf_start.tv_nsec < 0)
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||||
|
sf_start.tv_sec++;
|
||||||
|
sf_start.tv_nsec += 1e9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//phy->insync_minor_adjustment = 0;
|
||||||
|
phy->insync_minor_adjustment_duration--;
|
||||||
|
|
||||||
|
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
|
||||||
|
// phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
|
||||||
|
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Slot minor adjustment %dus slot_start.tv_nsec:%d duration:%u\n",
|
||||||
|
// phy->insync_minor_adjustment, slot_start.tv_nsec, phy->insync_minor_adjustment_duration);
|
||||||
|
|
||||||
|
if (phy->insync_minor_adjustment_duration==0)
|
||||||
|
{
|
||||||
|
phy->insync_minor_adjustment = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
|
||||||
|
if(millisecond == pselect_stop_millisecond)
|
||||||
|
{
|
||||||
|
// we have woke up in the same subframe
|
||||||
|
if(underrun_possible == 0)
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect underrun %ld (%d.%d)\n", millisecond, pselect_stop.tv_sec, pselect_stop.tv_nsec);
|
||||||
|
}
|
||||||
|
else if(((millisecond + 1) % 1000) != pselect_stop_millisecond)
|
||||||
|
{
|
||||||
|
// we have overrun the subframe
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect overrun %ld %ld\n", millisecond, pselect_stop_millisecond);
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe underrun %ld\n", millisecond);
|
||||||
|
}
|
||||||
|
last_millisecond = millisecond;
|
||||||
|
*/
|
||||||
|
|
||||||
|
//millisecond ++;
|
||||||
|
millisecond = millisecond + 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we have overrun the subframe advance to go and collect $200
|
||||||
|
|
||||||
|
if((millisecond - last_millisecond) > 3)
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1);
|
||||||
|
|
||||||
|
last_millisecond = ( last_millisecond + 1 ) % 1000;
|
||||||
|
selectRetval = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selectRetval == 0)
|
||||||
|
{
|
||||||
|
//vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
|
||||||
|
vnf_p7->slot_start_time_hr = vnf_get_current_time_hr();
|
||||||
|
struct timespec current_time;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, ¤t_time);
|
||||||
|
// pselect timed out
|
||||||
|
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
|
||||||
|
while(curr != 0)
|
||||||
|
{
|
||||||
|
if (curr->slot == 19)
|
||||||
|
{ //curr->slot = 0;
|
||||||
|
if(curr->sfn == 1023)
|
||||||
|
curr->sfn=0;
|
||||||
|
else
|
||||||
|
curr->sfn++;
|
||||||
|
curr->slot=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curr->slot++;
|
||||||
|
}
|
||||||
|
vnf_nr_sync(vnf_p7, curr);
|
||||||
|
curr = curr->next;
|
||||||
|
}
|
||||||
|
send_mac_slot_indications(vnf_p7);
|
||||||
|
}
|
||||||
|
else if(selectRetval > 0)
|
||||||
|
{
|
||||||
|
// have a p7 message
|
||||||
|
if(FD_ISSET(vnf_p7->socket, &rfds))
|
||||||
|
{
|
||||||
|
vnf_nr_p7_read_dispatch_message(vnf_p7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// pselect error
|
||||||
|
if(selectRetval == -1 && errno == EINTR)
|
||||||
|
{
|
||||||
|
// a sigal was received.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
|
||||||
|
// should we exit now?
|
||||||
|
if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
|
||||||
|
{
|
||||||
|
usleep(100000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
|
||||||
|
close(vnf_p7->socket);
|
||||||
|
|
||||||
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() returning\n", __FUNCTION__);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||||
{
|
{
|
||||||
if(config == 0)
|
if(config == 0)
|
||||||
@@ -408,6 +771,7 @@ if (selectRetval==-1 && errno == 22)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config)
|
int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config)
|
||||||
{
|
{
|
||||||
if(config == 0)
|
if(config == 0)
|
||||||
@@ -434,17 +798,18 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr,
|
|||||||
memset(node, 0, sizeof(nfapi_vnf_p7_connection_info_t));
|
memset(node, 0, sizeof(nfapi_vnf_p7_connection_info_t));
|
||||||
node->phy_id = phy_id;
|
node->phy_id = phy_id;
|
||||||
node->in_sync = 0;
|
node->in_sync = 0;
|
||||||
node->dl_out_sync_offset = 30;
|
node->dl_out_sync_offset = 30;//TODO: Values need to be changed for NR,How to set the values
|
||||||
node->dl_out_sync_period = 10;
|
node->dl_out_sync_period = 10;
|
||||||
node->dl_in_sync_offset = 30;
|
node->dl_in_sync_offset = 30;
|
||||||
node->dl_in_sync_period = 512;
|
node->dl_in_sync_period = 512;
|
||||||
node->sfn_sf = 0;
|
//node->sfn_sf = 0;
|
||||||
|
node->sfn = 0;
|
||||||
|
node->slot = 0;
|
||||||
node->min_sync_cycle_count = 8;
|
node->min_sync_cycle_count = 8;
|
||||||
|
|
||||||
// save the remote endpoint information
|
// save the remote endpoint information
|
||||||
node->remote_addr.sin_family = AF_INET;
|
node->remote_addr.sin_family = AF_INET;
|
||||||
node->remote_addr.sin_port = htons(pnf_p7_port);
|
node->remote_addr.sin_port = pnf_p7_port;//htons(pnf_p7_port);
|
||||||
node->remote_addr.sin_addr.s_addr = inet_addr(pnf_p7_addr);
|
node->remote_addr.sin_addr.s_addr = inet_addr(pnf_p7_addr);
|
||||||
|
|
||||||
vnf_p7_connection_info_list_add(vnf_p7, node);
|
vnf_p7_connection_info_list_add(vnf_p7, node);
|
||||||
@@ -490,7 +855,16 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||||
|
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req)
|
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req)
|
||||||
@@ -501,6 +875,14 @@ int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_re
|
|||||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||||
}
|
}
|
||||||
|
int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||||
|
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||||
|
}
|
||||||
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req)
|
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
@@ -509,6 +891,14 @@ int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_reques
|
|||||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||||
}
|
}
|
||||||
|
int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req)
|
||||||
|
{
|
||||||
|
if(config == 0 || req == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||||
|
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||||
|
}
|
||||||
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req)
|
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req)
|
||||||
{
|
{
|
||||||
if(config == 0 || req == 0)
|
if(config == 0 || req == 0)
|
||||||
|
|||||||
+13
-22
@@ -84,8 +84,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
|||||||
NR_gNB_COMMON *const common_vars = &gNB->common_vars;
|
NR_gNB_COMMON *const common_vars = &gNB->common_vars;
|
||||||
NR_gNB_PRACH *const prach_vars = &gNB->prach_vars;
|
NR_gNB_PRACH *const prach_vars = &gNB->prach_vars;
|
||||||
NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars;
|
NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars;
|
||||||
/*LTE_eNB_SRS *const srs_vars = gNB->srs_vars;
|
|
||||||
LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int Ptx=cfg->carrier_config.num_tx_ant.value;
|
int Ptx=cfg->carrier_config.num_tx_ant.value;
|
||||||
@@ -98,19 +96,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
|||||||
while(gNB->configured == 0) usleep(10000);
|
while(gNB->configured == 0) usleep(10000);
|
||||||
|
|
||||||
load_dftslib();
|
load_dftslib();
|
||||||
/*
|
|
||||||
LOG_I(PHY,"[gNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d nb_antennas_tx:%u nb_antennas_rx:%u PRACH[rootSequenceIndex:%u prach_Config_enabled:%u configIndex:%u highSpeed:%u zeroCorrelationZoneConfig:%u freqOffset:%u]\n",
|
|
||||||
gNB->Mod_id,
|
|
||||||
fp->N_RB_DL,fp->phich_config_common.phich_resource,
|
|
||||||
fp->phich_config_common.phich_duration,
|
|
||||||
fp->nb_antennas_tx, fp->nb_antennas_rx,
|
|
||||||
fp->prach_config_common.rootSequenceIndex,
|
|
||||||
fp->prach_config_common.prach_Config_enabled,
|
|
||||||
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
|
||||||
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
|
||||||
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
|
||||||
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset
|
|
||||||
);*/
|
|
||||||
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
|
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
|
||||||
crcTableInit();
|
crcTableInit();
|
||||||
init_scrambling_luts();
|
init_scrambling_luts();
|
||||||
@@ -264,9 +250,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
|
int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
|
||||||
|
|
||||||
printf("Before ULSCH init : %p\n",gNB->dlsch[0][0]->harq_processes[0]);
|
|
||||||
for (int ULSCH_id=0; ULSCH_id<NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) {
|
for (int ULSCH_id=0; ULSCH_id<NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) {
|
||||||
printf("ULSCH_id %d : %p\n",ULSCH_id,gNB->dlsch[0][0]->harq_processes[0]);
|
|
||||||
pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) );
|
pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) );
|
||||||
pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||||
pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||||
@@ -283,7 +267,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
|||||||
pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||||
pusch_vars[ULSCH_id]->rho = (int32_t **)malloc16_clear(Prx*sizeof(int32_t*) );
|
pusch_vars[ULSCH_id]->rho = (int32_t **)malloc16_clear(Prx*sizeof(int32_t*) );
|
||||||
|
|
||||||
printf("ULSCH_id %d (before rx antenna alloc) : %p\n",ULSCH_id,gNB->dlsch[0][0]->harq_processes[0]);
|
|
||||||
for (i=0; i<Prx; i++) {
|
for (i=0; i<Prx; i++) {
|
||||||
pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
||||||
pusch_vars[ULSCH_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
pusch_vars[ULSCH_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
||||||
@@ -300,16 +283,13 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
|||||||
pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*N_RB_UL*12 );
|
pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*N_RB_UL*12 );
|
||||||
pusch_vars[ULSCH_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_UL*12*7*2) );
|
pusch_vars[ULSCH_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_UL*12*7*2) );
|
||||||
}
|
}
|
||||||
printf("ULSCH_id %d (before llr alloc) : %p\n",ULSCH_id,gNB->dlsch[0][0]->harq_processes[0]);
|
|
||||||
pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
|
pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
|
||||||
printf("ULSCH_id %d (after llr alloc) : %p\n",ULSCH_id,gNB->dlsch[0][0]->harq_processes[0]);
|
|
||||||
pusch_vars[ULSCH_id]->ul_valid_re_per_slot = (int16_t *)malloc16_clear( sizeof(int16_t)*fp->symbols_per_slot);
|
pusch_vars[ULSCH_id]->ul_valid_re_per_slot = (int16_t *)malloc16_clear( sizeof(int16_t)*fp->symbols_per_slot);
|
||||||
} //ulsch_id
|
} //ulsch_id
|
||||||
/*
|
/*
|
||||||
for (ulsch_id=0; ulsch_id<NUMBER_OF_UE_MAX; ulsch_id++)
|
for (ulsch_id=0; ulsch_id<NUMBER_OF_UE_MAX; ulsch_id++)
|
||||||
gNB->UE_stats_ptr[ulsch_id] = &gNB->UE_stats[ulsch_id];
|
gNB->UE_stats_ptr[ulsch_id] = &gNB->UE_stats[ulsch_id];
|
||||||
*/
|
*/
|
||||||
printf("After ULSCH init : %p\n",gNB->dlsch[0][0]->harq_processes[0]);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,6 +381,13 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Adding nr_schedule_handler
|
||||||
|
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst)
|
||||||
|
{
|
||||||
|
if_inst->NR_PHY_config_req = nr_phy_config_request;
|
||||||
|
if_inst->NR_Schedule_response = nr_schedule_response;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
void install_schedule_handlers(IF_Module_t *if_inst)
|
void install_schedule_handlers(IF_Module_t *if_inst)
|
||||||
{
|
{
|
||||||
@@ -479,7 +466,10 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
|
|||||||
uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
|
uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
|
||||||
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ;
|
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ;
|
||||||
|
|
||||||
fp->nr_band = *RC.nrmac[Mod_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
//fp->nr_band = *RC.nrmac[Mod_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||||
|
lte_frame_type_t frame_type = 0; // FDD
|
||||||
|
|
||||||
|
get_band(fp->dl_CarrierFreq,&fp->nr_band,&dlul_offset,&frame_type); //RC.nrmac[Mod_id] cannot be accessed in NFAPI
|
||||||
|
|
||||||
get_delta_duplex(fp->nr_band, gNB_config->ssb_config.scs_common.value, &dlul_offset);
|
get_delta_duplex(fp->nr_band, gNB_config->ssb_config.scs_common.value, &dlul_offset);
|
||||||
dlul_offset *= 1000;
|
dlul_offset *= 1000;
|
||||||
@@ -519,6 +509,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
|
|||||||
LOG_I(PHY,"gNB %d configured\n",Mod_id);
|
LOG_I(PHY,"gNB %d configured\n",Mod_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|||||||
+78
-388
@@ -41,327 +41,17 @@
|
|||||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||||
|
|
||||||
//uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
|
|
||||||
|
|
||||||
/*void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
|
|
||||||
uint8_t eNB_id,
|
|
||||||
TDD_Config_t *tdd_Config,
|
|
||||||
uint8_t SIwindowsize,
|
|
||||||
uint16_t SIperiod)
|
|
||||||
{
|
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
|
||||||
|
|
||||||
if (tdd_Config) {
|
|
||||||
fp->tdd_config = tdd_Config->subframeAssignment;
|
|
||||||
fp->tdd_config_S = tdd_Config->specialSubframePatterns;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp->SIwindowsize = SIwindowsize;
|
|
||||||
fp->SIPeriod = SIperiod;
|
|
||||||
}
|
|
||||||
|
|
||||||
void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
|
|
||||||
uint8_t eNB_id,
|
|
||||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
|
||||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
|
||||||
long *ul_Bandwidth,
|
|
||||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
|
||||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
|
|
||||||
{
|
|
||||||
|
|
||||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
|
||||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN);
|
|
||||||
|
|
||||||
LOG_I(PHY,"[UE%d] Applying radioResourceConfigCommon from eNB%d\n",Mod_id,eNB_id);
|
|
||||||
|
|
||||||
ue->prach_vars[eNB_id]->prach_pdu.root_seq_id =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
|
|
||||||
|
|
||||||
ue->prach_vars[eNB_id]->prach_Config_enabled=1;
|
|
||||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_ConfigIndex =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
|
|
||||||
ue->prach_vars[eNB_id]->prach_pdu.restricted_set =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.highSpeedFlag;
|
|
||||||
ue->prach_vars[eNB_id]->prach_pdu.num_cs =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
|
|
||||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset;
|
|
||||||
|
|
||||||
//compute_prach_seq(fp->prach_config_common.rootSequenceIndex,
|
|
||||||
// fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
|
||||||
// fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
|
||||||
// fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
|
||||||
// fp->frame_type,ue->X_u);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
|
|
||||||
fp->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon.nRB_CQI;
|
|
||||||
fp->pucch_config_common.nCS_AN = radioResourceConfigCommon->pucch_ConfigCommon.nCS_AN;
|
|
||||||
fp->pucch_config_common.n1PUCCH_AN = radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon.referenceSignalPower;
|
|
||||||
fp->pdsch_config_common.p_b = radioResourceConfigCommon->pdsch_ConfigCommon.p_b;
|
|
||||||
|
|
||||||
|
|
||||||
fp->pusch_config_common.n_SB = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
|
|
||||||
fp->pusch_config_common.hoppingMode = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
|
|
||||||
fp->pusch_config_common.pusch_HoppingOffset = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
|
|
||||||
fp->pusch_config_common.enable64QAM = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = dmrs1_tab_ue[radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift];
|
|
||||||
|
|
||||||
|
|
||||||
init_ul_hopping(fp);
|
|
||||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
|
||||||
|
|
||||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
|
|
||||||
fp->soundingrs_ul_config_common.enabled_flag = 1;
|
|
||||||
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
|
|
||||||
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
|
|
||||||
fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
|
|
||||||
|
|
||||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
|
|
||||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 1;
|
|
||||||
else
|
|
||||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fp->ul_power_control_config_common.p0_NominalPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUSCH;
|
|
||||||
fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon.alpha;
|
|
||||||
fp->ul_power_control_config_common.p0_NominalPUCCH = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUCCH;
|
|
||||||
fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaPreambleMsg3;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1b = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2a = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2b = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b;
|
|
||||||
|
|
||||||
fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx;
|
|
||||||
|
|
||||||
// Now configure some of the Physical Channels
|
|
||||||
|
|
||||||
// PUCCH
|
|
||||||
init_ncs_cell(fp,ue->ncs_cell);
|
|
||||||
|
|
||||||
init_ul_hopping(fp);
|
|
||||||
|
|
||||||
// PCH
|
|
||||||
init_ue_paging_info(ue,radioResourceConfigCommon->pcch_Config.defaultPagingCycle,radioResourceConfigCommon->pcch_Config.nB);
|
|
||||||
|
|
||||||
// MBSFN
|
|
||||||
|
|
||||||
if (mbsfn_SubframeConfigList != NULL) {
|
|
||||||
fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
|
|
||||||
|
|
||||||
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
|
|
||||||
fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod;
|
|
||||||
fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset;
|
|
||||||
|
|
||||||
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
|
|
||||||
fp->MBSFN_config[i].fourFrames_flag = 0;
|
|
||||||
fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
|
|
||||||
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
|
|
||||||
fp->MBSFN_config[i].mbsfn_SubframeConfig);
|
|
||||||
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
|
|
||||||
fp->MBSFN_config[i].fourFrames_flag = 1;
|
|
||||||
fp->MBSFN_config[i].mbsfn_SubframeConfig =
|
|
||||||
mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]|
|
|
||||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
|
|
||||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
|
|
||||||
|
|
||||||
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
|
|
||||||
fp->MBSFN_config[i].mbsfn_SubframeConfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_OUT);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
|
|
||||||
long mbsfn_AreaId_r9)
|
|
||||||
{
|
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
|
||||||
|
|
||||||
|
|
||||||
LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %ld for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
|
|
||||||
|
|
||||||
if (mbsfn_Area_idx == 0) {
|
|
||||||
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
|
||||||
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
lte_gold_mbsfn(fp,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
|
|
||||||
*/
|
|
||||||
/*void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(mobilityControlInfo!=NULL) {
|
|
||||||
RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
|
|
||||||
LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon);
|
|
||||||
memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho,
|
|
||||||
(void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,
|
|
||||||
sizeof(NR_DL_FRAME_PARMS));
|
|
||||||
PHY_vars_UE_g[Mod_id][CC_id]->ho_triggered = 1;
|
|
||||||
//PHY_vars_UE_g[UE_id]->UE_mode[0] = PRACH;
|
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
|
||||||
// int N_ZC;
|
|
||||||
// uint8_t prach_fmt;
|
|
||||||
// int u;
|
|
||||||
|
|
||||||
LOG_I(PHY,"[UE%d] Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
|
|
||||||
Mod_id,eNB_id);
|
|
||||||
|
|
||||||
ue->prach_vars[eNB_id]->prach_pdu.root_seq_id =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
|
|
||||||
ue->prach_vars[eNB_id]->prach_Config_enabled=1;
|
|
||||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_ConfigIndex =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex;
|
|
||||||
ue->prach_vars[eNB_id]->prach_pdu.restricted_set =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->highSpeedFlag;
|
|
||||||
ue->prach_vars[eNB_id]->prach_pdu.num_cs =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->zeroCorrelationZoneConfig;
|
|
||||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_FreqOffset;
|
|
||||||
|
|
||||||
// prach_fmt = get_prach_fmt(radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex,fp->frame_type);
|
|
||||||
// N_ZC = (prach_fmt <4)?839:139;
|
|
||||||
// u = (prach_fmt < 4) ? prach_root_sequence_map0_3[fp->prach_config_common.rootSequenceIndex] :
|
|
||||||
// prach_root_sequence_map4[fp->prach_config_common.rootSequenceIndex];
|
|
||||||
|
|
||||||
//compute_prach_seq(u,N_ZC, PHY_vars_UE_g[Mod_id]->X_u);
|
|
||||||
//compute_prach_seq(PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex,
|
|
||||||
// PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
|
||||||
// PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
|
||||||
// PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
|
||||||
// fp->frame_type,
|
|
||||||
// PHY_vars_UE_g[Mod_id][CC_id]->X_u);
|
|
||||||
|
|
||||||
|
|
||||||
fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon->deltaPUCCH_Shift;
|
|
||||||
fp->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon->nRB_CQI;
|
|
||||||
fp->pucch_config_common.nCS_AN = radioResourceConfigCommon->pucch_ConfigCommon->nCS_AN;
|
|
||||||
fp->pucch_config_common.n1PUCCH_AN = radioResourceConfigCommon->pucch_ConfigCommon->n1PUCCH_AN;
|
|
||||||
fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon->referenceSignalPower;
|
|
||||||
fp->pdsch_config_common.p_b = radioResourceConfigCommon->pdsch_ConfigCommon->p_b;
|
|
||||||
|
|
||||||
|
|
||||||
fp->pusch_config_common.n_SB = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
|
|
||||||
fp->pusch_config_common.hoppingMode = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
|
|
||||||
fp->pusch_config_common.pusch_HoppingOffset = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
|
|
||||||
fp->pusch_config_common.enable64QAM = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
|
|
||||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
|
|
||||||
|
|
||||||
init_ul_hopping(fp);
|
|
||||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
|
||||||
|
|
||||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present==SoundingRS_UL_ConfigCommon_PR_setup) {
|
|
||||||
fp->soundingrs_ul_config_common.enabled_flag = 1;
|
|
||||||
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_BandwidthConfig;
|
|
||||||
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
|
|
||||||
fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.ackNackSRS_SimultaneousTransmission;
|
|
||||||
|
|
||||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_MaxUpPts)
|
|
||||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 1;
|
|
||||||
else
|
|
||||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp->ul_power_control_config_common.p0_NominalPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUSCH;
|
|
||||||
fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon->alpha;
|
|
||||||
fp->ul_power_control_config_common.p0_NominalPUCCH = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUCCH;
|
|
||||||
fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaPreambleMsg3;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1b = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1b;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2a = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2a;
|
|
||||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2b = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2b;
|
|
||||||
|
|
||||||
fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon->maxHARQ_Msg3Tx;
|
|
||||||
|
|
||||||
// Now configure some of the Physical Channels
|
|
||||||
if (radioResourceConfigCommon->antennaInfoCommon)
|
|
||||||
fp->nb_antennas_tx = (1<<radioResourceConfigCommon->antennaInfoCommon->antennaPortsCount);
|
|
||||||
else
|
|
||||||
fp->nb_antennas_tx = 1;
|
|
||||||
|
|
||||||
//PHICH
|
|
||||||
if (radioResourceConfigCommon->antennaInfoCommon) {
|
|
||||||
fp->phich_config_common.phich_resource = radioResourceConfigCommon->phich_Config->phich_Resource;
|
|
||||||
fp->phich_config_common.phich_duration = radioResourceConfigCommon->phich_Config->phich_Duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Target CellId
|
|
||||||
fp->Nid_cell = mobilityControlInfo->targetPhysCellId;
|
|
||||||
fp->nushift = fp->Nid_cell%6;
|
|
||||||
|
|
||||||
// PUCCH
|
|
||||||
init_ncs_cell(fp,PHY_vars_UE_g[Mod_id][CC_id]->ncs_cell);
|
|
||||||
|
|
||||||
init_ul_hopping(fp);
|
|
||||||
|
|
||||||
// RNTI
|
|
||||||
|
|
||||||
|
|
||||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
|
|
||||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
|
|
||||||
|
|
||||||
LOG_I(PHY,"SET C-RNTI %x %x\n",PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti,
|
|
||||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ho_failed) {
|
|
||||||
LOG_D(PHY,"[UE%d] Handover failed, triggering RACH procedure\n",Mod_id);
|
|
||||||
memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,(void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho, sizeof(NR_DL_FRAME_PARMS));
|
|
||||||
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_id] = PRACH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
|
|
||||||
{
|
|
||||||
|
|
||||||
PHY_NR_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->measurements;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
LOG_I(PHY,"Configuring inter-cell measurements for %d cells, ids: \n",n_adj_cells);
|
|
||||||
|
|
||||||
for (i=0; i<n_adj_cells; i++) {
|
|
||||||
LOG_I(PHY,"%d\n",adj_cell_id[i]);
|
|
||||||
lte_gold(&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_table[i+1],adj_cell_id[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
phy_meas->n_adj_cells = n_adj_cells;
|
|
||||||
memcpy((void*)phy_meas->adj_cell_id,(void *)adj_cell_id,n_adj_cells*sizeof(unsigned int));
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void phy_config_harq_ue(module_id_t Mod_id,
|
void phy_config_harq_ue(module_id_t Mod_id,
|
||||||
int CC_id,
|
int CC_id,
|
||||||
uint8_t eNB_id,
|
uint8_t gNB_id,
|
||||||
uint16_t max_harq_tx) {
|
uint16_t max_harq_tx) {
|
||||||
int num_of_threads,num_of_code_words;
|
int num_of_threads,num_of_code_words;
|
||||||
PHY_VARS_NR_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
|
PHY_VARS_NR_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||||
|
|
||||||
for (num_of_threads=0; num_of_threads<RX_NB_TH_MAX; num_of_threads++)
|
for (num_of_threads=0; num_of_threads<RX_NB_TH_MAX; num_of_threads++)
|
||||||
for (num_of_code_words=0; num_of_code_words<NR_MAX_NB_CODEWORDS; num_of_code_words++)
|
for (num_of_code_words=0; num_of_code_words<NR_MAX_NB_CODEWORDS; num_of_code_words++)
|
||||||
phy_vars_ue->ulsch[num_of_threads][eNB_id][num_of_code_words]->Mlimit = max_harq_tx;
|
phy_vars_ue->ulsch[num_of_threads][gNB_id][num_of_code_words]->Mlimit = max_harq_tx;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -435,7 +125,7 @@ void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||||
int nb_connected_eNB,
|
int nb_connected_gNB,
|
||||||
uint8_t abstraction_flag) {
|
uint8_t abstraction_flag) {
|
||||||
// create shortcuts
|
// create shortcuts
|
||||||
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
|
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
|
||||||
@@ -443,7 +133,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
NR_UE_PBCH **const pbch_vars = ue->pbch_vars;
|
NR_UE_PBCH **const pbch_vars = ue->pbch_vars;
|
||||||
NR_UE_PRACH **const prach_vars = ue->prach_vars;
|
NR_UE_PRACH **const prach_vars = ue->prach_vars;
|
||||||
int i,j,k,l,slot,symb,q;
|
int i,j,k,l,slot,symb,q;
|
||||||
int eNB_id;
|
int gNB_id;
|
||||||
int th_id;
|
int th_id;
|
||||||
uint32_t ****pusch_dmrs;
|
uint32_t ****pusch_dmrs;
|
||||||
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
|
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
|
||||||
@@ -457,8 +147,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
|
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
|
||||||
phy_init_nr_top(ue);
|
phy_init_nr_top(ue);
|
||||||
// many memory allocation sizes are hard coded
|
// many memory allocation sizes are hard coded
|
||||||
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
|
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
|
||||||
AssertFatal( nb_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
|
AssertFatal(nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" );
|
||||||
// init phy_vars_ue
|
// init phy_vars_ue
|
||||||
|
|
||||||
for (i=0; i<4; i++) {
|
for (i=0; i<4; i++) {
|
||||||
@@ -467,17 +157,17 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
ue->rx_gain_byp[i] = 120;
|
ue->rx_gain_byp[i] = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
ue->n_connected_eNB = nb_connected_eNB;
|
ue->n_connected_gNB = nb_connected_gNB;
|
||||||
|
|
||||||
for(eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
|
for(gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||||
ue->total_TBS[eNB_id] = 0;
|
ue->total_TBS[gNB_id] = 0;
|
||||||
ue->total_TBS_last[eNB_id] = 0;
|
ue->total_TBS_last[gNB_id] = 0;
|
||||||
ue->bitrate[eNB_id] = 0;
|
ue->bitrate[gNB_id] = 0;
|
||||||
ue->total_received_bits[eNB_id] = 0;
|
ue->total_received_bits[gNB_id] = 0;
|
||||||
|
|
||||||
ue->ul_time_alignment[eNB_id].apply_ta = 0;
|
ue->ul_time_alignment[gNB_id].apply_ta = 0;
|
||||||
ue->ul_time_alignment[eNB_id].ta_frame = -1;
|
ue->ul_time_alignment[gNB_id].ta_frame = -1;
|
||||||
ue->ul_time_alignment[eNB_id].ta_slot = -1;
|
ue->ul_time_alignment[gNB_id].ta_slot = -1;
|
||||||
}
|
}
|
||||||
// init NR modulation lookup tables
|
// init NR modulation lookup tables
|
||||||
nr_generate_modulation_table();
|
nr_generate_modulation_table();
|
||||||
@@ -485,9 +175,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
/////////////////////////PUSCH init/////////////////////////
|
/////////////////////////PUSCH init/////////////////////////
|
||||||
///////////
|
///////////
|
||||||
for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||||
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
|
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||||
ue->pusch_vars[th_id][eNB_id] = (NR_UE_PUSCH *)malloc16(sizeof(NR_UE_PUSCH));
|
ue->pusch_vars[th_id][gNB_id] = (NR_UE_PUSCH *)malloc16(sizeof(NR_UE_PUSCH));
|
||||||
phy_init_nr_ue_PUSCH( ue->pusch_vars[th_id][eNB_id], fp );
|
phy_init_nr_ue_PUSCH( ue->pusch_vars[th_id][gNB_id], fp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,40 +311,40 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DLSCH
|
// DLSCH
|
||||||
for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) {
|
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
|
ue->pdsch_vars[th_id][gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdcch_vars[th_id][eNB_id] = (NR_UE_PDCCH *)malloc16_clear(sizeof(NR_UE_PDCCH));
|
ue->pdcch_vars[th_id][gNB_id] = (NR_UE_PDCCH *)malloc16_clear(sizeof(NR_UE_PDCCH));
|
||||||
}
|
}
|
||||||
|
|
||||||
prach_vars[eNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH));
|
prach_vars[gNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH));
|
||||||
pbch_vars[eNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH));
|
pbch_vars[gNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH));
|
||||||
|
|
||||||
if (abstraction_flag == 0) {
|
if (abstraction_flag == 0) {
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
phy_init_nr_ue__PDSCH( ue->pdsch_vars[th_id][eNB_id], fp );
|
phy_init_nr_ue__PDSCH( ue->pdsch_vars[th_id][gNB_id], fp );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
|
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][eNB_id]->llr_shifts_p = ue->pdsch_vars[0][eNB_id]->llr_shifts;
|
ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
|
||||||
ue->pdsch_vars[th_id][eNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
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][eNB_id]->layer_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][eNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
|
ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear(sizeof(int16_t *));
|
||||||
ue->pdsch_vars[th_id][eNB_id]->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
|
ue->pdsch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16_clear(fp->nb_antennas_rx*sizeof(int32_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<fp->nb_antennas_rx; i++) {
|
for (int i=0; i<fp->nb_antennas_rx; i++) {
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_id]->rho[i] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
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++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_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(8*sizeof(int32_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<fp->nb_antennas_rx; i++)
|
for (i=0; i<fp->nb_antennas_rx; i++)
|
||||||
@@ -663,7 +353,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
const size_t num = 7*2*fp->N_RB_DL*12+4;
|
const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||||
|
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,10 +361,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
for (k=0; k<8; k++) { //harq_pid
|
for (k=0; k<8; k++) { //harq_pid
|
||||||
for (l=0; l<8; l++) { //round
|
for (l=0; l<8; l++) { //round
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_id]->rxdataF_comp1[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(8*sizeof(int32_t *));
|
||||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_rho_ext[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][eNB_id]->dl_ch_mag1[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][eNB_id]->dl_ch_magb1[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 *));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<fp->nb_antennas_rx; i++)
|
for (int i=0; i<fp->nb_antennas_rx; i++)
|
||||||
@@ -682,10 +372,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
const int idx = (j<<1)+i;
|
const int idx = (j<<1)+i;
|
||||||
|
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
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));
|
||||||
ue->pdsch_vars[th_id][eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -693,72 +383,72 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
|
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdcch_vars[th_id][eNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_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][eNB_id]->llr16 = (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][eNB_id]->wbar = (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][eNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
|
ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear(4*2*100*12 );
|
||||||
ue->pdcch_vars[th_id][eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_rho_ext = (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][eNB_id]->rho = (int32_t **)malloc16( 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][eNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 8*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][eNB_id]->dl_ch_estimates_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 *));
|
||||||
// Channel estimates
|
// Channel estimates
|
||||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates_time = (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 *));
|
||||||
|
|
||||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||||
ue->pdcch_vars[th_id][eNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4) );
|
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++) {
|
for (j=0; j<4; j++) {
|
||||||
int idx = (j<<1) + i;
|
int idx = (j<<1) + i;
|
||||||
ue->pdcch_vars[th_id][eNB_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[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][eNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
|
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 = 7*2*fp->N_RB_DL*12;
|
||||||
size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||||
ue->pdcch_vars[th_id][eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||||
ue->pdcch_vars[th_id][eNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PBCH
|
// PBCH
|
||||||
pbch_vars[eNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *));
|
||||||
pbch_vars[eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||||
pbch_vars[eNB_id]->dl_ch_estimates = (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[eNB_id]->dl_ch_estimates_ext = (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[eNB_id]->dl_ch_estimates_time = (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[eNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
|
pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear(1920); //
|
||||||
prach_vars[eNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)));
|
||||||
prach_vars[eNB_id]->prach = (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++) {
|
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||||
pbch_vars[eNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
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++) {
|
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
|
||||||
int idx = (j<<1)+i;
|
int idx = (j<<1)+i;
|
||||||
pbch_vars[eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
|
||||||
pbch_vars[eNB_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[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
|
||||||
pbch_vars[eNB_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_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
|
||||||
pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pbch_vars[eNB_id]->decoded_output = (uint8_t *)malloc16_clear( 64 );
|
pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialization for the last instance of pdsch_vars (used for MU-MIMO)
|
// initialization for the last instance of pdsch_vars (used for MU-MIMO)
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
ue->pdsch_vars[th_id][eNB_id] = (NR_UE_PDSCH *)malloc16_clear( sizeof(NR_UE_PDSCH) );
|
ue->pdsch_vars[th_id][gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abstraction_flag == 0) {
|
if (abstraction_flag == 0) {
|
||||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||||
//phy_init_lte_ue__PDSCH( ue->pdsch_vars[th_id][eNB_id], fp );
|
//phy_init_lte_ue__PDSCH( ue->pdsch_vars[th_id][gNB_id], fp );
|
||||||
ue->pdsch_vars[th_id][eNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
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][eNB_id]->layer_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));
|
||||||
}
|
}
|
||||||
} else { //abstraction == 1
|
} else { //abstraction == 1
|
||||||
ue->sinr_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
|
ue->sinr_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
|
||||||
@@ -787,7 +477,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,
|
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,
|
||||||
int abstraction_flag) {
|
int abstraction_flag) {
|
||||||
for (int i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
|
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
||||||
for (int j=0; j<2; j++) {
|
for (int j=0; j<2; j++) {
|
||||||
for (int k=0; k<RX_NB_TH_MAX; k++) {
|
for (int k=0; k<RX_NB_TH_MAX; k++) {
|
||||||
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
|
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
|
||||||
|
|||||||
@@ -325,10 +325,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
|
|||||||
|
|
||||||
void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
||||||
{
|
{
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || +defined(__i386__)
|
||||||
__m128i dft_in128[1][1200], dft_out128[1][1200];
|
__m128i dft_in128[1][3240], dft_out128[1][3240];
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
int16x8_t dft_in128[1][1200], dft_out128[1][1200];
|
int16x8_t dft_in128[1][3240], dft_out128[1][3240];
|
||||||
#endif
|
#endif
|
||||||
uint32_t *dft_in0 = (uint32_t*)dft_in128[0], *dft_out0 = (uint32_t*)dft_out128[0];
|
uint32_t *dft_in0 = (uint32_t*)dft_in128[0], *dft_out0 = (uint32_t*)dft_out128[0];
|
||||||
|
|
||||||
@@ -340,8 +340,10 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
|||||||
int16x8_t norm128;
|
int16x8_t norm128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
if ((Msc_PUSCH % 1536) > 0) {
|
||||||
dft_in0[ip] = d[i];
|
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
||||||
|
dft_in0[ip] = d[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Msc_PUSCH) {
|
switch (Msc_PUSCH) {
|
||||||
@@ -480,7 +482,7 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 972:
|
case 972:
|
||||||
dft(DFT_960,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
dft(DFT_972,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1080:
|
case 1080:
|
||||||
@@ -494,11 +496,98 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
|||||||
case 1200:
|
case 1200:
|
||||||
dft(DFT_1200,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
dft(DFT_1200,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1296:
|
||||||
|
dft(DFT_1296,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1440:
|
||||||
|
dft(DFT_1440,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1500:
|
||||||
|
dft(DFT_1500,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1536:
|
||||||
|
//dft(DFT_1536,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
dft(DFT_1536,(int16_t*)d, (int16_t*)z, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1620:
|
||||||
|
dft(DFT_1620,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1728:
|
||||||
|
dft(DFT_1728,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1800:
|
||||||
|
dft(DFT_1800,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1920:
|
||||||
|
dft(DFT_1920,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1944:
|
||||||
|
dft(DFT_1944,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2160:
|
||||||
|
dft(DFT_2160,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2304:
|
||||||
|
dft(DFT_2304,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2400:
|
||||||
|
dft(DFT_2400,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2592:
|
||||||
|
dft(DFT_2592,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2700:
|
||||||
|
dft(DFT_2700,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2880:
|
||||||
|
dft(DFT_2880,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2916:
|
||||||
|
dft(DFT_2916,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3000:
|
||||||
|
dft(DFT_3000,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3072:
|
||||||
|
//dft(DFT_3072,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
dft(DFT_3072,(int16_t*)d, (int16_t*)z, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3240:
|
||||||
|
dft(DFT_3240,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// should not be reached
|
||||||
|
LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH );
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
|
||||||
z[i] = dft_out0[ip];
|
if ((Msc_PUSCH % 1536) > 0) {
|
||||||
|
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4)
|
||||||
|
z[i] = dft_out0[ip];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void init_byte2m64(void) {
|
|||||||
((int16_t*)&byte2m64_re[s])[0],((int16_t*)&byte2m64_im[s])[0],
|
((int16_t*)&byte2m64_re[s])[0],((int16_t*)&byte2m64_im[s])[0],
|
||||||
((int16_t*)&byte2m64_re[s])[1],((int16_t*)&byte2m64_im[s])[1],
|
((int16_t*)&byte2m64_re[s])[1],((int16_t*)&byte2m64_im[s])[1],
|
||||||
((int16_t*)&byte2m64_re[s])[2],((int16_t*)&byte2m64_im[s])[2],
|
((int16_t*)&byte2m64_re[s])[2],((int16_t*)&byte2m64_im[s])[2],
|
||||||
((int16_t*)&byte2m64_re[s])[3],((int16_t*)&byte2m64_im[s])[3]);
|
((int16_t*)&byte2m64_re[s])[3],((int16_t*)&byte2m64_im[s])[3]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
* in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset for coreset 0
|
* in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset for coreset 0
|
||||||
* or the rb_offset for other coresets
|
* or the rb_offset for other coresets
|
||||||
* in time: by its first slot and its first symbol*/
|
* 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];
|
||||||
|
|
||||||
cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
|
cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
|
||||||
cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
|
cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
|
||||||
@@ -102,9 +103,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb);
|
LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb);
|
||||||
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
|
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
|
||||||
// DMRS length is per OFDM symbol
|
// DMRS length is per OFDM symbol
|
||||||
uint32_t dmrs_length = (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED)?
|
uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE)
|
||||||
(n_rb*6) : (pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE)
|
uint32_t encoded_length = dci_pdu->AggregationLevel*108; //2(QPSK)*9(per RB)*6(REG per CCE)
|
||||||
uint32_t encoded_length = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*108; //2(QPSK)*9(per RB)*6(REG per CCE)
|
|
||||||
LOG_D(PHY, "DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d,reg_mapping %d)\n", dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType);
|
LOG_D(PHY, "DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d,reg_mapping %d)\n", dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType);
|
||||||
dmrs_length += rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
|
dmrs_length += rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
|
||||||
|
|
||||||
@@ -126,19 +126,19 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
// CRC attachment + Scrambling + Channel coding + Rate matching
|
// CRC attachment + Scrambling + Channel coding + Rate matching
|
||||||
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
|
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
|
||||||
|
|
||||||
uint16_t n_RNTI = pdcch_pdu_rel15->dci_pdu.RNTI[d];
|
uint16_t n_RNTI = dci_pdu->RNTI;
|
||||||
uint16_t Nid = pdcch_pdu_rel15->dci_pdu.ScramblingId[d];
|
uint16_t Nid = dci_pdu->ScramblingId;
|
||||||
uint16_t scrambling_RNTI = pdcch_pdu_rel15->dci_pdu.ScramblingRNTI[d];
|
uint16_t scrambling_RNTI = dci_pdu->ScramblingRNTI;
|
||||||
|
|
||||||
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE,
|
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE,
|
||||||
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d],
|
dci_pdu->PayloadSizeBits,
|
||||||
pdcch_pdu_rel15->dci_pdu.AggregationLevel[d],
|
dci_pdu->AggregationLevel,
|
||||||
0,NULL);
|
0,NULL);
|
||||||
polar_encoder_fast((uint64_t*)pdcch_pdu_rel15->dci_pdu.Payload[d], (void*)encoder_output, n_RNTI,1,currentPtr);
|
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI,1,currentPtr);
|
||||||
#ifdef DEBUG_CHANNEL_CODING
|
#ifdef DEBUG_CHANNEL_CODING
|
||||||
printf("polar rnti %x,length %d, L %d\n",n_RNTI, pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d],pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]);
|
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]);
|
||||||
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
|
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
|
||||||
((uint64_t*)pdcch_pdu_rel15->dci_pdu.Payload[d])[0], ((uint64_t*)pdcch_pdu_rel15->dci_pdu.Payload[d])[1]);
|
((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]);
|
||||||
printf("Encoded Payload (length:%d dwords):\n", encoded_length>>5);
|
printf("Encoded Payload (length:%d dwords):\n", encoded_length>>5);
|
||||||
|
|
||||||
for (int i=0; i<encoded_length>>5; i++)
|
for (int i=0; i<encoded_length>>5; i++)
|
||||||
@@ -164,66 +164,86 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
printf("i %d mod_dci %d %d\n", i, mod_dci[i<<1], mod_dci[(i<<1)+1] );
|
printf("i %d mod_dci %d %d\n", i, mod_dci[i<<1], mod_dci[(i<<1)+1] );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Resource mapping
|
/// Resource mapping
|
||||||
|
|
||||||
if (cset_start_sc >= frame_parms.ofdm_symbol_size)
|
if (cset_start_sc >= frame_parms.ofdm_symbol_size)
|
||||||
cset_start_sc -= frame_parms.ofdm_symbol_size;
|
cset_start_sc -= frame_parms.ofdm_symbol_size;
|
||||||
|
|
||||||
/*Reorder REG list for a freq first mapping*/
|
// Get cce_list indices by reg_idx in ascending order
|
||||||
uint8_t reg_idx0 = pdcch_pdu_rel15->dci_pdu.CceIndex[d]*NR_NB_REG_PER_CCE;
|
int reg_list_index = 0;
|
||||||
uint8_t nb_regs = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*NR_NB_REG_PER_CCE;
|
int reg_list_order[NR_MAX_PDCCH_AGG_LEVEL] = {};
|
||||||
|
for (int p = 0; p < NR_MAX_PDCCH_AGG_LEVEL; p++) {
|
||||||
|
for(int p2 = 0; p2 < dci_pdu->AggregationLevel; p2++) {
|
||||||
|
if(gNB->cce_list[d][p2].reg_list[0].reg_idx == p * NR_NB_REG_PER_CCE) {
|
||||||
|
reg_list_order[reg_list_index] = p2;
|
||||||
|
reg_list_index++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*Mapping the encoded DCI along with the DMRS */
|
/*Mapping the encoded DCI along with the DMRS */
|
||||||
for (int reg_idx=reg_idx0; reg_idx<(nb_regs+reg_idx0); reg_idx++) {
|
for (int cce_count = 0; cce_count < dci_pdu->AggregationLevel; cce_count ++) {
|
||||||
k = cset_start_sc + (12*reg_idx/cset_nsymb);
|
|
||||||
|
int8_t cce_idx = reg_list_order[cce_count];
|
||||||
if (k >= frame_parms.ofdm_symbol_size)
|
|
||||||
k -= frame_parms.ofdm_symbol_size;
|
for (int reg_in_cce_idx = 0; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx++) {
|
||||||
|
|
||||||
l = cset_start_symb + ((reg_idx/cset_nsymb)%cset_nsymb);
|
k = cset_start_sc + gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].start_sc_idx;
|
||||||
|
|
||||||
// dmrs index depends on reference point for k according to 38.211 7.4.1.3.2
|
if (k >= frame_parms.ofdm_symbol_size)
|
||||||
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG)
|
k -= frame_parms.ofdm_symbol_size;
|
||||||
dmrs_idx = (reg_idx/cset_nsymb)*3;
|
|
||||||
else
|
l = cset_start_symb + gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].symb_idx;
|
||||||
dmrs_idx = ((reg_idx/cset_nsymb)+rb_offset)*3;
|
|
||||||
|
// dmrs index depends on reference point for k according to 38.211 7.4.1.3.2
|
||||||
k_prime = 0;
|
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG)
|
||||||
|
dmrs_idx =gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx * 3;
|
||||||
for (int m=0; m<NR_NB_SC_PER_RB; m++) {
|
else
|
||||||
if ( m == (k_prime<<2)+1) { // DMRS if not already mapped
|
dmrs_idx = (gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx + rb_offset) * 3;
|
||||||
//if (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED) {
|
|
||||||
((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[l][dmrs_idx<<1]) >> 15;
|
k_prime = 0;
|
||||||
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
|
|
||||||
|
for (int m = 0; m < NR_NB_SC_PER_RB; m++) {
|
||||||
|
if (m == (k_prime << 2) + 1) { // DMRS if not already mapped
|
||||||
|
((int16_t *) txdataF)[(l * frame_parms.ofdm_symbol_size + k) << 1] =
|
||||||
|
(amp * mod_dmrs[l][dmrs_idx << 1]) >> 15;
|
||||||
|
((int16_t *) txdataF)[((l * frame_parms.ofdm_symbol_size + k) << 1) + 1] =
|
||||||
|
(amp * mod_dmrs[l][(dmrs_idx << 1) + 1]) >> 15;
|
||||||
|
|
||||||
#ifdef DEBUG_PDCCH_DMRS
|
#ifdef DEBUG_PDCCH_DMRS
|
||||||
printf("PDCCH DMRS: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1],
|
printf("PDCCH DMRS: 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]);
|
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
|
||||||
#endif
|
#endif
|
||||||
dmrs_idx++;
|
|
||||||
//}
|
dmrs_idx++;
|
||||||
|
k_prime++;
|
||||||
k_prime++;
|
|
||||||
} else { // DCI payload
|
} else { // DCI payload
|
||||||
((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dci[dci_idx<<1]) >> 15;
|
((int16_t *) txdataF)[(l * frame_parms.ofdm_symbol_size + k) << 1] = (amp * mod_dci[dci_idx << 1]) >> 15;
|
||||||
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dci[(dci_idx<<1) + 1]) >> 15;
|
((int16_t *) txdataF)[((l * frame_parms.ofdm_symbol_size + k) << 1) + 1] =
|
||||||
|
(amp * mod_dci[(dci_idx << 1) + 1]) >> 15;
|
||||||
#ifdef DEBUG_DCI
|
#ifdef DEBUG_DCI
|
||||||
printf("PDCCH: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1],
|
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]);
|
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
|
||||||
#endif
|
#endif
|
||||||
dci_idx++;
|
dci_idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
k++;
|
|
||||||
|
|
||||||
if (k >= frame_parms.ofdm_symbol_size)
|
|
||||||
k -= frame_parms.ofdm_symbol_size;
|
|
||||||
} // m
|
|
||||||
} // reg_idx
|
|
||||||
|
|
||||||
LOG_I(PHY, "DCI: payloadSize = %d | payload = %llx\n",
|
k++;
|
||||||
*pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload);
|
|
||||||
|
|
||||||
|
if (k >= frame_parms.ofdm_symbol_size)
|
||||||
|
k -= frame_parms.ofdm_symbol_size;
|
||||||
|
|
||||||
|
} // m
|
||||||
|
} // reg_in_cce_idx
|
||||||
|
} // cce_count
|
||||||
|
|
||||||
|
LOG_D(PHY,
|
||||||
|
"DCI: payloadSize = %d | payload = %llx\n",
|
||||||
|
dci_pdu->PayloadSizeBits,
|
||||||
|
*(unsigned long long *)dci_pdu->Payload);
|
||||||
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
|
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r
|
|||||||
AssertFatal(N_reg > 0,"N_reg cannot be 0\n");
|
AssertFatal(N_reg > 0,"N_reg cannot be 0\n");
|
||||||
|
|
||||||
for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) {
|
for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) {
|
||||||
int L = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d];
|
int L = pdcch_pdu_rel15->dci_pdu[d].AggregationLevel;
|
||||||
|
|
||||||
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1)
|
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1)
|
||||||
AssertFatal(L>=4, "Invalid aggregation level for SIB1 configured PDCCH %d\n", L);
|
AssertFatal(L>=4, "Invalid aggregation level for SIB1 configured PDCCH %d\n", L);
|
||||||
@@ -153,10 +153,10 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r
|
|||||||
C = N_reg/(bsize*R);
|
C = N_reg/(bsize*R);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_D(PHY, "CCE list generation for candidate %d: bundle size %d ilv size %d CceIndex %d\n", m, bsize, R, pdcch_pdu_rel15->dci_pdu.CceIndex[d]);
|
LOG_D(PHY, "CCE list generation for candidate %d: bundle size %d ilv size %d CceIndex %d\n", m, bsize, R, pdcch_pdu_rel15->dci_pdu[d].CceIndex);
|
||||||
for (uint8_t cce_idx=0; cce_idx<L; cce_idx++) {
|
for (uint8_t cce_idx=0; cce_idx<L; cce_idx++) {
|
||||||
cce = &gNB->cce_list[d][cce_idx];
|
cce = &gNB->cce_list[d][cce_idx];
|
||||||
cce->cce_idx = pdcch_pdu_rel15->dci_pdu.CceIndex[d] + cce_idx;
|
cce->cce_idx = pdcch_pdu_rel15->dci_pdu[d].CceIndex + cce_idx;
|
||||||
LOG_D(PHY, "cce_idx %d\n", cce->cce_idx);
|
LOG_D(PHY, "cce_idx %d\n", cce->cce_idx);
|
||||||
|
|
||||||
if (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) {
|
if (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) {
|
||||||
@@ -236,25 +236,24 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
||||||
|
|
||||||
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu.Payload[i];
|
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload;
|
||||||
|
|
||||||
int dlsch_id = find_nr_dlsch(pdcch_pdu_rel15->dci_pdu.RNTI[i],gNB,SEARCH_EXIST_OR_FREE);
|
int dlsch_id = find_nr_dlsch(pdcch_pdu_rel15->dci_pdu[i].RNTI,gNB,SEARCH_EXIST_OR_FREE);
|
||||||
if( (dlsch_id<0) || (dlsch_id>=NUMBER_OF_NR_DLSCH_MAX) ){
|
if( (dlsch_id<0) || (dlsch_id>=NUMBER_OF_NR_DLSCH_MAX) ){
|
||||||
LOG_E(PHY,"illegal dlsch_id found!!! rnti %04x dlsch_id %d\n",(unsigned int)pdcch_pdu_rel15->dci_pdu.RNTI[i],dlsch_id);
|
LOG_E(PHY,"illegal dlsch_id found!!! rnti %04x dlsch_id %d\n",(unsigned int)pdcch_pdu_rel15->dci_pdu[i].RNTI,dlsch_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlsch = gNB->dlsch[dlsch_id][0];
|
dlsch = gNB->dlsch[dlsch_id][0];
|
||||||
int num_slots_tdd = (gNB->frame_parms.slots_per_frame)>>(7-gNB->gNB_config.tdd_table.tdd_period.value);
|
int harq_pid = 0;
|
||||||
int harq_pid = slot % num_slots_tdd;
|
|
||||||
|
|
||||||
dlsch->slot_tx[slot] = 1;
|
dlsch->slot_tx[slot] = 1;
|
||||||
dlsch->harq_ids[frame%2][slot] = harq_pid;
|
dlsch->harq_ids[frame % 2][slot] = 0;
|
||||||
AssertFatal(harq_pid < 8 && harq_pid >= 0,
|
AssertFatal(harq_pid < 8 && harq_pid >= 0,
|
||||||
"illegal harq_pid %d\n",harq_pid);
|
"illegal harq_pid %d\n",harq_pid);
|
||||||
|
|
||||||
dlsch->harq_mask |= (1<<harq_pid);
|
dlsch->harq_mask |= (1<<harq_pid);
|
||||||
dlsch->rnti = pdcch_pdu_rel15->dci_pdu.RNTI[i];
|
dlsch->rnti = pdcch_pdu_rel15->dci_pdu[i].RNTI;
|
||||||
|
|
||||||
// nr_fill_cce_list(gNB,0);
|
// nr_fill_cce_list(gNB,0);
|
||||||
/*
|
/*
|
||||||
@@ -300,7 +299,7 @@ void nr_fill_ul_dci(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
||||||
|
|
||||||
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu.Payload[i];
|
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload;
|
||||||
|
|
||||||
// if there's no DL DCI then generate CCE list
|
// if there's no DL DCI then generate CCE list
|
||||||
// nr_fill_cce_list(gNB,0);
|
// nr_fill_cce_list(gNB,0);
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
|||||||
dlsch = gNB->dlsch[dlsch_id][0];
|
dlsch = gNB->dlsch[dlsch_id][0];
|
||||||
if (dlsch->slot_tx[slot] == 0) continue;
|
if (dlsch->slot_tx[slot] == 0) continue;
|
||||||
|
|
||||||
int harq_pid = dlsch->harq_ids[frame%2][slot];
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
NR_DL_gNB_HARQ_t *harq = dlsch->harq_processes[harq_pid];
|
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
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 **mod_symbs = (int16_t**)dlsch->mod_symbs;
|
||||||
@@ -421,15 +420,8 @@ void dump_pdsch_stats(PHY_VARS_gNB *gNB) {
|
|||||||
|
|
||||||
for (int i=0;i<NUMBER_OF_NR_SCH_STATS_MAX;i++)
|
for (int i=0;i<NUMBER_OF_NR_SCH_STATS_MAX;i++)
|
||||||
if (gNB->dlsch_stats[i].rnti > 0)
|
if (gNB->dlsch_stats[i].rnti > 0)
|
||||||
LOG_I(PHY,"DLSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, current_Qm %d, current_RI %d, total_bytes TX %d\n",
|
LOG_D(PHY,"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d\n",
|
||||||
gNB->dlsch_stats[i].rnti,
|
gNB->dlsch_stats[i].rnti,
|
||||||
gNB->dlsch_stats[i].round_trials[0],
|
|
||||||
(double)gNB->dlsch_stats[i].round_trials[1]/gNB->dlsch_stats[i].round_trials[0],
|
|
||||||
gNB->dlsch_stats[i].round_trials[1],
|
|
||||||
(double)gNB->dlsch_stats[i].round_trials[2]/gNB->dlsch_stats[i].round_trials[0],
|
|
||||||
gNB->dlsch_stats[i].round_trials[2],
|
|
||||||
(double)gNB->dlsch_stats[i].round_trials[3]/gNB->dlsch_stats[i].round_trials[0],
|
|
||||||
gNB->dlsch_stats[i].round_trials[3],
|
|
||||||
gNB->dlsch_stats[i].current_Qm,
|
gNB->dlsch_stats[i].current_Qm,
|
||||||
gNB->dlsch_stats[i].current_RI,
|
gNB->dlsch_stats[i].current_RI,
|
||||||
gNB->dlsch_stats[i].total_bytes_tx);
|
gNB->dlsch_stats[i].total_bytes_tx);
|
||||||
|
|||||||
@@ -51,7 +51,6 @@
|
|||||||
|
|
||||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB)
|
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
NR_gNB_DLSCH_t *dlsch = *dlschptr;
|
NR_gNB_DLSCH_t *dlsch = *dlschptr;
|
||||||
@@ -63,76 +62,61 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB)
|
|||||||
a_segments = a_segments*N_RB;
|
a_segments = a_segments*N_RB;
|
||||||
a_segments = a_segments/273 +1;
|
a_segments = a_segments/273 +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
LOG_D(PHY,"Freeing dlsch %p\n",dlsch);
|
LOG_D(PHY,"Freeing dlsch %p\n",dlsch);
|
||||||
#endif
|
#endif
|
||||||
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
for (i=0; i<dlsch->Mdlharq; i++) {
|
if (harq->b) {
|
||||||
|
free16(harq->b, a_segments * 1056);
|
||||||
|
harq->b = NULL;
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
LOG_D(PHY,"Freeing dlsch process %d\n",i);
|
LOG_D(PHY, "Freeing harq->b (%p)\n", harq->b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]) {
|
if (harq->e) {
|
||||||
|
free16(harq->e, 14 * N_RB * 12 * 8);
|
||||||
|
harq->e = NULL;
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
LOG_D(PHY,"Freeing dlsch process %d (%p)\n",i,dlsch->harq_processes[i]);
|
printf("Freeing dlsch process %d e (%p)\n", i, harq->e);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->b) {
|
|
||||||
free16(dlsch->harq_processes[i]->b,a_segments*1056);
|
|
||||||
dlsch->harq_processes[i]->b = NULL;
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
|
||||||
LOG_D(PHY,"Freeing dlsch process %d b (%p)\n",i,dlsch->harq_processes[i]->b);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->e) {
|
|
||||||
free16(dlsch->harq_processes[i]->e,14*N_RB*12*8);
|
|
||||||
dlsch->harq_processes[i]->e = NULL;
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
|
||||||
printf("Freeing dlsch process %d e (%p)\n",i,dlsch->harq_processes[i]->e);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->f) {
|
|
||||||
free16(dlsch->harq_processes[i]->f,14*N_RB*12*8);
|
|
||||||
dlsch->harq_processes[i]->f = NULL;
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
|
||||||
printf("Freeing dlsch process %d f (%p)\n",i,dlsch->harq_processes[i]->f);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
|
||||||
LOG_D(PHY,"Freeing dlsch process %d c (%p)\n",i,dlsch->harq_processes[i]->c);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (r=0; r<a_segments; r++) {
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
|
||||||
LOG_D(PHY,"Freeing dlsch process %d c[%d] (%p)\n",i,r,dlsch->harq_processes[i]->c[r]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->c[r]) {
|
|
||||||
free16(dlsch->harq_processes[i]->c[r],1056);
|
|
||||||
dlsch->harq_processes[i]->c[r] = NULL;
|
|
||||||
}
|
|
||||||
if (dlsch->harq_processes[i]->d[r]) {
|
|
||||||
free16(dlsch->harq_processes[i]->d[r],3*8448);
|
|
||||||
dlsch->harq_processes[i]->d[r] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
free16(dlsch->harq_processes[i],sizeof(NR_DL_gNB_HARQ_t));
|
|
||||||
dlsch->harq_processes[i] = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free16(dlsch,sizeof(NR_gNB_DLSCH_t));
|
if (harq->f) {
|
||||||
*dlschptr = NULL;
|
free16(harq->f, 14 * N_RB * 12 * 8);
|
||||||
|
harq->f = NULL;
|
||||||
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
|
printf("Freeing dlsch process %d f (%p)\n", i, harq->f);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
|
LOG_D(PHY, "Freeing dlsch process %d c (%p)\n", i, harq->c);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (r = 0; r < a_segments; r++) {
|
||||||
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
|
LOG_D(PHY, "Freeing dlsch process %d c[%d] (%p)\n", i, r, harq->c[r]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (harq->c[r]) {
|
||||||
|
free16(harq->c[r], 1056);
|
||||||
|
harq->c[r] = NULL;
|
||||||
|
}
|
||||||
|
if (harq->d[r]) {
|
||||||
|
free16(harq->d[r], 3 * 8448);
|
||||||
|
harq->d[r] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free16(harq, sizeof(NR_DL_gNB_HARQ_t));
|
||||||
|
harq = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free16(dlsch, sizeof(NR_gNB_DLSCH_t));
|
||||||
|
*dlschptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||||
@@ -142,9 +126,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
uint8_t abstraction_flag,
|
uint8_t abstraction_flag,
|
||||||
uint16_t N_RB)
|
uint16_t N_RB)
|
||||||
{
|
{
|
||||||
|
unsigned char i,r,aa,layer;
|
||||||
NR_gNB_DLSCH_t *dlsch;
|
|
||||||
unsigned char exit_flag = 0,i,r,aa,layer;
|
|
||||||
int re;
|
int re;
|
||||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||||
|
|
||||||
@@ -155,127 +137,74 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
|
|
||||||
uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
|
uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
|
||||||
|
|
||||||
|
NR_gNB_DLSCH_t *dlsch = malloc16(sizeof(NR_gNB_DLSCH_t));
|
||||||
|
AssertFatal(dlsch, "cannot allocate dlsch\n");
|
||||||
|
|
||||||
|
bzero(dlsch,sizeof(NR_gNB_DLSCH_t));
|
||||||
|
dlsch->Kmimo = Kmimo;
|
||||||
|
dlsch->Mdlharq = Mdlharq;
|
||||||
|
dlsch->Mlimit = 4;
|
||||||
|
dlsch->Nsoft = Nsoft;
|
||||||
|
|
||||||
dlsch = (NR_gNB_DLSCH_t *)malloc16(sizeof(NR_gNB_DLSCH_t));
|
for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) {
|
||||||
|
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64 * sizeof(int32_t *));
|
||||||
|
|
||||||
if (dlsch) {
|
for (aa = 0; aa < 64; aa++) {
|
||||||
bzero(dlsch,sizeof(NR_gNB_DLSCH_t));
|
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t));
|
||||||
dlsch->Kmimo = Kmimo;
|
for (re = 0; re < OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||||
dlsch->Mdlharq = Mdlharq;
|
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||||
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*));
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<20; i++) {
|
|
||||||
dlsch->harq_ids[0][i] = 0;
|
|
||||||
dlsch->harq_ids[1][i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<Mdlharq; i++) {
|
|
||||||
dlsch->harq_processes[i] = (NR_DL_gNB_HARQ_t *)malloc16(sizeof(NR_DL_gNB_HARQ_t));
|
|
||||||
LOG_T(PHY, "Required mem size %d dlsch->harq_processes[%d] %p\n",
|
|
||||||
dlsch_bytes, i,dlsch->harq_processes[i]);
|
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]) {
|
|
||||||
bzero(dlsch->harq_processes[i],sizeof(NR_DL_gNB_HARQ_t));
|
|
||||||
// dlsch->harq_processes[i]->first_tx=1;
|
|
||||||
dlsch->harq_processes[i]->b = (unsigned char*)malloc16(dlsch_bytes);
|
|
||||||
dlsch->harq_processes[i]->pdu = (uint8_t*)malloc16(dlsch_bytes);
|
|
||||||
if (dlsch->harq_processes[i]->pdu) {
|
|
||||||
bzero(dlsch->harq_processes[i]->pdu,dlsch_bytes);
|
|
||||||
nr_emulate_dlsch_payload(dlsch->harq_processes[i]->pdu, (dlsch_bytes)>>3);
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"Can't allocate PDU\n");
|
|
||||||
exit_flag=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->b) {
|
|
||||||
bzero(dlsch->harq_processes[i]->b,dlsch_bytes);
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"Can't get b\n");
|
|
||||||
exit_flag=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abstraction_flag==0) {
|
|
||||||
for (r=0; r<a_segments; r++) {
|
|
||||||
// account for filler in first segment and CRCs for multiple segment case
|
|
||||||
// [hna] 8448 is the maximum CB size in NR
|
|
||||||
// 68*348 = 68*(maximum size of Zc)
|
|
||||||
// In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc)
|
|
||||||
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
|
|
||||||
dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
|
|
||||||
if (dlsch->harq_processes[i]->c[r]) {
|
|
||||||
bzero(dlsch->harq_processes[i]->c[r],8448);
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"Can't get c\n");
|
|
||||||
exit_flag=2;
|
|
||||||
}
|
|
||||||
if (dlsch->harq_processes[i]->d[r]) {
|
|
||||||
bzero(dlsch->harq_processes[i]->d[r],(3*8448));
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"Can't get d\n");
|
|
||||||
exit_flag=2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dlsch->harq_processes[i]->e = (uint8_t*)malloc16(14*N_RB*12*8);
|
|
||||||
if (dlsch->harq_processes[i]->e) {
|
|
||||||
bzero(dlsch->harq_processes[i]->e,14*N_RB*12*8);
|
|
||||||
} else {
|
|
||||||
printf("Can't get e\n");
|
|
||||||
exit_flag=1;
|
|
||||||
}
|
|
||||||
dlsch->harq_processes[i]->f = (uint8_t*)malloc16(14*N_RB*12*8);
|
|
||||||
if (dlsch->harq_processes[i]->f) {
|
|
||||||
bzero(dlsch->harq_processes[i]->f,14*N_RB*12*8);
|
|
||||||
} else {
|
|
||||||
printf("Can't get f\n");
|
|
||||||
exit_flag=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"Can't get harq_p %d\n",i);
|
|
||||||
exit_flag=3;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exit_flag==0) {
|
dlsch->txdataF[layer] =
|
||||||
for (i=0; i<Mdlharq; i++) {
|
(int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH / NR_MAX_NB_LAYERS)
|
||||||
dlsch->harq_processes[i]->round=0;
|
* sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH
|
||||||
}
|
|
||||||
|
|
||||||
return(dlsch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_D(PHY,"new_gNB_dlsch exit flag %d, size of %ld\n",
|
for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++)
|
||||||
exit_flag, sizeof(NR_gNB_DLSCH_t));
|
dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH * sizeof(int32_t));
|
||||||
|
|
||||||
free_gNB_dlsch(&dlsch,N_RB);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
return(NULL);
|
for (i = 0; i < 20; i++) {
|
||||||
|
dlsch->harq_ids[0][i] = 0;
|
||||||
|
dlsch->harq_ids[1][i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
|
bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
|
||||||
|
|
||||||
|
harq->b = malloc16(dlsch_bytes);
|
||||||
|
AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
|
||||||
|
harq->pdu = malloc16(dlsch_bytes);
|
||||||
|
AssertFatal(harq->pdu, "cannot allocate memory for harq->pdu\n");
|
||||||
|
bzero(harq->pdu, dlsch_bytes);
|
||||||
|
nr_emulate_dlsch_payload(harq->pdu, (dlsch_bytes) >> 3);
|
||||||
|
bzero(harq->b, dlsch_bytes);
|
||||||
|
|
||||||
|
for (r = 0; r < a_segments; r++) {
|
||||||
|
// account for filler in first segment and CRCs for multiple segment case
|
||||||
|
// [hna] 8448 is the maximum CB size in NR
|
||||||
|
// 68*348 = 68*(maximum size of Zc)
|
||||||
|
// In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc)
|
||||||
|
harq->c[r] = malloc16(8448);
|
||||||
|
AssertFatal(harq->c[r], "cannot allocate harq->c[%d]\n", r);
|
||||||
|
harq->d[r] = malloc16(68 * 384);
|
||||||
|
AssertFatal(harq->d[r], "cannot allocate harq->d[%d]\n", r); // max size for coded output
|
||||||
|
bzero(harq->c[r], 8448);
|
||||||
|
bzero(harq->d[r], (3 * 8448));
|
||||||
|
harq->e = malloc16(14 * N_RB * 12 * 8);
|
||||||
|
AssertFatal(harq->e, "cannot allocate harq->e\n");
|
||||||
|
bzero(harq->e, 14 * N_RB * 12 * 8);
|
||||||
|
harq->f = malloc16(14 * N_RB * 12 * 8);
|
||||||
|
AssertFatal(harq->f, "cannot allocate harq->f\n");
|
||||||
|
bzero(harq->f, 14 * N_RB * 12 * 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(dlsch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
|
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
|
||||||
@@ -284,28 +213,21 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
|
|||||||
unsigned char Mdlharq;
|
unsigned char Mdlharq;
|
||||||
unsigned char i,j,r;
|
unsigned char i,j,r;
|
||||||
|
|
||||||
if (dlsch) {
|
AssertFatal(dlsch!=NULL,"dlsch is null\n");
|
||||||
Mdlharq = dlsch->Mdlharq;
|
Mdlharq = dlsch->Mdlharq;
|
||||||
dlsch->rnti = 0;
|
dlsch->rnti = 0;
|
||||||
dlsch->active = 0;
|
dlsch->active = 0;
|
||||||
|
NR_DL_gNB_HARQ_t *harq=&dlsch->harq_process;
|
||||||
|
|
||||||
for (i=0; i<10; i++) {
|
for (i=0; i<10; i++) {
|
||||||
dlsch->harq_ids[0][i] = Mdlharq;
|
dlsch->harq_ids[0][i] = Mdlharq;
|
||||||
dlsch->harq_ids[1][i] = Mdlharq;
|
dlsch->harq_ids[1][i] = Mdlharq;
|
||||||
}
|
}
|
||||||
for (i=0; i<Mdlharq; i++) {
|
for (i=0; i<Mdlharq; i++) {
|
||||||
if (dlsch->harq_processes[i]) {
|
for (j=0; j<96; j++)
|
||||||
// dlsch->harq_processes[i]->Ndi = 0;
|
for (r=0; r<MAX_NUM_NR_DLSCH_SEGMENTS; r++)
|
||||||
//dlsch->harq_processes[i]->status = 0;
|
if (harq->d[r])
|
||||||
dlsch->harq_processes[i]->round = 0;
|
harq->d[r][j] = NR_NULL;
|
||||||
|
|
||||||
for (j=0; j<96; j++)
|
|
||||||
for (r=0; r<MAX_NUM_NR_DLSCH_SEGMENTS; r++)
|
|
||||||
if (dlsch->harq_processes[i]->d[r])
|
|
||||||
dlsch->harq_processes[i]->d[r][j] = NR_NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,13 +244,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
unsigned int G;
|
unsigned int G;
|
||||||
unsigned int crc=1;
|
unsigned int crc=1;
|
||||||
uint8_t harq_pid = dlsch->harq_ids[frame%2][slot];
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
AssertFatal(harq_pid<8 && harq_pid>=0,"illegal harq_pid %d\b",harq_pid);
|
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_processes[harq_pid]->pdsch_pdu.pdsch_pdu_rel15;
|
|
||||||
uint16_t nb_rb = rel15->rbSize;
|
uint16_t nb_rb = rel15->rbSize;
|
||||||
uint8_t nb_symb_sch = rel15->NrOfSymbols;
|
uint8_t nb_symb_sch = rel15->NrOfSymbols;
|
||||||
uint32_t A, Kb, F=0;
|
uint32_t A, Kb, F=0;
|
||||||
uint32_t *Zc = &dlsch->harq_processes[harq_pid]->Z;
|
uint32_t *Zc = &dlsch->harq_process.Z;
|
||||||
uint8_t mod_order = rel15->qamModOrder[0];
|
uint8_t mod_order = rel15->qamModOrder[0];
|
||||||
uint16_t Kr=0,r;
|
uint16_t Kr=0,r;
|
||||||
uint32_t r_offset=0;
|
uint32_t r_offset=0;
|
||||||
@@ -347,8 +268,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
float Coderate = 0.0;
|
float Coderate = 0.0;
|
||||||
uint8_t Nl = 4;
|
uint8_t Nl = 4;
|
||||||
|
|
||||||
dlsch->harq_processes[harq_pid]->round = nr_rv_round_map[rel15->rvIndex[0]];
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
A = rel15->TBSize[0]<<3;
|
A = rel15->TBSize[0]<<3;
|
||||||
@@ -367,175 +287,157 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stats) {
|
if (stats) {
|
||||||
stats->round_trials[dlsch->harq_processes[harq_pid]->round]++;
|
|
||||||
stats->rnti = dlsch->rnti;
|
stats->rnti = dlsch->rnti;
|
||||||
if (dlsch->harq_processes[harq_pid]->round == 0){
|
stats->total_bytes_tx += rel15->TBSize[0];
|
||||||
stats->total_bytes_tx += rel15->TBSize[0];
|
stats->current_RI = rel15->nrOfLayers;
|
||||||
stats->current_RI = rel15->nrOfLayers;
|
stats->current_Qm = rel15->qamModOrder[0];
|
||||||
stats->current_Qm = rel15->qamModOrder[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers);
|
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 mod_order %d\n", A,G, mod_order);
|
||||||
|
|
||||||
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
|
if (A > 3824) {
|
||||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
// Add 24-bit crc (polynomial A) to payload
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
crc = crc24a(a,A)>>8;
|
||||||
LOG_D(PHY,"encoding thinks this is a new packet \n");
|
a[A>>3] = ((uint8_t*)&crc)[2];
|
||||||
#endif
|
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
||||||
/*
|
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
||||||
int i;
|
//printf("CRC %x (A %d)\n",crc,A);
|
||||||
LOG_D(PHY,"dlsch (tx): \n");
|
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
|
||||||
for (i=0;i<(A>>3);i++)
|
|
||||||
LOG_D(PHY,"%02x\n",a[i]);
|
harq->B = A+24;
|
||||||
LOG_D(PHY,"\n");
|
// harq->b = a;
|
||||||
*/
|
|
||||||
log_dump(PHY, a, 16, LOG_DUMP_CHAR,"gNB pdsch tx frame %d %d: ", frame, slot);
|
|
||||||
|
|
||||||
if (A > 3824) {
|
AssertFatal((A / 8) + 4 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||||
// Add 24-bit crc (polynomial A) to payload
|
"A %d is too big (A/8+4 = %d > %d)\n",
|
||||||
crc = crc24a(a,A)>>8;
|
A,
|
||||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
(A / 8) + 4,
|
||||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||||
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)]);
|
|
||||||
|
|
||||||
dlsch->harq_processes[harq_pid]->B = A+24;
|
|
||||||
// dlsch->harq_processes[harq_pid]->b = a;
|
|
||||||
|
|
||||||
AssertFatal((A/8)+4 <= MAX_NR_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+4 = %d > %d)\n",A,(A/8)+4,MAX_NR_DLSCH_PAYLOAD_BYTES);
|
|
||||||
|
|
||||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); // why is this +4 if the CRC is only 3 bytes?
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Add 16-bit crc (polynomial A) to payload
|
|
||||||
crc = crc16(a,A)>>16;
|
|
||||||
a[A>>3] = ((uint8_t*)&crc)[1];
|
|
||||||
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)]);
|
|
||||||
|
|
||||||
dlsch->harq_processes[harq_pid]->B = A+16;
|
|
||||||
// dlsch->harq_processes[harq_pid]->b = a;
|
|
||||||
|
|
||||||
AssertFatal((A/8)+3 <= MAX_NR_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+3 = %d > %d)\n",A,(A/8)+3,MAX_NR_DLSCH_PAYLOAD_BYTES);
|
|
||||||
|
|
||||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+3); // using 3 bytes to mimic the case of 24 bit crc
|
|
||||||
}
|
|
||||||
if (R<1000)
|
|
||||||
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)
|
|
||||||
dlsch->harq_processes[harq_pid]->BG = 2;
|
|
||||||
else
|
|
||||||
dlsch->harq_processes[harq_pid]->BG = 1;
|
|
||||||
|
|
||||||
start_meas(dlsch_segmentation_stats);
|
|
||||||
Kb = nr_segmentation(dlsch->harq_processes[harq_pid]->b,
|
|
||||||
dlsch->harq_processes[harq_pid]->c,
|
|
||||||
dlsch->harq_processes[harq_pid]->B,
|
|
||||||
&dlsch->harq_processes[harq_pid]->C,
|
|
||||||
&dlsch->harq_processes[harq_pid]->K,
|
|
||||||
Zc,
|
|
||||||
&dlsch->harq_processes[harq_pid]->F,
|
|
||||||
dlsch->harq_processes[harq_pid]->BG);
|
|
||||||
stop_meas(dlsch_segmentation_stats);
|
|
||||||
F = dlsch->harq_processes[harq_pid]->F;
|
|
||||||
|
|
||||||
Kr = dlsch->harq_processes[harq_pid]->K;
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
|
||||||
uint16_t Kr_bytes;
|
|
||||||
Kr_bytes = Kr>>3;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,dlsch->harq_processes[harq_pid]->K,Kr,BG,dlsch->harq_processes[harq_pid]->C);
|
|
||||||
|
|
||||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
|
||||||
//d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
|
|
||||||
//channel_input[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
|
||||||
LOG_D(PHY,"Encoder: B %d F %d \n",dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->F);
|
|
||||||
LOG_D(PHY,"start ldpc encoder segment %d/%d\n",r,dlsch->harq_processes[harq_pid]->C);
|
|
||||||
LOG_D(PHY,"input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]);
|
|
||||||
for (int cnt =0 ; cnt < 22*(*Zc)/8; cnt ++){
|
|
||||||
LOG_D(PHY,"%d ", dlsch->harq_processes[harq_pid]->c[r][cnt]);
|
|
||||||
}
|
|
||||||
LOG_D(PHY,"\n");
|
|
||||||
|
|
||||||
#endif
|
|
||||||
//ldpc_encoder_orig((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],dlsch->harq_processes[harq_pid]->d[r],*Zc,Kb,Kr,BG,0);
|
|
||||||
//ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL);
|
|
||||||
}
|
|
||||||
encoder_implemparams_t impp;
|
|
||||||
impp.n_segments=dlsch->harq_processes[harq_pid]->C;
|
|
||||||
impp.tprep = tprep;
|
|
||||||
impp.tinput = tinput;
|
|
||||||
impp.tparity = tparity;
|
|
||||||
impp.toutput = toutput;
|
|
||||||
|
|
||||||
for(int j=0;j<(dlsch->harq_processes[harq_pid]->C/8+1);j++) {
|
|
||||||
impp.macro_num=j;
|
|
||||||
nrLDPC_encoder(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,*Zc,Kb,Kr,dlsch->harq_processes[harq_pid]->BG,&impp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
|
||||||
write_output("enc_input0.m","enc_in0",&dlsch->harq_processes[harq_pid]->c[0][0],Kr_bytes,1,4);
|
|
||||||
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[0][0],(3*8*Kr_bytes)+12,1,4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Add 16-bit crc (polynomial A) to payload
|
||||||
|
crc = crc16(a,A)>>16;
|
||||||
|
a[A>>3] = ((uint8_t*)&crc)[1];
|
||||||
|
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;
|
||||||
|
|
||||||
F = dlsch->harq_processes[harq_pid]->F;
|
AssertFatal((A / 8) + 3 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||||
|
"A %d is too big (A/8+3 = %d > %d)\n",
|
||||||
|
A,
|
||||||
|
(A / 8) + 3,
|
||||||
|
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||||
|
|
||||||
Kr = dlsch->harq_processes[harq_pid]->K;
|
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
|
||||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
}
|
||||||
|
if (R<1000)
|
||||||
|
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;
|
||||||
|
Kr_bytes = Kr>>3;
|
||||||
|
#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];
|
||||||
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
|
LOG_D(PHY,"Encoder: B %d F %d \n",harq->B, harq->F);
|
||||||
|
LOG_D(PHY,"start ldpc encoder segment %d/%d\n",r,harq->C);
|
||||||
|
LOG_D(PHY,"input %d %d %d %d %d \n", harq->c[r][0], harq->c[r][1], harq->c[r][2],harq->c[r][3], harq->c[r][4]);
|
||||||
|
for (int cnt =0 ; cnt < 22*(*Zc)/8; cnt ++){
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
encoder_implemparams_t impp;
|
||||||
|
impp.n_segments=harq->C;
|
||||||
|
impp.tprep = tprep;
|
||||||
|
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) {
|
if (F>0) {
|
||||||
for (int k=(Kr-F-2*(*Zc)); k<Kr-2*(*Zc); k++) {
|
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
|
// writing into positions d[r][k-2Zc] as in clause 5.3.2 step 2) in 38.212
|
||||||
dlsch->harq_processes[harq_pid]->d[r][k] = NR_NULL;
|
harq->d[r][k] = NR_NULL;
|
||||||
//if (k<(Kr-F+8))
|
//if (k<(Kr-F+8))
|
||||||
//printf("r %d filler bits [%d] = %d \n", r,k, dlsch->harq_processes[harq_pid]->d[r][k]);
|
//printf("r %d filler bits [%d] = %d \n", r,k, harq->d[r][k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
LOG_D(PHY,"rvidx in encoding = %d\n", rel15->rvIndex[0]);
|
LOG_D(PHY,"rvidx in encoding = %d\n", rel15->rvIndex[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
E = nr_get_E(G, dlsch->harq_processes[harq_pid]->C, mod_order, rel15->nrOfLayers, r);
|
E = nr_get_E(G, harq->C, mod_order, rel15->nrOfLayers, r);
|
||||||
|
|
||||||
//#ifdef DEBUG_DLSCH_CODING
|
//#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",
|
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,
|
r,
|
||||||
dlsch->harq_processes[harq_pid]->C,
|
harq->C,
|
||||||
G,
|
G,
|
||||||
E,
|
E,
|
||||||
F,
|
F,
|
||||||
Kr-F-2*(*Zc),
|
Kr-F-2*(*Zc),
|
||||||
mod_order,nb_rb);
|
mod_order,nb_rb);
|
||||||
|
|
||||||
// for tbslbrm calculation according to 5.4.2.1 of 38.212
|
// for tbslbrm calculation according to 5.4.2.1 of 38.212
|
||||||
if (rel15->nrOfLayers < Nl)
|
if (rel15->nrOfLayers < Nl)
|
||||||
Nl = rel15->nrOfLayers;
|
Nl = rel15->nrOfLayers;
|
||||||
|
|
||||||
Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl);
|
Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl);
|
||||||
|
|
||||||
start_meas(dlsch_rate_matching_stats);
|
start_meas(dlsch_rate_matching_stats);
|
||||||
nr_rate_matching_ldpc(Ilbrm,
|
nr_rate_matching_ldpc(Ilbrm,
|
||||||
Tbslbrm,
|
Tbslbrm,
|
||||||
dlsch->harq_processes[harq_pid]->BG,
|
harq->BG,
|
||||||
*Zc,
|
*Zc,
|
||||||
dlsch->harq_processes[harq_pid]->d[r],
|
harq->d[r],
|
||||||
dlsch->harq_processes[harq_pid]->e+r_offset,
|
harq->e+r_offset,
|
||||||
dlsch->harq_processes[harq_pid]->C,
|
harq->C,
|
||||||
F,
|
F,
|
||||||
Kr-F-2*(*Zc),
|
Kr-F-2*(*Zc),
|
||||||
rel15->rvIndex[0],
|
rel15->rvIndex[0],
|
||||||
@@ -543,22 +445,22 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
stop_meas(dlsch_rate_matching_stats);
|
stop_meas(dlsch_rate_matching_stats);
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
for (int i =0; i<16; i++)
|
for (int i =0; i<16; i++)
|
||||||
printf("output ratematching e[%d]= %d r_offset %u\n", i,dlsch->harq_processes[harq_pid]->e[i+r_offset], r_offset);
|
printf("output ratematching e[%d]= %d r_offset %u\n", i,harq->e[i+r_offset], r_offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
start_meas(dlsch_interleaving_stats);
|
start_meas(dlsch_interleaving_stats);
|
||||||
nr_interleaving_ldpc(E,
|
nr_interleaving_ldpc(E,
|
||||||
mod_order,
|
mod_order,
|
||||||
dlsch->harq_processes[harq_pid]->e+r_offset,
|
harq->e+r_offset,
|
||||||
dlsch->harq_processes[harq_pid]->f+r_offset);
|
harq->f+r_offset);
|
||||||
stop_meas(dlsch_interleaving_stats);
|
stop_meas(dlsch_interleaving_stats);
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
for (int i =0; i<16; i++)
|
for (int i =0; i<16; i++)
|
||||||
printf("output interleaving f[%d]= %d r_offset %u\n", i,dlsch->harq_processes[harq_pid]->f[i+r_offset], r_offset);
|
printf("output interleaving f[%d]= %d r_offset %u\n", i,harq->f[i+r_offset], r_offset);
|
||||||
|
|
||||||
if (r==dlsch->harq_processes[harq_pid]->C-1)
|
if (r==harq->C-1)
|
||||||
write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->f,G,1,4);
|
write_output("enc_output.m","enc",harq->f,G,1,4);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
r_offset += E;
|
r_offset += E;
|
||||||
|
|||||||
@@ -289,12 +289,12 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
|
|||||||
AssertFatal( (dlsch_id>=0) && (dlsch_id<NUMBER_OF_NR_DLSCH_MAX),
|
AssertFatal( (dlsch_id>=0) && (dlsch_id<NUMBER_OF_NR_DLSCH_MAX),
|
||||||
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id);
|
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id);
|
||||||
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0];
|
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0];
|
||||||
NR_DL_gNB_HARQ_t **harq = dlsch->harq_processes;
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
/// DLSCH struct
|
/// DLSCH struct
|
||||||
memcpy((void*)&harq[dlsch->harq_ids[frame%2][slot]]->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu));
|
memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu));
|
||||||
gNB->num_pdsch_rnti[slot]++;
|
gNB->num_pdsch_rnti[slot]++;
|
||||||
AssertFatal(sdu!=NULL,"sdu is null\n");
|
AssertFatal(sdu!=NULL,"sdu is null\n");
|
||||||
harq[dlsch->harq_ids[frame%2][slot]]->pdu = sdu;
|
harq->pdu = sdu;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
|||||||
{
|
{
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
__m128i idft_in128[1][1200], idft_out128[1][1200];
|
__m128i idft_in128[1][3240], idft_out128[1][3240];
|
||||||
__m128i norm128;
|
__m128i norm128;
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
int16x8_t idft_in128[1][1200], idft_out128[1][1200];
|
int16x8_t idft_in128[1][3240], idft_out128[1][3240];
|
||||||
int16x8_t norm128;
|
int16x8_t norm128;
|
||||||
#endif
|
#endif
|
||||||
int16_t *idft_in0 = (int16_t*)idft_in128[0], *idft_out0 = (int16_t*)idft_out128[0];
|
int16_t *idft_in0 = (int16_t*)idft_in128[0], *idft_out0 = (int16_t*)idft_out128[0];
|
||||||
@@ -28,20 +28,19 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
|||||||
|
|
||||||
LOG_T(PHY,"Doing lte_idft for Msc_PUSCH %d\n",Msc_PUSCH);
|
LOG_T(PHY,"Doing lte_idft for Msc_PUSCH %d\n",Msc_PUSCH);
|
||||||
|
|
||||||
// conjugate input
|
if ((Msc_PUSCH % 1536) > 0) {
|
||||||
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
// conjugate input
|
||||||
|
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
||||||
#if defined(__x86_64__)||defined(__i386__)
|
#if defined(__x86_64__)||defined(__i386__)
|
||||||
*&(((__m128i*)z)[i]) = _mm_sign_epi16(*&(((__m128i*)z)[i]), *(__m128i*)&conjugate2[0]);
|
*&(((__m128i*)z)[i]) = _mm_sign_epi16(*&(((__m128i*)z)[i]), *(__m128i*)&conjugate2[0]);
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4)
|
||||||
|
((uint32_t*)idft_in0)[ip+0] = z[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0,ip=0; i<Msc_PUSCH; i++, ip+=4) {
|
|
||||||
((int32_t*)idft_in0)[ip+0] = z[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch (Msc_PUSCH) {
|
switch (Msc_PUSCH) {
|
||||||
case 12:
|
case 12:
|
||||||
dft(DFT_12,(int16_t *)idft_in0, (int16_t *)idft_out0,0);
|
dft(DFT_12,(int16_t *)idft_in0, (int16_t *)idft_out0,0);
|
||||||
@@ -194,25 +193,102 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
|||||||
dft(DFT_1200,idft_in0, idft_out0, 1);
|
dft(DFT_1200,idft_in0, idft_out0, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1296:
|
||||||
|
dft(DFT_1296,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1440:
|
||||||
|
dft(DFT_1440,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1500:
|
||||||
|
dft(DFT_1500,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1536:
|
||||||
|
//dft(DFT_1536,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
idft(IDFT_1536,(int16_t*)z, (int16_t*)z, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1620:
|
||||||
|
dft(DFT_1620,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1728:
|
||||||
|
dft(DFT_1728,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1800:
|
||||||
|
dft(DFT_1800,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1920:
|
||||||
|
dft(DFT_1920,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1944:
|
||||||
|
dft(DFT_1944,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2160:
|
||||||
|
dft(DFT_2160,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2304:
|
||||||
|
dft(DFT_2304,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2400:
|
||||||
|
dft(DFT_2400,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2592:
|
||||||
|
dft(DFT_2592,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2700:
|
||||||
|
dft(DFT_2700,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2880:
|
||||||
|
dft(DFT_2880,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2916:
|
||||||
|
dft(DFT_2916,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3000:
|
||||||
|
dft(DFT_3000,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3072:
|
||||||
|
//dft(DFT_3072,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
idft(IDFT_3072,(int16_t*)z, (int16_t*)z, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3240:
|
||||||
|
dft(DFT_3240,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// should not be reached
|
// should not be reached
|
||||||
LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH );
|
LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((Msc_PUSCH % 1536) > 0) {
|
||||||
|
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4)
|
||||||
|
z[i] = ((uint32_t*)idft_out0)[ip];
|
||||||
|
|
||||||
|
// conjugate output
|
||||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
||||||
z[i] = ((int32_t*)idft_out0)[ip];
|
|
||||||
}
|
|
||||||
|
|
||||||
// conjugate output
|
|
||||||
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
((__m128i*)z)[i] = _mm_sign_epi16(((__m128i*)z)[i], *(__m128i*)&conjugate2[0]);
|
((__m128i*)z)[i] = _mm_sign_epi16(((__m128i*)z)[i], *(__m128i*)&conjugate2[0]);
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
@@ -222,6 +298,7 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||||
NR_gNB_PUSCH *pusch_vars,
|
NR_gNB_PUSCH *pusch_vars,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
|
|||||||
@@ -393,6 +393,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
// first bit of bitmap for sr presence and second bit for acknack presence
|
// first bit of bitmap for sr presence and second bit for acknack presence
|
||||||
uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1);
|
uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1);
|
||||||
uci_pdu->pucch_format = 0; // format 0
|
uci_pdu->pucch_format = 0; // format 0
|
||||||
|
uci_pdu->rnti = pucch_pdu->rnti;
|
||||||
uci_pdu->ul_cqi = cqi;
|
uci_pdu->ul_cqi = cqi;
|
||||||
uci_pdu->timing_advance = 0xffff; // currently not valid
|
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],12)));
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||||
#include "PHY/impl_defs_top.h"
|
#include "PHY/impl_defs_top.h"
|
||||||
|
|
||||||
|
#include "executables/softmodem-common.h"
|
||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
#define DEBUG_PHY
|
#define DEBUG_PHY
|
||||||
@@ -104,15 +105,14 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
{
|
{
|
||||||
first_time = 0;
|
first_time = 0;
|
||||||
ue->time_sync_cell = 1;
|
ue->time_sync_cell = 1;
|
||||||
if (ue->mac_enabled==1) {
|
if (get_softmodem_params()->do_ra) {
|
||||||
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
|
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
|
||||||
//mac_resynch();
|
//mac_resynch();
|
||||||
//dl_phy_sync_success(ue->Mod_id,frame,0,1);//ue->common_vars.eNb_id);
|
//dl_phy_sync_success(ue->Mod_id,frame,0,1);//ue->common_vars.eNb_id);
|
||||||
ue->UE_mode[0] = PRACH;
|
ue->UE_mode[0] = PRACH;
|
||||||
ue->prach_resources[gNB_id]->sync_frame = frame;
|
ue->prach_resources[gNB_id]->sync_frame = frame;
|
||||||
ue->prach_resources[gNB_id]->init_msg1 = 0;
|
ue->prach_resources[gNB_id]->init_msg1 = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ue->UE_mode[0] = PUSCH;
|
ue->UE_mode[0] = PUSCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
uint8_t slot);
|
uint8_t slot);
|
||||||
|
|
||||||
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||||
|
uint8_t gNB_index,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t slot,
|
uint8_t slot,
|
||||||
uint8_t abstraction_flag);
|
uint8_t abstraction_flag);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nr-softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
#include "PHY/defs_nr_UE.h"
|
#include "PHY/defs_nr_UE.h"
|
||||||
#include "PHY/phy_extern_nr_ue.h"
|
#include "PHY/phy_extern_nr_ue.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
@@ -45,25 +45,41 @@
|
|||||||
//#define DEBUG_MEAS_UE
|
//#define DEBUG_MEAS_UE
|
||||||
//#define DEBUG_RANK_EST
|
//#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
|
||||||
|
// 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
|
||||||
|
// Measurement units:
|
||||||
|
// - referenceSignalPower: dBm/RE (average EPRE of the resources elements that carry secondary synchronization signals in dBm)
|
||||||
int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
|
int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
|
||||||
|
|
||||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||||
|
int16_t pathloss;
|
||||||
|
|
||||||
/*
|
if (get_softmodem_params()->do_ra){
|
||||||
if (ue->frame_parms.mode1_flag == 1)
|
|
||||||
RSoffset = 6;
|
|
||||||
else
|
|
||||||
RSoffset = 3;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* LOG_D(PHY,"get_nr_PL : rsrp %f dBm/RE (%f), eNB power %d dBm/RE\n",
|
long referenceSignalPower = ue->nrUE_config.ssb_config.ss_pbch_power;
|
||||||
(1.0*dB_fixed_times10(ue->measurements.rsrp[eNB_index])-(10.0*ue->rx_total_gain_dB))/10.0,
|
double rsrp_dBm = 10*log10(ue->measurements.rsrp[gNB_index]) + 30 - ue->rx_total_gain_dB;
|
||||||
10*log10((double)ue->measurements.rsrp[eNB_index]),
|
|
||||||
ue->frame_parms.pdsch_config_common.referenceSignalPower);*/
|
pathloss = (int16_t)(10*log10(pow(10, (double)(referenceSignalPower)/10) - pow(10, (double)(rsrp_dBm)/10)));
|
||||||
|
|
||||||
|
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",
|
||||||
|
__FUNCTION__,
|
||||||
|
pathloss,
|
||||||
|
ue->rx_total_gain_dB,
|
||||||
|
referenceSignalPower,
|
||||||
|
pow(10, referenceSignalPower/10),
|
||||||
|
rsrp_dBm,
|
||||||
|
pow(10, rsrp_dBm/10));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
pathloss = ((int16_t)(((10*ue->rx_total_gain_dB) - dB_fixed_times10(ue->measurements.rsrp[gNB_index]))/10));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return pathloss;
|
||||||
|
|
||||||
return((int16_t)(((10*ue->rx_total_gain_dB) - dB_fixed_times10(ue->measurements.rsrp[gNB_index]))/10));
|
|
||||||
// dB_fixed_times10(RSoffset*12*ue_g[Mod_id][CC_id]->frame_parms.N_RB_DL) +
|
|
||||||
//(ue->frame_parms.pdsch_config_common.referenceSignalPower*10))/10));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_nr_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
uint32_t get_nr_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
||||||
@@ -108,7 +124,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
|
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
|
||||||
|
|
||||||
// signal measurements
|
// signal measurements
|
||||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++){
|
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++){
|
||||||
|
|
||||||
ue->measurements.rx_power_tot[gNB_id] = 0;
|
ue->measurements.rx_power_tot[gNB_id] = 0;
|
||||||
|
|
||||||
@@ -140,7 +156,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
// filter to remove jitter
|
// filter to remove jitter
|
||||||
if (ue->init_averaging == 0) {
|
if (ue->init_averaging == 0) {
|
||||||
|
|
||||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++)
|
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++)
|
||||||
ue->measurements.rx_power_avg[gNB_id] = (int)(((k1*((long long int)(ue->measurements.rx_power_avg[gNB_id]))) + (k2*((long long int)(ue->measurements.rx_power_tot[gNB_id])))) >> 10);
|
ue->measurements.rx_power_avg[gNB_id] = (int)(((k1*((long long int)(ue->measurements.rx_power_avg[gNB_id]))) + (k2*((long long int)(ue->measurements.rx_power_tot[gNB_id])))) >> 10);
|
||||||
|
|
||||||
ue->measurements.n0_power_avg = (int)(((k1*((long long int) (ue->measurements.n0_power_avg))) + (k2*((long long int) (ue->measurements.n0_power_tot))))>>10);
|
ue->measurements.n0_power_avg = (int)(((k1*((long long int) (ue->measurements.n0_power_avg))) + (k2*((long long int) (ue->measurements.n0_power_tot))))>>10);
|
||||||
@@ -149,7 +165,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++)
|
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++)
|
||||||
ue->measurements.rx_power_avg[gNB_id] = ue->measurements.rx_power_tot[gNB_id];
|
ue->measurements.rx_power_avg[gNB_id] = ue->measurements.rx_power_tot[gNB_id];
|
||||||
|
|
||||||
ue->measurements.n0_power_avg = ue->measurements.n0_power_tot;
|
ue->measurements.n0_power_avg = ue->measurements.n0_power_tot;
|
||||||
@@ -157,7 +173,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++) {
|
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||||
|
|
||||||
ue->measurements.rx_power_avg_dB[gNB_id] = dB_fixed( ue->measurements.rx_power_avg[gNB_id]);
|
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_tot[gNB_id] = dB_fixed2(ue->measurements.rx_power_tot[gNB_id], ue->measurements.n0_power_tot);
|
||||||
@@ -180,74 +196,74 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function implements:
|
||||||
|
// - SS reference signal received power (SS-RSRP) as per clause 5.1.1 of 3GPP TS 38.215 version 16.3.0 Release 16
|
||||||
|
// - no Layer 3 filtering implemented (no filterCoefficient provided from RRC)
|
||||||
|
// Todo:
|
||||||
|
// - Layer 3 filtering according to clause 5.5.3.2 of 3GPP TS 38.331 version 16.2.0 Release 16
|
||||||
|
// Measurement units:
|
||||||
|
// - RSRP: W (dBW)
|
||||||
|
// - RX Gain dB
|
||||||
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
uint8_t gNB_id,
|
||||||
uint8_t slot,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t abstraction_flag)
|
uint8_t slot,
|
||||||
|
uint8_t abstraction_flag)
|
||||||
{
|
{
|
||||||
int aarx,rb, symbol_offset;
|
int aarx;
|
||||||
int16_t *rxF;
|
int nb_re;
|
||||||
|
int k_start = 55;
|
||||||
|
int k_end = 183;
|
||||||
|
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
||||||
|
uint8_t l_sss = ue->symbol_offset + 2;
|
||||||
|
|
||||||
uint16_t Nid_cell = ue->frame_parms.Nid_cell;
|
if (ssb_offset>= ue->frame_parms.ofdm_symbol_size){
|
||||||
uint8_t eNB_offset=0,l,nushift;
|
|
||||||
uint16_t off,nb_rb;
|
|
||||||
// NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
|
||||||
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
|
|
||||||
|
|
||||||
nushift = ue->frame_parms.Nid_cell%4;
|
ssb_offset -= ue->frame_parms.ofdm_symbol_size;
|
||||||
ue->frame_parms.nushift = nushift;
|
|
||||||
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
|
||||||
if (ssb_offset>= ue->frame_parms.ofdm_symbol_size) ssb_offset-=ue->frame_parms.ofdm_symbol_size;
|
|
||||||
|
|
||||||
symbol_offset = ue->frame_parms.ofdm_symbol_size*((ue->symbol_offset+1)%(ue->frame_parms.symbols_per_slot));
|
|
||||||
|
|
||||||
ue->measurements.rsrp[eNB_offset] = 0;
|
}
|
||||||
|
|
||||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
ue->measurements.rsrp[gNB_id] = 0;
|
||||||
nb_rb = 20;
|
|
||||||
//} else{
|
|
||||||
// LOG_E(PHY,"report quantity not supported \n");
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (abstraction_flag == 0) {
|
if (abstraction_flag == 0) {
|
||||||
|
|
||||||
for (l=0; l<1; l++) {
|
LOG_D(PHY, "In %s: [UE %d] slot %d l_sss %d ssb_offset %d\n", __FUNCTION__, ue->Mod_id, slot, l_sss, ssb_offset);
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d] slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, l %d)\n",ue->Mod_id,slot,Nid_cell,nushift,
|
nb_re = 0;
|
||||||
eNB_offset,l);
|
|
||||||
|
|
||||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
for (aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+ssb_offset+nushift)];
|
|
||||||
off = 0;
|
|
||||||
|
|
||||||
if (l==0) {
|
int16_t *rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aarx][(l_sss*ue->frame_parms.ofdm_symbol_size) + ssb_offset];
|
||||||
for (rb=0; rb<nb_rb; rb++) {
|
|
||||||
|
|
||||||
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));
|
for(int k = k_start; k < k_end; k++){
|
||||||
//printf("rb %d, off %d : %d\n",rb,off,((((int32_t)rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1])));
|
|
||||||
|
#ifdef DEBUG_MEAS_UE
|
||||||
|
LOG_I(PHY, "In %s rxF_sss %d %d\n", __FUNCTION__, rxF_sss[k*2], rxF_sss[k*2 + 1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ue->measurements.rsrp[gNB_id] += (((int32_t)rxF_sss[k*2]*rxF_sss[k*2]) + ((int32_t)rxF_sss[k*2 + 1]*rxF_sss[k*2 + 1]));
|
||||||
|
|
||||||
|
nb_re++;
|
||||||
|
|
||||||
off = (off+4) % ue->frame_parms.ofdm_symbol_size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ue->measurements.rsrp[eNB_offset]/=nb_rb;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
ue->measurements.rsrp[eNB_offset] = -93 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ue->measurements.rsrp[gNB_id] /= nb_re;
|
||||||
|
|
||||||
if (eNB_offset == 0)
|
} else {
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d] slot %d RSRP Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d)\n",
|
ue->measurements.rsrp[gNB_id] = -93;
|
||||||
ue->Mod_id,
|
|
||||||
slot,eNB_offset,
|
}
|
||||||
(eNB_offset>0) ? ue->measurements.adj_cell_id[eNB_offset-1] : ue->frame_parms.Nid_cell,
|
|
||||||
10*log10(ue->measurements.rsrp[eNB_offset])-ue->rx_total_gain_dB,
|
ue->measurements.rsrp_filtered[gNB_id] = ue->measurements.rsrp[gNB_id];
|
||||||
ue->measurements.rsrp[eNB_offset]);
|
|
||||||
|
LOG_D(PHY, "In %s: [UE %d] slot %d SS-RSRP: %3.1f dBm/RE (%d W)\n",
|
||||||
|
__FUNCTION__,
|
||||||
|
ue->Mod_id,
|
||||||
|
slot,
|
||||||
|
10*log10(ue->measurements.rsrp[gNB_id]) + 30 - ue->rx_total_gain_dB,
|
||||||
|
ue->measurements.rsrp[gNB_id]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,12 +81,14 @@
|
|||||||
|
|
||||||
void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
|
void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
|
||||||
uint32_t *z,
|
uint32_t *z,
|
||||||
NR_DL_FRAME_PARMS *frame_parms,
|
|
||||||
uint8_t coreset_time_dur,
|
uint8_t coreset_time_dur,
|
||||||
uint32_t coreset_nbr_rb,
|
uint32_t coreset_nbr_rb,
|
||||||
uint8_t reg_bundle_size_L,
|
uint8_t reg_bundle_size_L,
|
||||||
uint8_t coreset_interleaver_size_R,
|
uint8_t coreset_interleaver_size_R,
|
||||||
uint8_t n_shift) {
|
uint8_t n_shift,
|
||||||
|
uint8_t number_of_candidates,
|
||||||
|
uint16_t *CCE,
|
||||||
|
uint8_t *L) {
|
||||||
/*
|
/*
|
||||||
* This function will do demapping and deinterleaving from llr containing demodulated symbols
|
* This function will do demapping and deinterleaving from llr containing demodulated symbols
|
||||||
* Demapping will regroup in REG and bundles
|
* Demapping will regroup in REG and bundles
|
||||||
@@ -122,35 +124,61 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
|
|||||||
| REG 0 (bundle 0) bundle 0 bundle 0
|
| REG 0 (bundle 0) bundle 0 bundle 0
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int c=0,r=0;
|
int c = 0, r = 0;
|
||||||
uint16_t bundle_j=0, f_bundle_j=0,f_reg=0;
|
uint16_t bundle_j = 0, f_bundle_j = 0, f_reg = 0;
|
||||||
uint32_t coreset_C=0;
|
uint32_t coreset_C = 0;
|
||||||
uint16_t index_z, index_llr;
|
uint16_t index_z, index_llr;
|
||||||
int coreset_interleaved = 0;
|
int coreset_interleaved = 0;
|
||||||
|
|
||||||
if (reg_bundle_size_L!=0) { // interleaving will be done only if reg_bundle_size_L != 0
|
if (reg_bundle_size_L != 0) { // interleaving will be done only if reg_bundle_size_L != 0
|
||||||
coreset_interleaved=1;
|
coreset_interleaved = 1;
|
||||||
coreset_C = (uint32_t)((coreset_nbr_rb * coreset_time_dur)/ (coreset_interleaver_size_R*reg_bundle_size_L));
|
coreset_C = (uint32_t) ((coreset_nbr_rb * coreset_time_dur) / (coreset_interleaver_size_R * reg_bundle_size_L));
|
||||||
} else {
|
} else {
|
||||||
reg_bundle_size_L=6;
|
reg_bundle_size_L = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int reg=0; reg<((coreset_nbr_rb*coreset_time_dur)); reg++) {
|
|
||||||
if ((reg%reg_bundle_size_L) == 0) {
|
int f_bundle_j_list[NR_MAX_PDCCH_AGG_LEVEL] = {};
|
||||||
|
|
||||||
|
for (int reg = 0; reg < ((coreset_nbr_rb * coreset_time_dur)); reg++) {
|
||||||
|
if ((reg % reg_bundle_size_L) == 0) {
|
||||||
if (r == coreset_interleaver_size_R) {
|
if (r == coreset_interleaver_size_R) {
|
||||||
r=0;
|
r = 0;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle_j = (c*coreset_interleaver_size_R)+r;
|
bundle_j = (c * coreset_interleaver_size_R) + r;
|
||||||
f_bundle_j = ((r*coreset_C)+c+n_shift)%((coreset_nbr_rb*coreset_time_dur)/reg_bundle_size_L);
|
f_bundle_j = ((r * coreset_C) + c + n_shift) % ((coreset_nbr_rb * coreset_time_dur) / reg_bundle_size_L);
|
||||||
|
|
||||||
if (coreset_interleaved==0) f_bundle_j=bundle_j;
|
if (coreset_interleaved == 0) f_bundle_j = bundle_j;
|
||||||
|
|
||||||
|
f_bundle_j_list[reg / 6] = f_bundle_j;
|
||||||
|
|
||||||
LOG_DNL("[r=%d,c=%d] bundle_j(%d) interleaved at f_bundle_j(%d)\n",r,c,bundle_j,f_bundle_j);
|
|
||||||
}
|
}
|
||||||
|
if ((reg % reg_bundle_size_L) == 0) r++;
|
||||||
|
}
|
||||||
|
|
||||||
f_reg = (f_bundle_j*reg_bundle_size_L)+(reg%reg_bundle_size_L);
|
|
||||||
|
// Get cce_list indices by reg_idx in ascending order
|
||||||
|
int f_bundle_j_list_id = 0;
|
||||||
|
int f_bundle_j_list_ord[NR_MAX_PDCCH_AGG_LEVEL] = {};
|
||||||
|
for (int c_id = 0; c_id < number_of_candidates; c_id++ ) {
|
||||||
|
f_bundle_j_list_id = CCE[c_id];
|
||||||
|
for (int p = 0; p < NR_MAX_PDCCH_AGG_LEVEL; p++) {
|
||||||
|
for (int p2 = CCE[c_id]; p2 < CCE[c_id] + L[c_id]; p2++) {
|
||||||
|
if (f_bundle_j_list[p2] == p) {
|
||||||
|
f_bundle_j_list_ord[f_bundle_j_list_id] = p;
|
||||||
|
f_bundle_j_list_id++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(int reg=0; reg<((coreset_nbr_rb*coreset_time_dur)); reg++) {
|
||||||
|
|
||||||
|
f_reg = (f_bundle_j_list_ord[reg/6]*reg_bundle_size_L)+(reg%reg_bundle_size_L);
|
||||||
index_z = 9*reg;
|
index_z = 9*reg;
|
||||||
index_llr = 9*((uint16_t)floor(f_reg/coreset_time_dur)+((f_reg%coreset_time_dur)*(coreset_nbr_rb)));
|
index_llr = 9*((uint16_t)floor(f_reg/coreset_time_dur)+((f_reg%coreset_time_dur)*(coreset_nbr_rb)));
|
||||||
|
|
||||||
@@ -386,14 +414,14 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
rxF=NULL;
|
rxF=NULL;
|
||||||
|
|
||||||
// first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start)
|
// first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start)
|
||||||
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
if (((c_rb + n_BWP_start) < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
||||||
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case
|
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case
|
||||||
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
||||||
LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
||||||
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((c_rb >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
if (((c_rb + n_BWP_start) >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
||||||
// number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC)
|
// number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC)
|
||||||
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF
|
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF
|
||||||
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol
|
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol
|
||||||
@@ -406,7 +434,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
if (((c_rb + n_BWP_start) < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
||||||
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case
|
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case
|
||||||
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
||||||
#ifdef NR_PDCCH_DCI_DEBUG
|
#ifdef NR_PDCCH_DCI_DEBUG
|
||||||
@@ -415,7 +443,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((c_rb > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
if (((c_rb + n_BWP_start) > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
||||||
// number of RBs is odd and c_rb is higher than half system bandwidth + 1
|
// number of RBs is odd and c_rb is higher than half system bandwidth + 1
|
||||||
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC
|
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC
|
||||||
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol
|
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol
|
||||||
@@ -425,7 +453,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((c_rb == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC
|
if (((c_rb + n_BWP_start) == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC
|
||||||
// if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC)
|
// if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC)
|
||||||
// we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table)
|
// we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table)
|
||||||
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
||||||
@@ -760,12 +788,14 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
|
|||||||
LOG_D(PHY,"we enter nr_pdcch_demapping_deinterleaving()\n");
|
LOG_D(PHY,"we enter nr_pdcch_demapping_deinterleaving()\n");
|
||||||
nr_pdcch_demapping_deinterleaving((uint32_t *) pdcch_vars->llr,
|
nr_pdcch_demapping_deinterleaving((uint32_t *) pdcch_vars->llr,
|
||||||
(uint32_t *) pdcch_vars->e_rx,
|
(uint32_t *) pdcch_vars->e_rx,
|
||||||
frame_parms,
|
|
||||||
rel15->coreset.duration,
|
rel15->coreset.duration,
|
||||||
n_rb,
|
n_rb,
|
||||||
rel15->coreset.RegBundleSize,
|
rel15->coreset.RegBundleSize,
|
||||||
rel15->coreset.InterleaverSize,
|
rel15->coreset.InterleaverSize,
|
||||||
rel15->coreset.ShiftIndex);
|
rel15->coreset.ShiftIndex,
|
||||||
|
rel15->number_of_candidates,
|
||||||
|
rel15->CCE,
|
||||||
|
rel15->L);
|
||||||
/*
|
/*
|
||||||
nr_pdcch_unscrambling(rel15->rnti,
|
nr_pdcch_unscrambling(rel15->rnti,
|
||||||
frame_parms,
|
frame_parms,
|
||||||
@@ -889,7 +919,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
|||||||
n_rnti = rel15->rnti;
|
n_rnti = rel15->rnti;
|
||||||
|
|
||||||
if (crc == n_rnti) {
|
if (crc == n_rnti) {
|
||||||
LOG_I(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
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);
|
proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation);
|
||||||
dci_ind->SFN = proc->frame_rx;
|
dci_ind->SFN = proc->frame_rx;
|
||||||
dci_ind->slot = proc->nr_slot_rx;
|
dci_ind->slot = proc->nr_slot_rx;
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
|||||||
return(dlsch);
|
return(dlsch);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_I(PHY,"new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(NR_DL_UE_HARQ_t), exit_flag);
|
LOG_D(PHY,"new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(NR_DL_UE_HARQ_t), exit_flag);
|
||||||
free_nr_ue_dlsch(&dlsch,N_RB_DL);
|
free_nr_ue_dlsch(&dlsch,N_RB_DL);
|
||||||
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@@ -361,7 +361,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
else
|
else
|
||||||
Coderate = (float) (harq_process->R) /(float) 2048;
|
Coderate = (float) (harq_process->R) /(float) 2048;
|
||||||
|
|
||||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
if ((A <=292) || ((A <= NR_MAX_PDSCH_TBS) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||||
{
|
{
|
||||||
p_decParams->BG = 2;
|
p_decParams->BG = 2;
|
||||||
kc = 52;
|
kc = 52;
|
||||||
@@ -391,8 +391,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
|
|
||||||
if (harq_process->round == 0) {
|
if (harq_process->round == 0) {
|
||||||
// This is a new packet, so compute quantities regarding segmentation
|
// This is a new packet, so compute quantities regarding segmentation
|
||||||
if (A > 3824)
|
if (A > NR_MAX_PDSCH_TBS)
|
||||||
harq_process->B = A+24;
|
harq_process->B = A+24;
|
||||||
else
|
else
|
||||||
harq_process->B = A+16;
|
harq_process->B = A+16;
|
||||||
@@ -531,7 +531,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
|
|
||||||
if (harq_process->C == 1){
|
if (harq_process->C == 1){
|
||||||
if (A > 3824)
|
if (A > NR_MAX_PDSCH_TBS)
|
||||||
crc_type = CRC24_A;
|
crc_type = CRC24_A;
|
||||||
else
|
else
|
||||||
crc_type = CRC16;
|
crc_type = CRC16;
|
||||||
@@ -577,7 +577,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
|
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
|
||||||
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
|
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
|
||||||
LOG_I(PHY,"Segment %u CRC OK\n\033[0m",r);
|
LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r);
|
||||||
if (r==0) {
|
if (r==0) {
|
||||||
for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]);
|
for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]);
|
||||||
}
|
}
|
||||||
@@ -617,13 +617,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
|
|
||||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
|
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
|
||||||
LOG_I(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
||||||
err_flag = 1;
|
err_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err_flag == 1) {
|
if (err_flag == 1) {
|
||||||
LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
||||||
phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
|
phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
|
||||||
|
|
||||||
harq_process->harq_ack.ack = 0;
|
harq_process->harq_ack.ack = 0;
|
||||||
@@ -639,7 +639,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
if(is_crnti)
|
if(is_crnti)
|
||||||
{
|
{
|
||||||
LOG_I(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
||||||
phy_vars_ue->Mod_id,nr_slot_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
|
phy_vars_ue->Mod_id,nr_slot_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,6 +814,9 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
nb_rb = harq_process->nb_rb;
|
nb_rb = harq_process->nb_rb;
|
||||||
harq_process->trials[harq_process->round]++;
|
harq_process->trials[harq_process->round]++;
|
||||||
|
|
||||||
|
// HARQ stats
|
||||||
|
phy_vars_ue->dl_stats[harq_process->round]++;
|
||||||
|
|
||||||
uint16_t nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
|
uint16_t nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
|
||||||
|
|
||||||
harq_process->TBS = nr_compute_tbs(harq_process->Qm,harq_process->R,nb_rb,nb_symb_sch,nb_re_dmrs*length_dmrs, nb_rb_oh, 0, harq_process->Nl);
|
harq_process->TBS = nr_compute_tbs(harq_process->Qm,harq_process->R,nb_rb,nb_symb_sch,nb_re_dmrs*length_dmrs, nb_rb_oh, 0, harq_process->Nl);
|
||||||
@@ -827,7 +830,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
G = harq_process->G;
|
G = harq_process->G;
|
||||||
|
|
||||||
LOG_I(PHY,"DLSCH Decoding main, harq_pid %d TBS %d G %d, nb_re_dmrs %d, length_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, nb_re_dmrs, length_dmrs, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
|
LOG_D(PHY,"DLSCH Decoding main, harq_pid %d TBS %d G %d, nb_re_dmrs %d, length_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, nb_re_dmrs, length_dmrs, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
|
||||||
|
|
||||||
proc->decoder_main_available = 1;
|
proc->decoder_main_available = 1;
|
||||||
proc->decoder_thread_available = 0;
|
proc->decoder_thread_available = 0;
|
||||||
@@ -839,7 +842,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
else
|
else
|
||||||
Coderate = (float) (harq_process->R) /(float) 2048;
|
Coderate = (float) (harq_process->R) /(float) 2048;
|
||||||
|
|
||||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
if ((A <= 292) || ((A <= NR_MAX_PDSCH_TBS) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||||
{
|
{
|
||||||
p_decParams->BG = 2;
|
p_decParams->BG = 2;
|
||||||
kc = 52;
|
kc = 52;
|
||||||
@@ -869,7 +872,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
if (harq_process->round == 0) {
|
if (harq_process->round == 0) {
|
||||||
// This is a new packet, so compute quantities regarding segmentation
|
// This is a new packet, so compute quantities regarding segmentation
|
||||||
if (A > 3824)
|
if (A > NR_MAX_PDSCH_TBS)
|
||||||
harq_process->B = A+24;
|
harq_process->B = A+24;
|
||||||
else
|
else
|
||||||
harq_process->B = A+16;
|
harq_process->B = A+16;
|
||||||
@@ -906,7 +909,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
return((1+dlsch->max_ldpc_iterations));
|
return((1+dlsch->max_ldpc_iterations));
|
||||||
}
|
}
|
||||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD))
|
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD))
|
||||||
LOG_I(PHY,"Segmentation: C %d, K %d\n",harq_process->C,harq_process->K);
|
LOG_D(PHY,"Segmentation: C %d, K %d\n",harq_process->C,harq_process->K);
|
||||||
|
|
||||||
|
|
||||||
notifiedFIFO_elt_t *res_dl;
|
notifiedFIFO_elt_t *res_dl;
|
||||||
@@ -1056,7 +1059,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
memset(harq_process->c[r],0,Kr_bytes);
|
memset(harq_process->c[r],0,Kr_bytes);
|
||||||
|
|
||||||
if (harq_process->C == 1){
|
if (harq_process->C == 1){
|
||||||
if (A > 3824)
|
if (A > NR_MAX_PDSCH_TBS)
|
||||||
crc_type = CRC24_A;
|
crc_type = CRC24_A;
|
||||||
else
|
else
|
||||||
crc_type = CRC16;
|
crc_type = CRC16;
|
||||||
@@ -1080,7 +1083,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
start_meas(dlsch_turbo_decoding_stats);
|
start_meas(dlsch_turbo_decoding_stats);
|
||||||
#endif
|
#endif
|
||||||
LOG_I(PHY,"mthread AbsSubframe %d.%d Start LDPC segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
LOG_D(PHY,"mthread AbsSubframe %d.%d Start LDPC segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
||||||
|
|
||||||
/*for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){
|
/*for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){
|
||||||
inv_d[cnt] = (1)*harq_process->d[r][cnt];
|
inv_d[cnt] = (1)*harq_process->d[r][cnt];
|
||||||
@@ -1120,7 +1123,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
ret = 2;
|
ret = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_I(PHY,"CRC NOK\n");
|
LOG_D(PHY,"CRC NOK\n");
|
||||||
ret = 1+dlsch->max_ldpc_iterations;
|
ret = 1+dlsch->max_ldpc_iterations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,7 +1164,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
|
|
||||||
|
|
||||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
|
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
|
||||||
LOG_I(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
||||||
err_flag = 1;
|
err_flag = 1;
|
||||||
}
|
}
|
||||||
//} //loop r
|
//} //loop r
|
||||||
@@ -1182,7 +1185,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
}
|
}
|
||||||
if(is_crnti)
|
if(is_crnti)
|
||||||
{
|
{
|
||||||
LOG_I(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
||||||
phy_vars_ue->Mod_id,nr_slot_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mlimit,harq_process->TBS);
|
phy_vars_ue->Mod_id,nr_slot_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mlimit,harq_process->TBS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1333,7 +1336,7 @@ void nr_dlsch_decoding_process(void *arg)
|
|||||||
|
|
||||||
p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[r];
|
p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[r];
|
||||||
nb_symb_sch = harq_process->nb_symbols;
|
nb_symb_sch = harq_process->nb_symbols;
|
||||||
LOG_I(PHY,"dlsch decoding process frame %d slot %d segment %d r %u nb symb %d \n", frame, proc->nr_slot_rx, proc->num_seg, r, harq_process->nb_symbols);
|
LOG_D(PHY,"dlsch decoding process frame %d slot %d segment %d r %u nb symb %d \n", frame, proc->nr_slot_rx, proc->num_seg, r, harq_process->nb_symbols);
|
||||||
|
|
||||||
|
|
||||||
nb_rb = harq_process->nb_rb;
|
nb_rb = harq_process->nb_rb;
|
||||||
@@ -1352,14 +1355,14 @@ void nr_dlsch_decoding_process(void *arg)
|
|||||||
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl);
|
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl);
|
||||||
G = harq_process->G;
|
G = harq_process->G;
|
||||||
|
|
||||||
LOG_I(PHY,"DLSCH Decoding process, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
|
LOG_D(PHY,"DLSCH Decoding process, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
|
||||||
|
|
||||||
if ((harq_process->R)<1024)
|
if ((harq_process->R)<1024)
|
||||||
Coderate = (float) (harq_process->R) /(float) 1024;
|
Coderate = (float) (harq_process->R) /(float) 1024;
|
||||||
else
|
else
|
||||||
Coderate = (float) (harq_process->R) /(float) 2048;
|
Coderate = (float) (harq_process->R) /(float) 2048;
|
||||||
|
|
||||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
if ((A <= 292) || ((A <= NR_MAX_PDSCH_TBS) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||||
{
|
{
|
||||||
p_decParams->BG = 2;
|
p_decParams->BG = 2;
|
||||||
kc = 52;
|
kc = 52;
|
||||||
@@ -1390,7 +1393,7 @@ void nr_dlsch_decoding_process(void *arg)
|
|||||||
harq_process->round =0;
|
harq_process->round =0;
|
||||||
// if (harq_process->round == 0) {
|
// if (harq_process->round == 0) {
|
||||||
// This is a new packet, so compute quantities regarding segmentation
|
// This is a new packet, so compute quantities regarding segmentation
|
||||||
if (A > 3824)
|
if (A > NR_MAX_PDSCH_TBS)
|
||||||
harq_process->B = A+24;
|
harq_process->B = A+24;
|
||||||
else
|
else
|
||||||
harq_process->B = A+16;
|
harq_process->B = A+16;
|
||||||
@@ -1514,7 +1517,7 @@ void nr_dlsch_decoding_process(void *arg)
|
|||||||
memset(harq_process->c[r],0,Kr_bytes);
|
memset(harq_process->c[r],0,Kr_bytes);
|
||||||
|
|
||||||
if (harq_process->C == 1){
|
if (harq_process->C == 1){
|
||||||
if (A > 3824)
|
if (A > NR_MAX_PDSCH_TBS)
|
||||||
crc_type = CRC24_A;
|
crc_type = CRC24_A;
|
||||||
else
|
else
|
||||||
crc_type = CRC16;
|
crc_type = CRC16;
|
||||||
@@ -1572,12 +1575,12 @@ void nr_dlsch_decoding_process(void *arg)
|
|||||||
ret = 2;
|
ret = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_I(PHY,"Segment %u CRC NOK\n",r);
|
LOG_D(PHY,"Segment %u CRC NOK\n",r);
|
||||||
ret = 1+dlsch->max_ldpc_iterations;
|
ret = 1+dlsch->max_ldpc_iterations;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no_iteration_ldpc > 10)
|
if (no_iteration_ldpc > 10)
|
||||||
LOG_I(PHY,"Error number of iteration LPDC %d\n", no_iteration_ldpc);
|
LOG_D(PHY,"Error number of iteration LPDC %d\n", no_iteration_ldpc);
|
||||||
|
|
||||||
|
|
||||||
for (int m=0; m < Kr>>3; m ++)
|
for (int m=0; m < Kr>>3; m ++)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -103,7 +103,7 @@ void free_list(NR_UE_SSB *node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_initial_symbol, runmode_t mode)
|
int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_initial_symbol)
|
||||||
{
|
{
|
||||||
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
||||||
int ret =-1;
|
int ret =-1;
|
||||||
@@ -202,7 +202,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
|||||||
char duplex_string[2][4] = {"FDD","TDD"};
|
char duplex_string[2][4] = {"FDD","TDD"};
|
||||||
char prefix_string[2][9] = {"NORMAL","EXTENDED"};
|
char prefix_string[2][9] = {"NORMAL","EXTENDED"};
|
||||||
|
|
||||||
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, int n_frames)
|
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames)
|
||||||
{
|
{
|
||||||
|
|
||||||
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
|
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
|
||||||
@@ -299,7 +299,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
|
|||||||
rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp);
|
rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp);
|
||||||
|
|
||||||
nr_gold_pbch(ue);
|
nr_gold_pbch(ue);
|
||||||
ret = nr_pbch_detection(proc, ue,1,mode); // start pbch detection at first symbol after pss
|
ret = nr_pbch_detection(proc, ue, 1); // start pbch detection at first symbol after pss
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
// sync at symbol ue->symbol_offset
|
// sync at symbol ue->symbol_offset
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "PHY/sse_intrin.h"
|
#include "PHY/sse_intrin.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
#include "PHY/INIT/phy_init.h"
|
#include "PHY/INIT/phy_init.h"
|
||||||
|
#include "openair1/SCHED_NR_UE/defs.h"
|
||||||
|
|
||||||
//#define DEBUG_PBCH
|
//#define DEBUG_PBCH
|
||||||
//#define DEBUG_PBCH_ENCODING
|
//#define DEBUG_PBCH_ENCODING
|
||||||
@@ -608,23 +609,10 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
nr_downlink_indication_t dl_indication;
|
nr_downlink_indication_t dl_indication;
|
||||||
fapi_nr_rx_indication_t rx_ind;
|
fapi_nr_rx_indication_t rx_ind;
|
||||||
|
uint16_t number_pdus = 1;
|
||||||
dl_indication.module_id = ue->Mod_id;
|
|
||||||
dl_indication.gNB_index = gNB_id;
|
|
||||||
dl_indication.cc_id = proc->CC_id;
|
|
||||||
dl_indication.frame = proc->frame_rx;
|
|
||||||
dl_indication.slot = proc->nr_slot_rx;
|
|
||||||
dl_indication.thread_id = proc->thread_id;
|
|
||||||
dl_indication.rx_ind = &rx_ind; // hang on rx_ind instance
|
|
||||||
dl_indication.dci_ind = NULL;
|
|
||||||
|
|
||||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_MIB;
|
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id);
|
||||||
rx_ind.rx_indication_body[0].mib_pdu.pdu = &decoded_output[0]; //not good as it is pointing to a memory that can change
|
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_MIB, gNB_id, ue, NULL, number_pdus);
|
||||||
rx_ind.rx_indication_body[0].mib_pdu.additional_bits = nr_ue_pbch_vars->xtra_byte;
|
|
||||||
rx_ind.rx_indication_body[0].mib_pdu.ssb_index = i_ssb; // confirm with TCL
|
|
||||||
rx_ind.rx_indication_body[0].mib_pdu.ssb_length = Lmax; // confirm with TCL
|
|
||||||
rx_ind.rx_indication_body[0].mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL
|
|
||||||
rx_ind.number_pdus = 1; //rx_ind.number_pdus++;
|
|
||||||
|
|
||||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||||
|
|||||||
@@ -1172,8 +1172,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
int nr_pbch_detection(UE_nr_rxtx_proc_t *proc,
|
int nr_pbch_detection(UE_nr_rxtx_proc_t *proc,
|
||||||
PHY_VARS_NR_UE *ue,
|
PHY_VARS_NR_UE *ue,
|
||||||
int pbch_initial_symbol,
|
int pbch_initial_symbol);
|
||||||
runmode_t mode);
|
|
||||||
|
|
||||||
uint16_t rx_pbch_emul(PHY_VARS_NR_UE *phy_vars_ue,
|
uint16_t rx_pbch_emul(PHY_VARS_NR_UE *phy_vars_ue,
|
||||||
uint8_t eNB_id,
|
uint8_t eNB_id,
|
||||||
@@ -1453,7 +1452,6 @@ void generate_RIV_tables(void);
|
|||||||
*/
|
*/
|
||||||
int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||||
PHY_VARS_NR_UE *phy_vars_ue,
|
PHY_VARS_NR_UE *phy_vars_ue,
|
||||||
runmode_t mode,
|
|
||||||
int n_frames);
|
int n_frames);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -225,6 +225,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) {
|
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));
|
fl_winset(FL_ObjWin(graph->graph));
|
||||||
const int samplesPerPixel=datasize/graph->w;
|
const int samplesPerPixel=datasize/graph->w;
|
||||||
int displayPart=graph->waterFallh-ScaleZone;
|
int displayPart=graph->waterFallh-ScaleZone;
|
||||||
|
|||||||
@@ -5952,8 +5952,6 @@ void idft32768(int16_t *x,int16_t *y,unsigned char scale)
|
|||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int16_t twa1536[1024],twb1536[1024];
|
int16_t twa1536[1024],twb1536[1024];
|
||||||
|
|
||||||
// 512 x 3
|
// 512 x 3
|
||||||
@@ -9471,6 +9469,919 @@ void dft1200(int16_t *x,int16_t *y,unsigned char scale_flag)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int16_t twa1296[431*2*4];
|
||||||
|
static int16_t twb1296[431*2*4];
|
||||||
|
|
||||||
|
void dft1296(int16_t *x,int16_t *y,unsigned char scale_flag) //432 * 3
|
||||||
|
{
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1296[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1296[0];
|
||||||
|
simd_q15_t x2128[1296];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1296];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<432; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+432] = x128[j+1];
|
||||||
|
x2128[i+864] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft432((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft432((int16_t *)(x2128+432),(int16_t *)(ytmp128+432),1);
|
||||||
|
dft432((int16_t *)(x2128+864),(int16_t *)(ytmp128+864),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+432,ytmp128+864,y128,y128+432,y128+864);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<432; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+432+i,
|
||||||
|
ytmp128+864+i,
|
||||||
|
y128+i,
|
||||||
|
y128+432+i,
|
||||||
|
y128+864+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<1296; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static int16_t twa1440[479*2*4];
|
||||||
|
static int16_t twb1440[479*2*4];
|
||||||
|
|
||||||
|
void dft1440(int16_t *x,int16_t *y,unsigned char scale_flag) // 480 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1440[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1440[0];
|
||||||
|
simd_q15_t x2128[1440];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1440];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<480; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+480] = x128[j+1];
|
||||||
|
x2128[i+960] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft480((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft480((int16_t *)(x2128+480),(int16_t *)(ytmp128+480),1);
|
||||||
|
dft480((int16_t *)(x2128+960),(int16_t *)(ytmp128+960),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+480,ytmp128+960,y128,y128+480,y128+960);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<480; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+480+i,
|
||||||
|
ytmp128+960+i,
|
||||||
|
y128+i,
|
||||||
|
y128+480+i,
|
||||||
|
y128+960+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<1440; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa1500[2392]__attribute__((aligned(32)));
|
||||||
|
static int16_t twb1500[2392]__attribute__((aligned(32)));
|
||||||
|
static int16_t twc1500[2392]__attribute__((aligned(32)));
|
||||||
|
static int16_t twd1500[2392]__attribute__((aligned(32)));
|
||||||
|
|
||||||
|
void dft1500(int16_t *x,int16_t *y,unsigned char scale_flag)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1500[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1500[0];
|
||||||
|
simd_q15_t *twc128=(simd_q15_t *)&twc1500[0];
|
||||||
|
simd_q15_t *twd128=(simd_q15_t *)&twd1500[0];
|
||||||
|
simd_q15_t x2128[1500];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1500];//=&ytmp128array2[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<300; i++,j+=5) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+300] = x128[j+1];
|
||||||
|
x2128[i+600] = x128[j+2];
|
||||||
|
x2128[i+900] = x128[j+3];
|
||||||
|
x2128[i+1200] = x128[j+4];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft300((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft300((int16_t *)(x2128+300),(int16_t *)(ytmp128+300),1);
|
||||||
|
dft300((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||||
|
dft300((int16_t *)(x2128+900),(int16_t *)(ytmp128+900),1);
|
||||||
|
dft300((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||||
|
|
||||||
|
bfly5_tw1(ytmp128,ytmp128+300,ytmp128+600,ytmp128+900,ytmp128+1200,y128,y128+300,y128+600,y128+900,y128+1200);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<300; i++,j++) {
|
||||||
|
bfly5(ytmp128+i,
|
||||||
|
ytmp128+300+i,
|
||||||
|
ytmp128+600+i,
|
||||||
|
ytmp128+900+i,
|
||||||
|
ytmp128+1200+i,
|
||||||
|
y128+i,
|
||||||
|
y128+300+i,
|
||||||
|
y128+600+i,
|
||||||
|
y128+900+i,
|
||||||
|
y128+1200+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j,
|
||||||
|
twc128+j,
|
||||||
|
twd128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[15]);
|
||||||
|
|
||||||
|
for (i=0; i<1500; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int16_t twa1620[539*2*4];
|
||||||
|
static int16_t twb1620[539*2*4];
|
||||||
|
|
||||||
|
void dft1620(int16_t *x,int16_t *y,unsigned char scale_flag) // 540 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1620[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1620[0];
|
||||||
|
simd_q15_t x2128[1620];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1620];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<540; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+540] = x128[j+1];
|
||||||
|
x2128[i+1080] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft540((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft540((int16_t *)(x2128+540),(int16_t *)(ytmp128+540),1);
|
||||||
|
dft540((int16_t *)(x2128+1080),(int16_t *)(ytmp128+1080),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+540,ytmp128+1080,y128,y128+540,y128+1080);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<540; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+540+i,
|
||||||
|
ytmp128+1080+i,
|
||||||
|
y128+i,
|
||||||
|
y128+540+i,
|
||||||
|
y128+1080+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<1620; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa1728[575*2*4];
|
||||||
|
static int16_t twb1728[575*2*4];
|
||||||
|
|
||||||
|
void dft1728(int16_t *x,int16_t *y,unsigned char scale_flag) // 576 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1728[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1728[0];
|
||||||
|
simd_q15_t x2128[1728];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1728];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<576; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+576] = x128[j+1];
|
||||||
|
x2128[i+1152] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft576((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft576((int16_t *)(x2128+576),(int16_t *)(ytmp128+576),1);
|
||||||
|
dft576((int16_t *)(x2128+1152),(int16_t *)(ytmp128+1152),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+576,ytmp128+1152,y128,y128+576,y128+1152);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<576; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+576+i,
|
||||||
|
ytmp128+1152+i,
|
||||||
|
y128+i,
|
||||||
|
y128+576+i,
|
||||||
|
y128+1152+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<1728; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa1800[599*2*4];
|
||||||
|
static int16_t twb1800[599*2*4];
|
||||||
|
|
||||||
|
void dft1800(int16_t *x,int16_t *y,unsigned char scale_flag) // 600 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1800[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1800[0];
|
||||||
|
simd_q15_t x2128[1800];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1800];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<600; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+600] = x128[j+1];
|
||||||
|
x2128[i+1200] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft600((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft600((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||||
|
dft600((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+600,ytmp128+1200,y128,y128+600,y128+1200);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<600; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+600+i,
|
||||||
|
ytmp128+1200+i,
|
||||||
|
y128+i,
|
||||||
|
y128+600+i,
|
||||||
|
y128+1200+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<1800; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa1920[479*2*4];
|
||||||
|
static int16_t twb1920[479*2*4];
|
||||||
|
static int16_t twc1920[479*2*4];
|
||||||
|
|
||||||
|
void dft1920(int16_t *x,int16_t *y,unsigned char scale_flag) // 480 x 4
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1920[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1920[0];
|
||||||
|
simd_q15_t *twc128=(simd_q15_t *)&twc1920[0];
|
||||||
|
simd_q15_t x2128[1920];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1920];//=&ytmp128array2[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<480; i++,j+=4) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+480] = x128[j+1];
|
||||||
|
x2128[i+960] = x128[j+2];
|
||||||
|
x2128[i+1440] = x128[j+3];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft480((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft480((int16_t *)(x2128+480),(int16_t *)(ytmp128+480),1);
|
||||||
|
dft480((int16_t *)(x2128+960),(int16_t *)(ytmp128+960),1);
|
||||||
|
dft480((int16_t *)(x2128+1440),(int16_t *)(ytmp128+1440),1);
|
||||||
|
|
||||||
|
bfly4_tw1(ytmp128,ytmp128+480,ytmp128+960,ytmp128+1440,y128,y128+480,y128+960,y128+1440);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<480; i++,j++) {
|
||||||
|
bfly4(ytmp128+i,
|
||||||
|
ytmp128+480+i,
|
||||||
|
ytmp128+960+i,
|
||||||
|
ytmp128+1440+i,
|
||||||
|
y128+i,
|
||||||
|
y128+480+i,
|
||||||
|
y128+960+i,
|
||||||
|
y128+1440+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j,
|
||||||
|
twc128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[13]);
|
||||||
|
for (i=0; i<1920; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa1944[647*2*4];
|
||||||
|
static int16_t twb1944[647*2*4];
|
||||||
|
|
||||||
|
void dft1944(int16_t *x,int16_t *y,unsigned char scale_flag) // 648 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa1944[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb1944[0];
|
||||||
|
simd_q15_t x2128[1944];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[1944];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<648; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+648] = x128[j+1];
|
||||||
|
x2128[i+1296] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft648((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft648((int16_t *)(x2128+648),(int16_t *)(ytmp128+648),1);
|
||||||
|
dft648((int16_t *)(x2128+1296),(int16_t *)(ytmp128+1296),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+648,ytmp128+1296,y128,y128+648,y128+1296);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<648; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+648+i,
|
||||||
|
ytmp128+1296+i,
|
||||||
|
y128+i,
|
||||||
|
y128+648+i,
|
||||||
|
y128+1296+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<1944; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa2160[719*2*4];
|
||||||
|
static int16_t twb2160[719*2*4];
|
||||||
|
|
||||||
|
void dft2160(int16_t *x,int16_t *y,unsigned char scale_flag) // 720 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa2160[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb2160[0];
|
||||||
|
simd_q15_t x2128[2160];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[2160];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<720; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+720] = x128[j+1];
|
||||||
|
x2128[i+1440] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft720((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft720((int16_t *)(x2128+720),(int16_t *)(ytmp128+720),1);
|
||||||
|
dft720((int16_t *)(x2128+1440),(int16_t *)(ytmp128+1440),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+720,ytmp128+1440,y128,y128+720,y128+1440);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<720; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+720+i,
|
||||||
|
ytmp128+1440+i,
|
||||||
|
y128+i,
|
||||||
|
y128+720+i,
|
||||||
|
y128+1440+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<2160; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa2304[767*2*4];
|
||||||
|
static int16_t twb2304[767*2*4];
|
||||||
|
|
||||||
|
void dft2304(int16_t *x,int16_t *y,unsigned char scale_flag) // 768 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa2304[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb2304[0];
|
||||||
|
simd_q15_t x2128[2304];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[2304];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<768; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+768] = x128[j+1];
|
||||||
|
x2128[i+1536] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft768((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft768((int16_t *)(x2128+768),(int16_t *)(ytmp128+768),1);
|
||||||
|
dft768((int16_t *)(x2128+1536),(int16_t *)(ytmp128+1536),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+768,ytmp128+1536,y128,y128+768,y128+1536);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<768; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+768+i,
|
||||||
|
ytmp128+1536+i,
|
||||||
|
y128+i,
|
||||||
|
y128+768+i,
|
||||||
|
y128+1536+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<2304; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa2400[599*2*4];
|
||||||
|
static int16_t twb2400[599*2*4];
|
||||||
|
static int16_t twc2400[599*2*4];
|
||||||
|
|
||||||
|
void dft2400(int16_t *x,int16_t *y,unsigned char scale_flag) // 600 x 4
|
||||||
|
{
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa2400[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb2400[0];
|
||||||
|
simd_q15_t *twc128=(simd_q15_t *)&twc2400[0];
|
||||||
|
simd_q15_t x2128[2400];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[2400];//=&ytmp128array2[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<600; i++,j+=4) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+600] = x128[j+1];
|
||||||
|
x2128[i+1200] = x128[j+2];
|
||||||
|
x2128[i+1800] = x128[j+3];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft600((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft600((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||||
|
dft600((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||||
|
dft600((int16_t *)(x2128+1800),(int16_t *)(ytmp128+1800),1);
|
||||||
|
|
||||||
|
bfly4_tw1(ytmp128,ytmp128+600,ytmp128+1200,ytmp128+1800,y128,y128+600,y128+1200,y128+1800);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<600; i++,j++) {
|
||||||
|
bfly4(ytmp128+i,
|
||||||
|
ytmp128+600+i,
|
||||||
|
ytmp128+1200+i,
|
||||||
|
ytmp128+1800+i,
|
||||||
|
y128+i,
|
||||||
|
y128+600+i,
|
||||||
|
y128+1200+i,
|
||||||
|
y128+1800+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j,
|
||||||
|
twc128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[13]);
|
||||||
|
for (i=0; i<2400; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa2592[863*2*4];
|
||||||
|
static int16_t twb2592[863*2*4];
|
||||||
|
|
||||||
|
void dft2592(int16_t *x,int16_t *y,unsigned char scale_flag) // 864 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa2592[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb2592[0];
|
||||||
|
simd_q15_t x2128[2592];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[2592];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<864; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+864] = x128[j+1];
|
||||||
|
x2128[i+1728] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft864((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft864((int16_t *)(x2128+864),(int16_t *)(ytmp128+864),1);
|
||||||
|
dft864((int16_t *)(x2128+1728),(int16_t *)(ytmp128+1728),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+864,ytmp128+1728,y128,y128+864,y128+1728);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<864; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+864+i,
|
||||||
|
ytmp128+1728+i,
|
||||||
|
y128+i,
|
||||||
|
y128+864+i,
|
||||||
|
y128+1728+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<2592; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa2700[899*2*4];
|
||||||
|
static int16_t twb2700[899*2*4];
|
||||||
|
|
||||||
|
void dft2700(int16_t *x,int16_t *y,unsigned char scale_flag) // 900 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa2700[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb2700[0];
|
||||||
|
simd_q15_t x2128[2700];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[2700];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<900; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+900] = x128[j+1];
|
||||||
|
x2128[i+1800] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft900((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft900((int16_t *)(x2128+900),(int16_t *)(ytmp128+900),1);
|
||||||
|
dft900((int16_t *)(x2128+1800),(int16_t *)(ytmp128+1800),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+900,ytmp128+1800,y128,y128+900,y128+1800);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<900; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+900+i,
|
||||||
|
ytmp128+1800+i,
|
||||||
|
y128+i,
|
||||||
|
y128+900+i,
|
||||||
|
y128+1800+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<2700; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa2880[959*2*4];
|
||||||
|
static int16_t twb2880[959*2*4];
|
||||||
|
|
||||||
|
void dft2880(int16_t *x,int16_t *y,unsigned char scale_flag) // 960 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa2880[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb2880[0];
|
||||||
|
simd_q15_t x2128[2880];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[2880];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<960; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+960] = x128[j+1];
|
||||||
|
x2128[i+1920] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft960((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft960((int16_t *)(x2128+960),(int16_t *)(ytmp128+960),1);
|
||||||
|
dft960((int16_t *)(x2128+1920),(int16_t *)(ytmp128+1920),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+960,ytmp128+1920,y128,y128+960,y128+1920);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<960; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+960+i,
|
||||||
|
ytmp128+1920+i,
|
||||||
|
y128+i,
|
||||||
|
y128+960+i,
|
||||||
|
y128+1920+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<2880; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa2916[971*2*4];
|
||||||
|
static int16_t twb2916[971*2*4];
|
||||||
|
|
||||||
|
void dft2916(int16_t *x,int16_t *y,unsigned char scale_flag) // 972 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa2916[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb2916[0];
|
||||||
|
simd_q15_t x2128[2916];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[2916];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<972; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+972] = x128[j+1];
|
||||||
|
x2128[i+1944] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft972((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft972((int16_t *)(x2128+972),(int16_t *)(ytmp128+972),1);
|
||||||
|
dft972((int16_t *)(x2128+1944),(int16_t *)(ytmp128+1944),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+972,ytmp128+1944,y128,y128+972,y128+1944);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<972; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+972+i,
|
||||||
|
ytmp128+1944+i,
|
||||||
|
y128+i,
|
||||||
|
y128+972+i,
|
||||||
|
y128+1944+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<2916; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16_t twa3000[599*8]__attribute__((aligned(32)));
|
||||||
|
static int16_t twb3000[599*8]__attribute__((aligned(32)));
|
||||||
|
static int16_t twc3000[599*8]__attribute__((aligned(32)));
|
||||||
|
static int16_t twd3000[599*8]__attribute__((aligned(32)));
|
||||||
|
|
||||||
|
void dft3000(int16_t *x,int16_t *y,unsigned char scale_flag) // 600 * 5
|
||||||
|
{
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa3000[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb3000[0];
|
||||||
|
simd_q15_t *twc128=(simd_q15_t *)&twc3000[0];
|
||||||
|
simd_q15_t *twd128=(simd_q15_t *)&twd3000[0];
|
||||||
|
simd_q15_t x2128[3000];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[3000];//=&ytmp128array2[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<600; i++,j+=5) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+600] = x128[j+1];
|
||||||
|
x2128[i+1200] = x128[j+2];
|
||||||
|
x2128[i+1800] = x128[j+3];
|
||||||
|
x2128[i+2400] = x128[j+4];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft600((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft600((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||||
|
dft600((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||||
|
dft600((int16_t *)(x2128+1800),(int16_t *)(ytmp128+1800),1);
|
||||||
|
dft600((int16_t *)(x2128+2400),(int16_t *)(ytmp128+2400),1);
|
||||||
|
|
||||||
|
bfly5_tw1(ytmp128,ytmp128+600,ytmp128+1200,ytmp128+1800,ytmp128+2400,y128,y128+600,y128+1200,y128+1800,y128+2400);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<600; i++,j++) {
|
||||||
|
bfly5(ytmp128+i,
|
||||||
|
ytmp128+600+i,
|
||||||
|
ytmp128+1200+i,
|
||||||
|
ytmp128+1800+i,
|
||||||
|
ytmp128+2400+i,
|
||||||
|
y128+i,
|
||||||
|
y128+600+i,
|
||||||
|
y128+1200+i,
|
||||||
|
y128+1800+i,
|
||||||
|
y128+2400+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j,
|
||||||
|
twc128+j,
|
||||||
|
twd128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[15]);
|
||||||
|
|
||||||
|
for (i=0; i<3000; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int16_t twa3240[1079*2*4];
|
||||||
|
static int16_t twb3240[1079*2*4];
|
||||||
|
|
||||||
|
void dft3240(int16_t *x,int16_t *y,unsigned char scale_flag) // 1080 x 3
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
simd_q15_t *x128=(simd_q15_t *)x;
|
||||||
|
simd_q15_t *y128=(simd_q15_t *)y;
|
||||||
|
simd_q15_t *twa128=(simd_q15_t *)&twa3240[0];
|
||||||
|
simd_q15_t *twb128=(simd_q15_t *)&twb3240[0];
|
||||||
|
simd_q15_t x2128[3240];// = (simd_q15_t *)&x2128array[0];
|
||||||
|
simd_q15_t ytmp128[3240];//=&ytmp128array3[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0,j=0; i<1080; i++,j+=3) {
|
||||||
|
x2128[i] = x128[j];
|
||||||
|
x2128[i+1080] = x128[j+1];
|
||||||
|
x2128[i+2160] = x128[j+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
dft1080((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||||
|
dft1080((int16_t *)(x2128+1080),(int16_t *)(ytmp128+1080),1);
|
||||||
|
dft1080((int16_t *)(x2128+2160),(int16_t *)(ytmp128+2160),1);
|
||||||
|
|
||||||
|
bfly3_tw1(ytmp128,ytmp128+1080,ytmp128+2160,y128,y128+1080,y128+2160);
|
||||||
|
|
||||||
|
for (i=1,j=0; i<1080; i++,j++) {
|
||||||
|
bfly3(ytmp128+i,
|
||||||
|
ytmp128+1080+i,
|
||||||
|
ytmp128+2160+i,
|
||||||
|
y128+i,
|
||||||
|
y128+1080+i,
|
||||||
|
y128+2160+i,
|
||||||
|
twa128+j,
|
||||||
|
twb128+j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_flag==1) {
|
||||||
|
norm128 = set1_int16(dft_norm_table[14]);
|
||||||
|
|
||||||
|
for (i=0; i<3240; i++) {
|
||||||
|
y128[i] = mulhi_int16(y128[i],norm128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mm_empty();
|
||||||
|
_m_empty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
void init_rad4(int N,int16_t *tw) {
|
void init_rad4(int N,int16_t *tw) {
|
||||||
|
|
||||||
int16_t *twa = tw;
|
int16_t *twa = tw;
|
||||||
@@ -9492,7 +10403,7 @@ void init_rad4_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc) {
|
|||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for (i=1;i<(N/4);i++) {
|
for (i=1;i<(N/4);i++) {
|
||||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||||
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
||||||
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
||||||
@@ -9525,7 +10436,7 @@ void init_rad2_rep(int N,int16_t *twa) {
|
|||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for (i=1;i<(N/2);i++) {
|
for (i=1;i<(N/2);i++) {
|
||||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||||
for (j=1;j<4;j++) {
|
for (j=1;j<4;j++) {
|
||||||
((int32_t*)twa)[j]=((int32_t*)twa)[0];
|
((int32_t*)twa)[j]=((int32_t*)twa)[0];
|
||||||
@@ -9551,7 +10462,7 @@ void init_rad3_rep(int N,int16_t *twa,int16_t *twb) {
|
|||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for (i=1;i<(N/3);i++) {
|
for (i=1;i<(N/3);i++) {
|
||||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||||
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
||||||
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
||||||
@@ -9569,7 +10480,7 @@ void init_rad5_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc,int16_t *twd) {
|
|||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for (i=1;i<(N/5);i++) {
|
for (i=1;i<(N/5);i++) {
|
||||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||||
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
||||||
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
||||||
@@ -9586,7 +10497,7 @@ void init_rad5_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc,int16_t *twd) {
|
|||||||
twa+=8;
|
twa+=8;
|
||||||
twb+=8;
|
twb+=8;
|
||||||
twc+=8;
|
twc+=8;
|
||||||
twd+=8;
|
twd+=8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
@@ -9600,7 +10511,7 @@ int dfts_autoinit(void)
|
|||||||
init_rad2(8192,tw8192);
|
init_rad2(8192,tw8192);
|
||||||
init_rad4(16384,tw16384);
|
init_rad4(16384,tw16384);
|
||||||
init_rad2(32768,tw32768);
|
init_rad2(32768,tw32768);
|
||||||
|
|
||||||
init_rad3(1536,twa1536,twb1536);
|
init_rad3(1536,twa1536,twb1536);
|
||||||
init_rad3(3072,twa3072,twb3072);
|
init_rad3(3072,twa3072,twb3072);
|
||||||
init_rad3(6144,twa6144,twb6144);
|
init_rad3(6144,twa6144,twb6144);
|
||||||
@@ -9645,6 +10556,24 @@ int dfts_autoinit(void)
|
|||||||
init_rad3_rep(1080,twa1080,twb1080);
|
init_rad3_rep(1080,twa1080,twb1080);
|
||||||
init_rad4_rep(1152,twa1152,twb1152,twc1152);
|
init_rad4_rep(1152,twa1152,twb1152,twc1152);
|
||||||
init_rad4_rep(1200,twa1200,twb1200,twc1200);
|
init_rad4_rep(1200,twa1200,twb1200,twc1200);
|
||||||
|
init_rad3_rep(1296,twa1296,twb1296);
|
||||||
|
init_rad3_rep(1440,twa1440,twb1440);
|
||||||
|
init_rad5_rep(1500,twa1500,twb1500,twc1500,twd1500);
|
||||||
|
init_rad3_rep(1620,twa1620,twb1620);
|
||||||
|
init_rad3_rep(1728,twa1728,twb1728);
|
||||||
|
init_rad3_rep(1800,twa1800,twb1800);
|
||||||
|
init_rad4_rep(1920,twa1920,twb1920, twc1920);
|
||||||
|
init_rad3_rep(1944,twa1944,twb1944);
|
||||||
|
init_rad3_rep(2160,twa2160,twb2160);
|
||||||
|
init_rad3_rep(2304,twa2304,twb2304);
|
||||||
|
init_rad4_rep(2400,twa2400,twb2400,twc2400);
|
||||||
|
init_rad3_rep(2592,twa2592,twb2592);
|
||||||
|
init_rad3_rep(2700,twa2700,twb2700);
|
||||||
|
init_rad3_rep(2880,twa2880,twb2880);
|
||||||
|
init_rad3_rep(2916,twa2916,twb2916);
|
||||||
|
init_rad5_rep(3000,twa3000,twb3000,twc3000,twd3000);
|
||||||
|
init_rad3_rep(3240,twa3240,twb3240);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,9 +226,26 @@ void dft1024(int16_t *x,int16_t *y,uint8_t scale_flag);
|
|||||||
void dft1080(int16_t *x,int16_t *y,uint8_t scale_flag);
|
void dft1080(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
void dft1152(int16_t *x,int16_t *y,uint8_t scale_flag);
|
void dft1152(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
void dft1200(int16_t *x,int16_t *y,uint8_t scale_flag);
|
void dft1200(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft1296(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft1440(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft1500(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
void dft1536(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
void dft1536(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
||||||
|
void dft1620(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft1728(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft1800(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft1920(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft1944(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
void dft2048(int16_t *x,int16_t *y,uint8_t scale_flag);
|
void dft2048(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft2160(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft2304(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft2400(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft2592(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft2700(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft2880(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft2916(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
|
void dft3000(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
void dft3072(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
void dft3072(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
||||||
|
void dft3240(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
void dft4096(int16_t *x,int16_t *y,uint8_t scale_flag);
|
void dft4096(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
void dft6144(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
void dft6144(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
||||||
void dft8192(int16_t *x,int16_t *y,uint8_t scale_flag);
|
void dft8192(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||||
@@ -283,21 +300,25 @@ typedef enum DFT_size_idx {
|
|||||||
DFT_108, DFT_120, DFT_128, DFT_144, DFT_180, DFT_192, DFT_216, DFT_240,
|
DFT_108, DFT_120, DFT_128, DFT_144, DFT_180, DFT_192, DFT_216, DFT_240,
|
||||||
DFT_256, DFT_288, DFT_300, DFT_324, DFT_360, DFT_384, DFT_432, DFT_480,
|
DFT_256, DFT_288, DFT_300, DFT_324, DFT_360, DFT_384, DFT_432, DFT_480,
|
||||||
DFT_512, DFT_540, DFT_576, DFT_600, DFT_648, DFT_720, DFT_768, DFT_864,
|
DFT_512, DFT_540, DFT_576, DFT_600, DFT_648, DFT_720, DFT_768, DFT_864,
|
||||||
DFT_900, DFT_960, DFT_972, DFT_1024, DFT_1080, DFT_1152, DFT_1200, DFT_1536,
|
DFT_900, DFT_960, DFT_972, DFT_1024, DFT_1080, DFT_1152, DFT_1200, DFT_1296,
|
||||||
DFT_2048, DFT_3072, DFT_4096, DFT_6144, DFT_8192, DFT_9216, DFT_12288, DFT_18432,
|
DFT_1440, DFT_1500, DFT_1536, DFT_1620, DFT_1728, DFT_1800, DFT_1920, DFT_1944,
|
||||||
DFT_24576, DFT_36864, DFT_49152, DFT_73728, DFT_98304,
|
DFT_2048, DFT_2160, DFT_2304, DFT_2400, DFT_2592, DFT_2700, DFT_2880, DFT_2916,
|
||||||
|
DFT_3000, DFT_3072, DFT_3240, DFT_4096, DFT_6144, DFT_8192, DFT_9216, DFT_12288,
|
||||||
|
DFT_18432, DFT_24576, DFT_36864, DFT_49152, DFT_73728, DFT_98304,
|
||||||
DFT_SIZE_IDXTABLESIZE
|
DFT_SIZE_IDXTABLESIZE
|
||||||
} dft_size_idx_t;
|
} dft_size_idx_t;
|
||||||
|
|
||||||
#ifdef OAIDFTS_MAIN
|
#ifdef OAIDFTS_MAIN
|
||||||
adftfunc_t dft_ftab[]={
|
adftfunc_t dft_ftab[]={
|
||||||
dft12, dft24, dft36, dft48, dft60, dft72, dft96,
|
dft12, dft24, dft36, dft48, dft60, dft72, dft96,
|
||||||
dft108, dft120, dft128, dft144, dft180, dft192, dft216, dft240,
|
dft108, dft120, dft128, dft144, dft180, dft192, dft216, dft240,
|
||||||
dft256, dft288, dft300, dft324, dft360, dft384, dft432, dft480,
|
dft256, dft288, dft300, dft324, dft360, dft384, dft432, dft480,
|
||||||
dft512, dft540, dft576, dft600, dft648, dft720, dft768, dft864,
|
dft512, dft540, dft576, dft600, dft648, dft720, dft768, dft864,
|
||||||
dft900, dft960, dft972, dft1024, dft1080, dft1152, dft1200, dft1536,
|
dft900, dft960, dft972, dft1024, dft1080, dft1152, dft1200, dft1296,
|
||||||
dft2048, dft3072, dft4096, dft6144, dft8192, dft9216, dft12288, dft18432,
|
dft1440, dft1500, dft1536, dft1620, dft1728, dft1800, dft1920, dft1944,
|
||||||
dft24576, dft36864, dft49152, dft73728, dft98304
|
dft2048, dft2160, dft2304, dft2400, dft2592, dft2700, dft2880, dft2916,
|
||||||
|
dft3000, dft3072, dft3240, dft4096, dft6144, dft8192, dft9216, dft12288,
|
||||||
|
dft18432, dft24576, dft36864, dft49152, dft73728, dft98304
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -309,9 +330,9 @@ typedef enum idft_size_idx {
|
|||||||
} idft_size_idx_t;
|
} idft_size_idx_t;
|
||||||
#ifdef OAIDFTS_MAIN
|
#ifdef OAIDFTS_MAIN
|
||||||
aidftfunc_t idft_ftab[]={
|
aidftfunc_t idft_ftab[]={
|
||||||
idft128, idft256, idft512, idft1024, idft1536, idft2048, idft3072, idft4096,
|
idft128, idft256, idft512, idft1024, idft1536, idft2048, idft3072, idft4096,
|
||||||
idft6144, idft8192, idft9216, idft12288, idft18432, idft24576, idft36864, idft49152,
|
idft6144, idft8192, idft9216, idft12288, idft18432, idft24576, idft36864, idft49152,
|
||||||
idft73728, idft98304
|
idft73728, idft98304
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ typedef struct {
|
|||||||
uint32_t frame;
|
uint32_t frame;
|
||||||
/// Subframe where current HARQ round was sent
|
/// Subframe where current HARQ round was sent
|
||||||
uint32_t subframe;
|
uint32_t subframe;
|
||||||
/// Index of current HARQ round for this DLSCH
|
|
||||||
uint8_t round;
|
|
||||||
/// MIMO mode for this DLSCH
|
/// MIMO mode for this DLSCH
|
||||||
MIMO_mode_t mimo_mode;
|
MIMO_mode_t mimo_mode;
|
||||||
/// Concatenated sequences
|
/// Concatenated sequences
|
||||||
@@ -138,8 +136,8 @@ typedef struct {
|
|||||||
} NR_gNB_SCH_STATS_t;
|
} NR_gNB_SCH_STATS_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// Pointers to 16 HARQ processes for the DLSCH
|
/// Pointers to variables related to DLSCH harq process
|
||||||
NR_DL_gNB_HARQ_t *harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
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 ports 5 or 7..14, prior to precoding)
|
||||||
int32_t *txdataF[NR_MAX_NB_LAYERS];
|
int32_t *txdataF[NR_MAX_NB_LAYERS];
|
||||||
/// Modulated symbols buffer
|
/// Modulated symbols buffer
|
||||||
@@ -834,6 +832,7 @@ typedef struct PHY_VARS_gNB_s {
|
|||||||
notifiedFIFO_t *respDecode;
|
notifiedFIFO_t *respDecode;
|
||||||
tpool_t *threadPool;
|
tpool_t *threadPool;
|
||||||
int nbDecode;
|
int nbDecode;
|
||||||
|
uint8_t pusch_proc_threads;
|
||||||
|
|
||||||
} PHY_VARS_gNB;
|
} PHY_VARS_gNB;
|
||||||
|
|
||||||
|
|||||||
+91
-231
@@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file PHY/defs_nr_UE.h
|
/*! \file PHY/defs_nr_UE.h
|
||||||
\brief Top-level defines and structure definitions for nr ue
|
\brief Top-level constants and data structures definitions for NR UE
|
||||||
\author Guy De Souza, H. WANG, A. Mico Pereperez
|
\author Guy De Souza, H. WANG, A. Mico Pereperez
|
||||||
\date 2018
|
\date 2018
|
||||||
\version 0.1
|
\version 0.1
|
||||||
@@ -46,9 +46,8 @@
|
|||||||
#include "common_lib.h"
|
#include "common_lib.h"
|
||||||
#include "msc.h"
|
#include "msc.h"
|
||||||
#include "fapi_nr_ue_interface.h"
|
#include "fapi_nr_ue_interface.h"
|
||||||
|
|
||||||
//#include <complex.h>
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
|
|
||||||
#ifdef MEX
|
#ifdef MEX
|
||||||
#define msg mexPrintf
|
#define msg mexPrintf
|
||||||
#else
|
#else
|
||||||
@@ -79,9 +78,6 @@
|
|||||||
#define openair_free(y,x) free((y))
|
#define openair_free(y,x) free((y))
|
||||||
#define PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
|
|
||||||
//#define RX_NB_TH_MAX 3
|
|
||||||
//#define RX_NB_TH 3
|
|
||||||
|
|
||||||
#ifdef NR_UNIT_TEST
|
#ifdef NR_UNIT_TEST
|
||||||
#define FILE_NAME " "
|
#define FILE_NAME " "
|
||||||
#define LINE_FILE (0)
|
#define LINE_FILE (0)
|
||||||
@@ -92,53 +88,19 @@
|
|||||||
#define NR_TST_PHY_PRINTF(...)
|
#define NR_TST_PHY_PRINTF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#ifdef SHRLIBDEV
|
|
||||||
//extern int rxrescale;
|
|
||||||
//#define RX_IQRESCALELEN rxrescale
|
|
||||||
//#else
|
|
||||||
//#define RX_IQRESCALELEN 15
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//! \brief Allocate \c size bytes of memory on the heap with alignment 16 and zero it afterwards.
|
|
||||||
//! If no more memory is available, this function will terminate the program with an assertion error.
|
|
||||||
/*static inline void* malloc16_clear( size_t size )
|
|
||||||
{
|
|
||||||
#ifdef __AVX2__
|
|
||||||
void* ptr = memalign(32, size);
|
|
||||||
#else
|
|
||||||
void* ptr = memalign(16, size);
|
|
||||||
#endif
|
|
||||||
DevAssert(ptr);
|
|
||||||
memset( ptr, 0, size );
|
|
||||||
return ptr;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define PAGE_MASK 0xfffff000
|
#define PAGE_MASK 0xfffff000
|
||||||
#define virt_to_phys(x) (x)
|
#define virt_to_phys(x) (x)
|
||||||
|
|
||||||
#define openair_sched_exit() exit(-1)
|
#define openair_sched_exit() exit(-1)
|
||||||
|
|
||||||
|
|
||||||
//#define max(a,b) ((a)>(b) ? (a) : (b))
|
|
||||||
//#define min(a,b) ((a)<(b) ? (a) : (b))
|
|
||||||
|
|
||||||
|
|
||||||
#define bzero(s,n) (memset((s),0,(n)))
|
#define bzero(s,n) (memset((s),0,(n)))
|
||||||
|
|
||||||
#define cmax(a,b) ((a>b) ? (a) : (b))
|
#define cmax(a,b) ((a>b) ? (a) : (b))
|
||||||
#define cmin(a,b) ((a<b) ? (a) : (b))
|
#define cmin(a,b) ((a<b) ? (a) : (b))
|
||||||
|
|
||||||
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
|
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
|
||||||
|
|
||||||
/// suppress compiler warning for unused arguments
|
/// suppress compiler warning for unused arguments
|
||||||
#define UNUSED(x) (void)x;
|
#define UNUSED(x) (void)x;
|
||||||
|
|
||||||
|
|
||||||
#include "impl_defs_top.h"
|
#include "impl_defs_top.h"
|
||||||
#include "impl_defs_nr.h"
|
#include "impl_defs_nr.h"
|
||||||
|
|
||||||
#include "PHY/TOOLS/time_meas.h"
|
#include "PHY/TOOLS/time_meas.h"
|
||||||
#include "PHY/CODING/coding_defs.h"
|
#include "PHY/CODING/coding_defs.h"
|
||||||
#include "PHY/TOOLS/tools_defs.h"
|
#include "PHY/TOOLS/tools_defs.h"
|
||||||
@@ -146,20 +108,14 @@
|
|||||||
#include "NR_UE_TRANSPORT/nr_transport_ue.h"
|
#include "NR_UE_TRANSPORT/nr_transport_ue.h"
|
||||||
|
|
||||||
#if defined(UPGRADE_RAT_NR)
|
#if defined(UPGRADE_RAT_NR)
|
||||||
|
|
||||||
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
|
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "PHY/NR_UE_TRANSPORT/dci_nr.h"
|
#include "PHY/NR_UE_TRANSPORT/dci_nr.h"
|
||||||
//#include "PHY/LTE_TRANSPORT/defs.h"
|
|
||||||
//#include "PHY/NR_UE_TRANSPORT/defs_nr.h"
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "targets/ARCH/COMMON/common_lib.h"
|
#include "targets/ARCH/COMMON/common_lib.h"
|
||||||
|
|
||||||
|
/// Context data structure for gNB subframe processing
|
||||||
/// Context data structure for eNB subframe processing
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// Component Carrier index
|
/// Component Carrier index
|
||||||
uint8_t CC_id;
|
uint8_t CC_id;
|
||||||
@@ -177,9 +133,6 @@ typedef enum {
|
|||||||
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
|
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
//unsigned int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (linear)
|
|
||||||
//unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (dB)
|
|
||||||
//unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //! estimated avg received signal power (dB)
|
|
||||||
|
|
||||||
// RRC measurements
|
// RRC measurements
|
||||||
uint32_t rssi;
|
uint32_t rssi;
|
||||||
@@ -207,59 +160,59 @@ typedef struct {
|
|||||||
|
|
||||||
// UE measurements
|
// UE measurements
|
||||||
//! estimated received spatial signal power (linear)
|
//! estimated received spatial signal power (linear)
|
||||||
int rx_spatial_power[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
|
int rx_spatial_power[NUMBER_OF_CONNECTED_gNB_MAX][2][2];
|
||||||
//! estimated received spatial signal power (dB)
|
//! estimated received spatial signal power (dB)
|
||||||
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
|
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][2][2];
|
||||||
|
|
||||||
/// estimated received signal power (sum over all TX antennas)
|
/// estimated received signal power (sum over all TX antennas)
|
||||||
int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
int rx_power[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||||
/// estimated received signal power (sum over all TX antennas)
|
/// estimated received signal power (sum over all TX antennas)
|
||||||
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||||
|
|
||||||
/// estimated received signal power (sum over all TX/RX antennas)
|
/// estimated received signal power (sum over all TX/RX antennas)
|
||||||
int rx_power_tot[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
|
int rx_power_tot[NUMBER_OF_CONNECTED_gNB_MAX]; //NEW
|
||||||
/// estimated received signal power (sum over all TX/RX antennas)
|
/// estimated received signal power (sum over all TX/RX antennas)
|
||||||
unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
|
unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_gNB_MAX]; //NEW
|
||||||
|
|
||||||
//! estimated received signal power (sum of all TX/RX antennas, time average)
|
//! estimated received signal power (sum of all TX/RX antennas, time average)
|
||||||
int rx_power_avg[NUMBER_OF_CONNECTED_eNB_MAX];
|
int rx_power_avg[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
//! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
|
//! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
|
||||||
unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
|
unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
/// SINR (sum of all TX/RX antennas, in dB)
|
/// SINR (sum of all TX/RX antennas, in dB)
|
||||||
int wideband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX];
|
int wideband_cqi_tot[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
/// SINR (sum of all TX/RX antennas, time average, in dB)
|
/// SINR (sum of all TX/RX antennas, time average, in dB)
|
||||||
int wideband_cqi_avg[NUMBER_OF_CONNECTED_eNB_MAX];
|
int wideband_cqi_avg[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
//! estimated rssi (dBm)
|
//! estimated rssi (dBm)
|
||||||
short rx_rssi_dBm[NUMBER_OF_CONNECTED_eNB_MAX];
|
short rx_rssi_dBm[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
|
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
|
||||||
int rx_correlation[NUMBER_OF_CONNECTED_eNB_MAX][2];
|
int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][2];
|
||||||
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
|
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
|
||||||
int rx_correlation_dB[NUMBER_OF_CONNECTED_eNB_MAX][2];
|
int rx_correlation_dB[NUMBER_OF_CONNECTED_gNB_MAX][2];
|
||||||
|
|
||||||
/// Wideband CQI (sum of all RX antennas, in dB, for precoded transmission modes (3,4,5,6), up to 4 spatial streams)
|
/// Wideband CQI (sum of all RX antennas, in dB, for precoded transmission modes (3,4,5,6), up to 4 spatial streams)
|
||||||
int precoded_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX+1][4];
|
int precoded_cqi_dB[NUMBER_OF_CONNECTED_gNB_MAX+1][4];
|
||||||
/// Subband CQI per RX antenna (= SINR)
|
/// Subband CQI per RX antenna (= SINR)
|
||||||
int subband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
int subband_cqi[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
||||||
/// Total Subband CQI (= SINR)
|
/// Total Subband CQI (= SINR)
|
||||||
int subband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
int subband_cqi_tot[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||||
/// Subband CQI in dB (= SINR dB)
|
/// Subband CQI in dB (= SINR dB)
|
||||||
int subband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
int subband_cqi_dB[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
||||||
/// Total Subband CQI
|
/// Total Subband CQI
|
||||||
int subband_cqi_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
int subband_cqi_tot_dB[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||||
/// Wideband PMI for each RX antenna
|
/// Wideband PMI for each RX antenna
|
||||||
int wideband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
int wideband_pmi_re[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||||
/// Wideband PMI for each RX antenna
|
/// Wideband PMI for each RX antenna
|
||||||
int wideband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
int wideband_pmi_im[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||||
///Subband PMI for each RX antenna
|
///Subband PMI for each RX antenna
|
||||||
int subband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
int subband_pmi_re[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
||||||
///Subband PMI for each RX antenna
|
///Subband PMI for each RX antenna
|
||||||
int subband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
int subband_pmi_im[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
||||||
/// chosen RX antennas (1=Rx antenna 1, 2=Rx antenna 2, 3=both Rx antennas)
|
/// chosen RX antennas (1=Rx antenna 1, 2=Rx antenna 2, 3=both Rx antennas)
|
||||||
unsigned char selected_rx_antennas[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
unsigned char selected_rx_antennas[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||||
/// Wideband Rank indication
|
/// Wideband Rank indication
|
||||||
unsigned char rank[NUMBER_OF_CONNECTED_eNB_MAX];
|
unsigned char rank[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
/// Number of RX Antennas
|
/// Number of RX Antennas
|
||||||
unsigned char nb_antennas_rx;
|
unsigned char nb_antennas_rx;
|
||||||
/// DLSCH error counter
|
/// DLSCH error counter
|
||||||
@@ -379,7 +332,7 @@ typedef struct {
|
|||||||
int32_t **dl_ch_magb1[8][8];
|
int32_t **dl_ch_magb1[8][8];
|
||||||
/// \brief Magnitude of Downlink Channel, first layer (256QAM level).
|
/// \brief Magnitude of Downlink Channel, first layer (256QAM level).
|
||||||
int32_t **dl_ch_magr0;
|
int32_t **dl_ch_magr0;
|
||||||
/// \brief Cross-correlation of two eNB signals.
|
/// \brief Cross-correlation of two gNB signals.
|
||||||
/// - first index: rx antenna [0..nb_antennas_rx[
|
/// - first index: rx antenna [0..nb_antennas_rx[
|
||||||
/// - second index: symbol [0..]
|
/// - second index: symbol [0..]
|
||||||
int32_t **rho;
|
int32_t **rho;
|
||||||
@@ -647,11 +600,11 @@ typedef struct {
|
|||||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||||
/// - second index: ? [0..168*N_RB_DL[
|
/// - second index: ? [0..168*N_RB_DL[
|
||||||
int32_t **dl_ch_estimates_ext;
|
int32_t **dl_ch_estimates_ext;
|
||||||
/// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
|
/// \brief Pointers to channel cross-correlation vectors for multi-gNB detection.
|
||||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||||
/// - second index: ? [0..168*N_RB_DL[
|
/// - second index: ? [0..168*N_RB_DL[
|
||||||
int32_t **dl_ch_rho_ext;
|
int32_t **dl_ch_rho_ext;
|
||||||
/// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
|
/// \brief Pointers to channel cross-correlation vectors for multi-gNB detection.
|
||||||
/// - first index: rx antenna [0..nb_antennas_rx[
|
/// - first index: rx antenna [0..nb_antennas_rx[
|
||||||
/// - second index: ? [0..]
|
/// - second index: ? [0..]
|
||||||
int32_t **rho;
|
int32_t **rho;
|
||||||
@@ -748,7 +701,6 @@ typedef struct {
|
|||||||
int16_t *prachF;
|
int16_t *prachF;
|
||||||
int16_t *prach;
|
int16_t *prach;
|
||||||
fapi_nr_ul_config_prach_pdu prach_pdu;
|
fapi_nr_ul_config_prach_pdu prach_pdu;
|
||||||
uint8_t prach_Config_enabled;
|
|
||||||
} NR_UE_PRACH;
|
} NR_UE_PRACH;
|
||||||
|
|
||||||
// structure used for multiple SSB detection
|
// structure used for multiple SSB detection
|
||||||
@@ -785,7 +737,7 @@ typedef struct NR_UL_TIME_ALIGNMENT {
|
|||||||
int16_t ta_frame;
|
int16_t ta_frame;
|
||||||
char ta_slot;
|
char ta_slot;
|
||||||
/// TA command and TAGID received from the gNB
|
/// TA command and TAGID received from the gNB
|
||||||
uint8_t ta_command;
|
uint16_t ta_command;
|
||||||
uint8_t tag_id;
|
uint8_t tag_id;
|
||||||
} NR_UL_TIME_ALIGNMENT_t;
|
} NR_UL_TIME_ALIGNMENT_t;
|
||||||
|
|
||||||
@@ -832,8 +784,8 @@ typedef struct {
|
|||||||
int tx_total_RE[NR_MAX_SLOTS_PER_FRAME];
|
int tx_total_RE[NR_MAX_SLOTS_PER_FRAME];
|
||||||
/// \brief Maximum transmit power
|
/// \brief Maximum transmit power
|
||||||
int8_t tx_power_max_dBm;
|
int8_t tx_power_max_dBm;
|
||||||
/// \brief Number of eNB seen by UE
|
/// \brief Number of gNB seen by UE
|
||||||
uint8_t n_connected_eNB;
|
uint8_t n_connected_gNB;
|
||||||
/// \brief indicator that Handover procedure has been initiated
|
/// \brief indicator that Handover procedure has been initiated
|
||||||
uint8_t ho_initiated;
|
uint8_t ho_initiated;
|
||||||
/// \brief indicator that Handover procedure has been triggered
|
/// \brief indicator that Handover procedure has been triggered
|
||||||
@@ -849,33 +801,18 @@ typedef struct {
|
|||||||
|
|
||||||
fapi_nr_config_request_t nrUE_config;
|
fapi_nr_config_request_t nrUE_config;
|
||||||
|
|
||||||
// the following structures are not part of PHY_vars_UE anymore as it is not thread safe. They are now on the stack of the functions that actually need them
|
|
||||||
|
|
||||||
//nr_downlink_indication_t dl_indication;
|
|
||||||
//nr_uplink_indication_t ul_indication;
|
|
||||||
/// UE FAPI DCI request
|
|
||||||
//nr_dcireq_t dcireq;
|
|
||||||
|
|
||||||
// pointers to the next 2 strcutres are also included in dl_indictation
|
|
||||||
/// UE FAPI indication for DLSCH reception
|
|
||||||
//fapi_nr_rx_indication_t rx_ind;
|
|
||||||
/// UE FAPI indication for DCI reception
|
|
||||||
//fapi_nr_dci_indication_t dci_ind;
|
|
||||||
|
|
||||||
t_nrPolar_params *polarList;
|
t_nrPolar_params *polarList;
|
||||||
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads
|
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX+1]; // two RxTx Threads
|
||||||
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads
|
NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads
|
||||||
NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words
|
NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words
|
||||||
NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_eNB_MAX];
|
NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
// This is for SIC in the UE, to store the reencoded data
|
|
||||||
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_CONNECTED_eNB_MAX];
|
|
||||||
|
|
||||||
//Paging parameters
|
//Paging parameters
|
||||||
uint32_t IMSImod1024;
|
uint32_t IMSImod1024;
|
||||||
@@ -916,52 +853,47 @@ typedef struct {
|
|||||||
uint32_t high_speed_flag;
|
uint32_t high_speed_flag;
|
||||||
uint32_t perfect_ce;
|
uint32_t perfect_ce;
|
||||||
int16_t ch_est_alpha;
|
int16_t ch_est_alpha;
|
||||||
int generate_ul_signal[NUMBER_OF_CONNECTED_eNB_MAX];
|
int generate_ul_signal[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
UE_NR_SCAN_INFO_t scan_info[NB_BANDS_MAX];
|
UE_NR_SCAN_INFO_t scan_info[NB_BANDS_MAX];
|
||||||
|
|
||||||
char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_eNB_MAX];
|
char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
unsigned char ulsch_Msg3_active[NUMBER_OF_CONNECTED_gNB_MAX];
|
|
||||||
|
|
||||||
NR_PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_gNB_MAX];
|
NR_PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int turbo_iterations, turbo_cntl_iterations;
|
int turbo_iterations, turbo_cntl_iterations;
|
||||||
/// \brief ?.
|
/// \brief ?.
|
||||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||||
uint32_t total_TBS[NUMBER_OF_CONNECTED_eNB_MAX];
|
uint32_t total_TBS[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
/// \brief ?.
|
/// \brief ?.
|
||||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||||
uint32_t total_TBS_last[NUMBER_OF_CONNECTED_eNB_MAX];
|
uint32_t total_TBS_last[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
/// \brief ?.
|
/// \brief ?.
|
||||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||||
uint32_t bitrate[NUMBER_OF_CONNECTED_eNB_MAX];
|
uint32_t bitrate[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
/// \brief ?.
|
/// \brief ?.
|
||||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||||
uint32_t total_received_bits[NUMBER_OF_CONNECTED_eNB_MAX];
|
uint32_t total_received_bits[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_errors_last[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_errors_last[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_received_last[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_received_last[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_fer[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_fer[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_SI_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_SI_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_SI_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_SI_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_ra_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_ra_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_ra_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_ra_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_p_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_p_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_p_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_p_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mch_received_sf[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mch_received_sf[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mch_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mch_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mcch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mcch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mtch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mtch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mcch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mcch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mtch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mtch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
int current_dlsch_cqi[NUMBER_OF_CONNECTED_eNB_MAX];
|
int current_dlsch_cqi[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_eNB_MAX];
|
unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
uint8_t prach_cnt;
|
|
||||||
uint8_t prach_PreambleIndex;
|
|
||||||
// uint8_t prach_timer;
|
|
||||||
uint8_t decode_SIB;
|
uint8_t decode_SIB;
|
||||||
uint8_t decode_MIB;
|
uint8_t decode_MIB;
|
||||||
uint8_t init_sync_frame;
|
uint8_t init_sync_frame;
|
||||||
@@ -980,9 +912,9 @@ typedef struct {
|
|||||||
|
|
||||||
/// Flag to tell if UE is secondary user (cognitive mode)
|
/// Flag to tell if UE is secondary user (cognitive mode)
|
||||||
unsigned char is_secondary_ue;
|
unsigned char is_secondary_ue;
|
||||||
/// Flag to tell if secondary eNB has channel estimates to create NULL-beams from.
|
/// Flag to tell if secondary gNB has channel estimates to create NULL-beams from.
|
||||||
unsigned char has_valid_precoder;
|
unsigned char has_valid_precoder;
|
||||||
/// hold the precoder for NULL beam to the primary eNB
|
/// hold the precoder for NULL beam to the primary gNB
|
||||||
int **ul_precoder_S_UE;
|
int **ul_precoder_S_UE;
|
||||||
/// holds the maximum channel/precoder coefficient
|
/// holds the maximum channel/precoder coefficient
|
||||||
char log2_maxp;
|
char log2_maxp;
|
||||||
@@ -1008,17 +940,17 @@ typedef struct {
|
|||||||
double N0;
|
double N0;
|
||||||
|
|
||||||
/// PDSCH Varaibles
|
/// PDSCH Varaibles
|
||||||
PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
/// PUSCH Varaibles
|
/// PUSCH Varaibles
|
||||||
PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
/// PUSCH contention-based access vars
|
/// PUSCH contention-based access vars
|
||||||
PUSCH_CA_CONFIG_DEDICATED pusch_ca_config_dedicated[NUMBER_OF_eNB_MAX]; // lola
|
PUSCH_CA_CONFIG_DEDICATED pusch_ca_config_dedicated[NUMBER_OF_eNB_MAX]; // lola
|
||||||
|
|
||||||
/// PUCCH variables
|
/// PUCCH variables
|
||||||
|
|
||||||
PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
//#if defined(UPGRADE_RAT_NR)
|
//#if defined(UPGRADE_RAT_NR)
|
||||||
#if 1
|
#if 1
|
||||||
@@ -1029,8 +961,8 @@ typedef struct {
|
|||||||
PDSCH_ServingCellConfig_t PDSCH_ServingCellConfig;
|
PDSCH_ServingCellConfig_t PDSCH_ServingCellConfig;
|
||||||
PDSCH_Config_t PDSCH_Config;
|
PDSCH_Config_t PDSCH_Config;
|
||||||
|
|
||||||
PUCCH_ConfigCommon_nr_t pucch_config_common_nr[NUMBER_OF_CONNECTED_eNB_MAX];
|
PUCCH_ConfigCommon_nr_t pucch_config_common_nr[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
PUCCH_Config_t pucch_config_dedicated_nr[NUMBER_OF_CONNECTED_eNB_MAX];
|
PUCCH_Config_t pucch_config_dedicated_nr[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
PUSCH_Config_t pusch_config;
|
PUSCH_Config_t pusch_config;
|
||||||
SRS_NR srs;
|
SRS_NR srs;
|
||||||
@@ -1046,29 +978,29 @@ typedef struct {
|
|||||||
uint8_t ncs_cell[20][7];
|
uint8_t ncs_cell[20][7];
|
||||||
|
|
||||||
/// UL-POWER-Control
|
/// UL-POWER-Control
|
||||||
UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
/// TPC
|
/// TPC
|
||||||
TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_CONNECTED_eNB_MAX];
|
TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_CONNECTED_eNB_MAX];
|
TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
/// CQI reporting
|
/// CQI reporting
|
||||||
CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_CONNECTED_eNB_MAX];
|
CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
/// SRS Variables
|
/// SRS Variables
|
||||||
SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
/// Scheduling Request Config
|
/// Scheduling Request Config
|
||||||
SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_CONNECTED_eNB_MAX];
|
SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
//#if defined(UPGRADE_RAT_NR)
|
//#if defined(UPGRADE_RAT_NR)
|
||||||
#if 1
|
#if 1
|
||||||
scheduling_request_config_t scheduling_request_config_nr[NUMBER_OF_CONNECTED_eNB_MAX];
|
scheduling_request_config_t scheduling_request_config_nr[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Transmission mode per eNB
|
/// Transmission mode per gNB
|
||||||
uint8_t transmission_mode[NUMBER_OF_CONNECTED_eNB_MAX];
|
uint8_t transmission_mode[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
|
|
||||||
time_stats_t phy_proc[RX_NB_TH];
|
time_stats_t phy_proc[RX_NB_TH];
|
||||||
time_stats_t phy_proc_tx;
|
time_stats_t phy_proc_tx;
|
||||||
@@ -1137,7 +1069,6 @@ typedef struct {
|
|||||||
|
|
||||||
} PHY_VARS_NR_UE;
|
} PHY_VARS_NR_UE;
|
||||||
|
|
||||||
|
|
||||||
/* this structure is used to pass both UE phy vars and
|
/* this structure is used to pass both UE phy vars and
|
||||||
* proc to the function UE_thread_rxn_txnp4
|
* proc to the function UE_thread_rxn_txnp4
|
||||||
*/
|
*/
|
||||||
@@ -1146,76 +1077,5 @@ typedef struct nr_rxtx_thread_data_s {
|
|||||||
PHY_VARS_NR_UE *UE;
|
PHY_VARS_NR_UE *UE;
|
||||||
} nr_rxtx_thread_data_t;
|
} nr_rxtx_thread_data_t;
|
||||||
|
|
||||||
/*static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
|
|
||||||
|
|
||||||
if (pthread_mutex_lock(mutex) != 0) {
|
|
||||||
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
|
|
||||||
exit_fun("nothing to add");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*instance_cnt < 0) {
|
|
||||||
// most of the time the thread is waiting here
|
|
||||||
// proc->instance_cnt_rxtx is -1
|
|
||||||
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pthread_mutex_unlock(mutex) != 0) {
|
|
||||||
LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name);
|
|
||||||
exit_fun("nothing to add");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int wait_on_busy_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
|
|
||||||
|
|
||||||
if (pthread_mutex_lock(mutex) != 0) {
|
|
||||||
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
|
|
||||||
exit_fun("nothing to add");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*instance_cnt == 0) {
|
|
||||||
// most of the time the thread will skip this
|
|
||||||
// waits only if proc->instance_cnt_rxtx is 0
|
|
||||||
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pthread_mutex_unlock(mutex) != 0) {
|
|
||||||
LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name);
|
|
||||||
exit_fun("nothing to add");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *name) {
|
|
||||||
|
|
||||||
if (pthread_mutex_lock(mutex) != 0) {
|
|
||||||
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
|
|
||||||
exit_fun("nothing to add");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
*instance_cnt=*instance_cnt-1;
|
|
||||||
|
|
||||||
if (pthread_mutex_unlock(mutex) != 0) {
|
|
||||||
LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for %s\n",name);
|
|
||||||
exit_fun("nothing to add");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include "PHY/INIT/defs.h"
|
|
||||||
#include "PHY/LTE_REFSIG/defs.h"
|
|
||||||
#include "PHY/MODULATION/defs.h"
|
|
||||||
#include "PHY/LTE_TRANSPORT/proto.h"
|
|
||||||
#include "PHY/LTE_ESTIMATION/defs.h"
|
|
||||||
*/
|
|
||||||
#include "SIMULATION/ETH_TRANSPORT/defs.h"
|
#include "SIMULATION/ETH_TRANSPORT/defs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
#define NR_MAX_NUM_BWP 4
|
#define NR_MAX_NUM_BWP 4
|
||||||
|
|
||||||
#define NR_MAX_PDCCH_AGG_LEVEL 16
|
#define NR_MAX_PDCCH_AGG_LEVEL 16 // 3GPP TS 38.211 V15.8 Section 7.3.2 Table 7.3.2.1-1: Supported PDCCH aggregation levels
|
||||||
#define NR_MAX_CSET_DURATION 3
|
#define NR_MAX_CSET_DURATION 3
|
||||||
|
|
||||||
#define NR_MAX_NB_RBG 18
|
#define NR_MAX_NB_RBG 18
|
||||||
@@ -150,6 +150,11 @@ typedef enum {
|
|||||||
MOD_QAM256
|
MOD_QAM256
|
||||||
}nr_mod_t;
|
}nr_mod_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RA_2STEP = 0,
|
||||||
|
RA_4STEP
|
||||||
|
} nr_ra_type_e;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// Size of first RBG
|
/// Size of first RBG
|
||||||
uint8_t start_size;
|
uint8_t start_size;
|
||||||
@@ -205,8 +210,12 @@ typedef struct {
|
|||||||
uint16_t prach_format;
|
uint16_t prach_format;
|
||||||
/// Preamble index for PRACH (0-63)
|
/// Preamble index for PRACH (0-63)
|
||||||
uint8_t ra_PreambleIndex;
|
uint8_t ra_PreambleIndex;
|
||||||
/// RACH MaskIndex
|
/// Preamble Tx Counter
|
||||||
uint8_t ra_RACH_MaskIndex;
|
uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER;
|
||||||
|
/// Preamble Power Ramping Counter
|
||||||
|
uint8_t RA_PREAMBLE_POWER_RAMPING_COUNTER;
|
||||||
|
/// 2-step RA power offset
|
||||||
|
int POWER_OFFSET_2STEP_RA;
|
||||||
/// Target received power at gNB. Baseline is range -202..-60 dBm. Depends on delta preamble, power ramping counter and step.
|
/// Target received power at gNB. Baseline is range -202..-60 dBm. Depends on delta preamble, power ramping counter and step.
|
||||||
int ra_PREAMBLE_RECEIVED_TARGET_POWER;
|
int ra_PREAMBLE_RECEIVED_TARGET_POWER;
|
||||||
/// PRACH index for TDD (0 ... 6) depending on TDD configuration and prachConfigIndex
|
/// PRACH index for TDD (0 ... 6) depending on TDD configuration and prachConfigIndex
|
||||||
@@ -217,8 +226,10 @@ typedef struct {
|
|||||||
uint8_t RA_PREAMBLE_BACKOFF;
|
uint8_t RA_PREAMBLE_BACKOFF;
|
||||||
///
|
///
|
||||||
uint8_t RA_SCALING_FACTOR_BI;
|
uint8_t RA_SCALING_FACTOR_BI;
|
||||||
///
|
/// Indicating whether it is 2-step or 4-step RA
|
||||||
uint8_t RA_PCMAX;
|
nr_ra_type_e RA_TYPE;
|
||||||
|
/// UE configured maximum output power
|
||||||
|
int RA_PCMAX;
|
||||||
/// Corresponding RA-RNTI for UL-grant
|
/// Corresponding RA-RNTI for UL-grant
|
||||||
uint16_t ra_RNTI;
|
uint16_t ra_RNTI;
|
||||||
/// Pointer to Msg3 payload for UL-grant
|
/// Pointer to Msg3 payload for UL-grant
|
||||||
|
|||||||
@@ -25,6 +25,11 @@
|
|||||||
#include "PHY/defs_nr_UE.h"
|
#include "PHY/defs_nr_UE.h"
|
||||||
//#include "common/ran_context.h"
|
//#include "common/ran_context.h"
|
||||||
|
|
||||||
|
#ifdef XFORMS
|
||||||
|
#include "PHY/TOOLS/nr_phy_scope.h"
|
||||||
|
extern char do_forms;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char* namepointer_chMag ;
|
extern char* namepointer_chMag ;
|
||||||
extern char* namepointer_log2;
|
extern char* namepointer_log2;
|
||||||
extern char fmageren_name2[512];
|
extern char fmageren_name2[512];
|
||||||
@@ -109,5 +114,8 @@ extern unsigned short Nb_81_110[8][4];
|
|||||||
extern uint16_t hundred_times_log10_NPRB[100];
|
extern uint16_t hundred_times_log10_NPRB[100];
|
||||||
extern uint8_t alpha_lut[8];
|
extern uint8_t alpha_lut[8];
|
||||||
extern uint8_t max_turbo_iterations;
|
extern uint8_t max_turbo_iterations;
|
||||||
|
|
||||||
|
extern double cpuf;
|
||||||
|
|
||||||
#endif /*__PHY_EXTERN_H__ */
|
#endif /*__PHY_EXTERN_H__ */
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PHY/defs_eNB.h"
|
#include "PHY/defs_eNB.h"
|
||||||
|
#include "PHY/defs_gNB.h"
|
||||||
#include "PHY/phy_extern.h"
|
#include "PHY/phy_extern.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||||
#include "SCHED/sched_eNB.h"
|
#include "SCHED/sched_eNB.h"
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
//Dummy NR defs to avoid linking errors
|
||||||
|
|
||||||
|
#include "PHY/defs_gNB.h"
|
||||||
|
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
|
||||||
|
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||||
|
#include "openair1/PHY/LTE_TRANSPORT/transport_common.h"
|
||||||
|
|
||||||
|
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||||
|
int frame, int slot,
|
||||||
|
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu){}
|
||||||
|
|
||||||
|
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||||
|
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
|
||||||
|
|
||||||
|
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
|
||||||
|
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||||
|
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||||
|
uint8_t *sdu){
|
||||||
|
}
|
||||||
|
int l1_north_init_gNB(void){return 0;}
|
||||||
|
|
||||||
|
uint8_t slot_ahead=6;
|
||||||
|
//uint8_t nfapi_mode=0;
|
||||||
|
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;}
|
||||||
|
|
||||||
|
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||||
|
int frame, int slot,
|
||||||
|
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu){}
|
||||||
|
void nr_fill_ulsch(PHY_VARS_gNB *gNB,
|
||||||
|
int frame,
|
||||||
|
int slot,
|
||||||
|
nfapi_nr_pusch_pdu_t *ulsch_pdu){}
|
||||||
|
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||||
|
int frame,
|
||||||
|
int slot,
|
||||||
|
nfapi_nr_pucch_pdu_t *pucch_pdu){}
|
||||||
|
void nr_fill_prach(PHY_VARS_gNB *gNB,
|
||||||
|
int SFN,
|
||||||
|
int Slot,
|
||||||
|
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||||
|
void nr_fill_prach_ru(RU_t *ru,
|
||||||
|
int SFN,
|
||||||
|
int Slot,
|
||||||
|
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||||
|
|
||||||
|
void nr_phy_config_request(NR_PHY_Config_t *gNB){}
|
||||||
|
|
||||||
|
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst){}
|
||||||
|
|
||||||
|
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp){}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
//Dummy NR defs to avoid linking errors
|
||||||
|
|
||||||
|
#include "PHY/defs_gNB.h"
|
||||||
|
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
|
||||||
|
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||||
|
#include "openair1/PHY/LTE_TRANSPORT/transport_common.h"
|
||||||
|
|
||||||
|
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||||
|
int frame, int slot,
|
||||||
|
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu){}
|
||||||
|
|
||||||
|
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||||
|
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
|
||||||
|
|
||||||
|
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
|
||||||
|
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||||
|
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||||
|
uint8_t *sdu){
|
||||||
|
}
|
||||||
|
int l1_north_init_gNB(void){return 0;}
|
||||||
|
|
||||||
|
uint8_t slot_ahead=6;
|
||||||
|
//uint8_t nfapi_mode=0;
|
||||||
|
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;}
|
||||||
|
|
||||||
|
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||||
|
int frame, int slot,
|
||||||
|
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu){}
|
||||||
|
void nr_fill_ulsch(PHY_VARS_gNB *gNB,
|
||||||
|
int frame,
|
||||||
|
int slot,
|
||||||
|
nfapi_nr_pusch_pdu_t *ulsch_pdu){}
|
||||||
|
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||||
|
int frame,
|
||||||
|
int slot,
|
||||||
|
nfapi_nr_pucch_pdu_t *pucch_pdu){}
|
||||||
|
void nr_fill_prach(PHY_VARS_gNB *gNB,
|
||||||
|
int SFN,
|
||||||
|
int Slot,
|
||||||
|
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||||
|
void nr_fill_prach_ru(RU_t *ru,
|
||||||
|
int SFN,
|
||||||
|
int Slot,
|
||||||
|
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||||
|
|
||||||
|
void nr_phy_config_request(NR_PHY_Config_t *gNB){}
|
||||||
|
|
||||||
|
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst){}
|
||||||
|
|
||||||
|
//void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp){}
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +33,12 @@
|
|||||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||||
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
|
||||||
|
extern int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
|
||||||
|
extern int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
|
||||||
|
extern int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
|
||||||
|
extern int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
|
||||||
|
|
||||||
|
|
||||||
extern uint8_t nfapi_mode;
|
extern uint8_t nfapi_mode;
|
||||||
@@ -126,7 +132,7 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||||
|
|
||||||
PHY_VARS_gNB *gNB;
|
PHY_VARS_gNB *gNB;
|
||||||
// copy data from L2 interface into L1 structures
|
// copy data from L2 interface into L1 structures
|
||||||
module_id_t Mod_id = Sched_INFO->module_id;
|
module_id_t Mod_id = Sched_INFO->module_id;
|
||||||
@@ -169,6 +175,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
|||||||
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
|
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
|
||||||
gNB->pbch_configured=1;
|
gNB->pbch_configured=1;
|
||||||
|
|
||||||
|
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||||
handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
|
handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
|
||||||
dl_tti_pdu);
|
dl_tti_pdu);
|
||||||
|
|
||||||
@@ -176,7 +183,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
|||||||
|
|
||||||
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
|
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
|
||||||
AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
|
AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
|
||||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
|
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||||
handle_nfapi_nr_pdcch_pdu(gNB,
|
handle_nfapi_nr_pdcch_pdu(gNB,
|
||||||
frame, slot,
|
frame, slot,
|
||||||
&dl_tti_pdu->pdcch_pdu);
|
&dl_tti_pdu->pdcch_pdu);
|
||||||
@@ -193,33 +200,61 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
|||||||
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
|
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
|
||||||
pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
|
pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
|
||||||
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
|
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
|
||||||
|
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||||
handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
|
handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t));
|
// if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t));
|
||||||
|
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||||
|
for (int i=0;i<number_ul_dci_pdu;i++) {
|
||||||
|
handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||||
|
for (int i = 0; i < number_ul_tti_pdu; i++) {
|
||||||
|
switch (UL_tti_req->pdus_list[i].pdu_type) {
|
||||||
|
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
|
||||||
|
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||||
|
nr_fill_ulsch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pusch_pdu);
|
||||||
|
break;
|
||||||
|
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
||||||
|
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUCCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||||
|
nr_fill_pucch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pucch_pdu);
|
||||||
|
break;
|
||||||
|
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
|
||||||
|
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||||
|
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
|
||||||
|
nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||||
|
if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(NFAPI_MODE != NFAPI_MONOLITHIC && number_ul_tti_pdu>0)
|
||||||
|
{
|
||||||
|
oai_nfapi_ul_tti_req(UL_tti_req);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0;i<number_ul_dci_pdu;i++) {
|
if (NFAPI_MODE != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0)
|
||||||
handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]);
|
{
|
||||||
|
oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NFAPI_MODE != NFAPI_MONOLITHIC)
|
||||||
|
{
|
||||||
|
if(Sched_INFO->DL_req->dl_tti_request_body.nPDUs>0)
|
||||||
|
{
|
||||||
|
Sched_INFO->DL_req->SFN = frame;
|
||||||
|
Sched_INFO->DL_req->Slot = slot;
|
||||||
|
oai_nfapi_dl_tti_req(Sched_INFO->DL_req);
|
||||||
|
}
|
||||||
|
if (Sched_INFO->TX_req->Number_of_PDUs > 0)
|
||||||
|
{
|
||||||
|
oai_nfapi_tx_data_req(Sched_INFO->TX_req);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < number_ul_tti_pdu; i++) {
|
}
|
||||||
switch (UL_tti_req->pdus_list[i].pdu_type) {
|
|
||||||
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
|
|
||||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
|
||||||
nr_fill_ulsch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pusch_pdu);
|
|
||||||
break;
|
|
||||||
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
|
||||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUCCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
|
||||||
nr_fill_pucch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pucch_pdu);
|
|
||||||
break;
|
|
||||||
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
|
|
||||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
|
||||||
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
|
|
||||||
nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
|
||||||
if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -36,6 +36,11 @@
|
|||||||
#include "nfapi_nr_interface.h"
|
#include "nfapi_nr_interface.h"
|
||||||
#include "nfapi_nr_interface_scf.h"
|
#include "nfapi_nr_interface_scf.h"
|
||||||
|
|
||||||
|
// added
|
||||||
|
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,
|
||||||
|
int frame,int slot,
|
||||||
|
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu);
|
||||||
|
|
||||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO);
|
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO);
|
||||||
|
|
||||||
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||||
@@ -48,3 +53,8 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
|||||||
|
|
||||||
|
|
||||||
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t harq_pid, uint8_t crc_flag);
|
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t harq_pid, uint8_t crc_flag);
|
||||||
|
//added
|
||||||
|
|
||||||
|
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||||
|
int frame, int slot,
|
||||||
|
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
|
||||||
if (nfapi_mode == 0 || nfapi_mode == 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
|
if ((!(frame%ssb_frame_periodicity))) // generate SSB only for given frames according to SSB periodicity
|
||||||
nr_common_signal_procedures(gNB,frame, slot);
|
nr_common_signal_procedures(gNB,frame, slot);
|
||||||
}
|
}
|
||||||
@@ -201,10 +201,10 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
|||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
|
||||||
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot);
|
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot);
|
||||||
nr_generate_pdsch(gNB,frame, slot);
|
nr_generate_pdsch(gNB,frame, slot);
|
||||||
if ((frame&127) == 0) dump_pdsch_stats(gNB);
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((frame&127) == 0) dump_pdsch_stats(gNB);
|
||||||
|
|
||||||
//apply the OFDM symbol rotation here
|
//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);
|
apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[0][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14,fp->ofdm_symbol_size);
|
||||||
|
|||||||
+31
-13
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
\brief NR UE PHY functions prototypes
|
||||||
\author R. Knopp, F. Kaltenberger
|
\author R. Knopp, F. Kaltenberger
|
||||||
\company EURECOM
|
\company EURECOM
|
||||||
\email knopp@eurecom.fr
|
\email knopp@eurecom.fr
|
||||||
@@ -113,16 +114,14 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
|||||||
@param ue Pointer to UE variables on which to act
|
@param ue Pointer to UE variables on which to act
|
||||||
@param proc Pointer to proc information
|
@param proc Pointer to proc information
|
||||||
@param gNB_id Local id of eNB on which to act
|
@param gNB_id Local id of eNB on which to act
|
||||||
@param mode calibration/debug mode
|
|
||||||
@param dlsch_parallel use multithreaded dlsch processing
|
@param dlsch_parallel use multithreaded dlsch processing
|
||||||
*/
|
*/
|
||||||
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
runmode_t mode,
|
|
||||||
uint8_t dlsch_parallel);
|
uint8_t dlsch_parallel);
|
||||||
|
|
||||||
int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type);
|
int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id, uint8_t abstraction_flag, uint8_t do_pdcch_flag, relaying_type_t r_type);
|
||||||
|
|
||||||
|
|
||||||
#ifdef UE_SLOT_PARALLELISATION
|
#ifdef UE_SLOT_PARALLELISATION
|
||||||
@@ -223,7 +222,7 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
|||||||
@param
|
@param
|
||||||
@param
|
@param
|
||||||
*/
|
*/
|
||||||
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, runmode_t mode);
|
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id);
|
||||||
|
|
||||||
int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe);
|
int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe);
|
||||||
|
|
||||||
@@ -305,15 +304,6 @@ int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
|
|||||||
*/
|
*/
|
||||||
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx);
|
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx);
|
||||||
|
|
||||||
/*! \brief Compute the timing adjustment at UE side from the old TA offset and the new received TA command
|
|
||||||
@param Mod_id Local UE index on which to act
|
|
||||||
@param CC_id Component Carrier Index
|
|
||||||
@param ta_command TA command received from the network
|
|
||||||
@param mu numerology index (0,1,2..)
|
|
||||||
*/
|
|
||||||
void nr_process_timing_advance(module_id_t Mod_id,uint8_t CC_id,uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB);
|
|
||||||
void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, int frame_rx, int nr_slot_rx, uint16_t ta_command);
|
|
||||||
|
|
||||||
unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
|
unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
|
||||||
|
|
||||||
void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
||||||
@@ -347,6 +337,8 @@ uint16_t nr_get_n1_pucch(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
*/
|
*/
|
||||||
UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_index);
|
UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_index);
|
||||||
|
|
||||||
|
uint8_t get_ra_PreambleIndex(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_id);
|
||||||
|
|
||||||
/*! \brief This function implements the power control mechanism for PUCCH from 36.213.
|
/*! \brief This function implements the power control mechanism for PUCCH from 36.213.
|
||||||
@param phy_vars_ue PHY variables
|
@param phy_vars_ue PHY variables
|
||||||
@param proc Pointer to proc descriptor
|
@param proc Pointer to proc descriptor
|
||||||
@@ -396,8 +388,34 @@ int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
|
|||||||
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||||
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||||
|
|
||||||
|
/*! \brief This function prepares the dl indication to pass to the MAC
|
||||||
|
@param
|
||||||
|
@param
|
||||||
|
@param
|
||||||
|
@param
|
||||||
|
*/
|
||||||
|
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
|
||||||
|
fapi_nr_dci_indication_t *dci_ind,
|
||||||
|
fapi_nr_rx_indication_t *rx_ind,
|
||||||
|
UE_nr_rxtx_proc_t *proc,
|
||||||
|
PHY_VARS_NR_UE *ue,
|
||||||
|
uint8_t gNB_id);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
/*! \brief This function prepares the dl rx indication
|
||||||
|
@param
|
||||||
|
@param
|
||||||
|
@param
|
||||||
|
@param
|
||||||
|
*/
|
||||||
|
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||||
|
uint8_t pdu_type,
|
||||||
|
uint8_t gNB_id,
|
||||||
|
PHY_VARS_NR_UE *ue,
|
||||||
|
NR_UE_DLSCH_t *dlsch0,
|
||||||
|
uint16_t n_pdus);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,9 @@
|
|||||||
|
|
||||||
extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
|
extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
|
||||||
|
|
||||||
|
const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH"};
|
||||||
|
const char *ul_pdu_type[]={"PRACH", "PUCCH", "PUSCH", "SRS"};
|
||||||
|
|
||||||
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||||
|
|
||||||
if(scheduled_response != NULL){
|
if(scheduled_response != NULL){
|
||||||
@@ -61,14 +64,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
if(scheduled_response->dl_config != NULL){
|
if(scheduled_response->dl_config != NULL){
|
||||||
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
|
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
|
||||||
|
|
||||||
LOG_D(PHY,"Received %d DL pdus:\n",dl_config->number_pdus);
|
|
||||||
pdcch_vars->nb_search_space = 0;
|
pdcch_vars->nb_search_space = 0;
|
||||||
|
|
||||||
for (i = 0; i < dl_config->number_pdus; ++i){
|
for (i = 0; i < dl_config->number_pdus; ++i){
|
||||||
|
|
||||||
|
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) {
|
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
|
||||||
|
|
||||||
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DCI\n");
|
|
||||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
|
fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
|
||||||
memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
|
memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
|
||||||
pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
|
pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
|
||||||
@@ -77,11 +80,9 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){
|
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){
|
||||||
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DLSCH\n");
|
|
||||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
|
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
|
||||||
}
|
}
|
||||||
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
|
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
|
||||||
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH\n");
|
|
||||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
|
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
|
||||||
}
|
}
|
||||||
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){
|
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){
|
||||||
@@ -146,6 +147,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
|
|
||||||
for (i = 0; i < ul_config->number_pdus; ++i){
|
for (i = 0; i < ul_config->number_pdus; ++i){
|
||||||
|
|
||||||
|
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;
|
uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type, pucch_resource_id, current_harq_pid, format, gNB_id = 0;
|
||||||
/* PRACH */
|
/* PRACH */
|
||||||
//NR_PRACH_RESOURCES_t *prach_resources;
|
//NR_PRACH_RESOURCES_t *prach_resources;
|
||||||
@@ -241,14 +244,15 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
// prach config pdu
|
// prach config pdu
|
||||||
prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
|
prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
|
||||||
memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu));
|
memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu));
|
||||||
PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_Config_enabled = 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ul_config->number_pdus = 0;
|
|
||||||
|
memset(ul_config, 0, sizeof(fapi_nr_ul_config_request_t));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
|||||||
|
|
||||||
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
|
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
|
||||||
if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
|
if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
|
||||||
ulsch->harq_processes[harq_pid]->first_tx = 0;
|
ulsch->harq_processes[harq_pid]->first_tx = 0;
|
||||||
ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */
|
ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */
|
||||||
ulsch->harq_processes[harq_pid]->round = 0;
|
ulsch->harq_processes[harq_pid]->round = 0;
|
||||||
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
|
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
|
||||||
|
|||||||
@@ -77,23 +77,83 @@ fifo_dump_emos_UE emos_dump_UE;
|
|||||||
#include "intertask_interface.h"
|
#include "intertask_interface.h"
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
|
||||||
#define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs)
|
|
||||||
#define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs)
|
|
||||||
|
|
||||||
#define NS_PER_SLOT 500000
|
|
||||||
|
|
||||||
char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
|
char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
|
||||||
|
|
||||||
const uint8_t nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
const uint8_t nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||||
|
|
||||||
extern double cpuf;
|
|
||||||
|
|
||||||
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
|
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
|
||||||
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
|
unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
|
||||||
|
|
||||||
|
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
|
||||||
|
fapi_nr_dci_indication_t *dci_ind,
|
||||||
|
fapi_nr_rx_indication_t *rx_ind,
|
||||||
|
UE_nr_rxtx_proc_t *proc,
|
||||||
|
PHY_VARS_NR_UE *ue,
|
||||||
|
uint8_t gNB_id){
|
||||||
|
|
||||||
|
memset((void*)dl_ind, 0, sizeof(nr_downlink_indication_t));
|
||||||
|
|
||||||
|
dl_ind->gNB_index = gNB_id;
|
||||||
|
dl_ind->module_id = ue->Mod_id;
|
||||||
|
dl_ind->cc_id = ue->CC_id;
|
||||||
|
dl_ind->frame = proc->frame_rx;
|
||||||
|
dl_ind->slot = proc->nr_slot_rx;
|
||||||
|
dl_ind->thread_id = proc->thread_id;
|
||||||
|
|
||||||
|
if (dci_ind) {
|
||||||
|
|
||||||
|
dl_ind->rx_ind = NULL; //no data, only dci for now
|
||||||
|
dl_ind->dci_ind = dci_ind;
|
||||||
|
|
||||||
|
} else if (rx_ind) {
|
||||||
|
|
||||||
|
dl_ind->rx_ind = rx_ind; // hang on rx_ind instance
|
||||||
|
dl_ind->dci_ind = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||||
|
uint8_t pdu_type,
|
||||||
|
uint8_t gNB_id,
|
||||||
|
PHY_VARS_NR_UE *ue,
|
||||||
|
NR_UE_DLSCH_t *dlsch0,
|
||||||
|
uint16_t n_pdus){
|
||||||
|
|
||||||
|
int harq_pid;
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||||
|
|
||||||
|
if (n_pdus > 1){
|
||||||
|
LOG_E(PHY, "In %s: multiple number of DL PDUs not supported yet...\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (pdu_type){
|
||||||
|
case FAPI_NR_RX_PDU_TYPE_DLSCH:
|
||||||
|
case FAPI_NR_RX_PDU_TYPE_RAR:
|
||||||
|
harq_pid = dlsch0->current_harq_pid;
|
||||||
|
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;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
rx_ind->rx_indication_body[n_pdus -1].pdu_type = pdu_type;
|
||||||
|
rx_ind->number_pdus = n_pdus;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
|
int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
|
||||||
|
|
||||||
int gain_dB = power_dBm - power_max_dBm, amp_x_100 = -1;
|
int gain_dB = power_dBm - power_max_dBm, amp_x_100 = -1;
|
||||||
@@ -136,6 +196,13 @@ UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_id){
|
|||||||
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[gNB_id]);
|
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[gNB_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t get_ra_PreambleIndex(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_id){
|
||||||
|
|
||||||
|
return PHY_vars_UE_g[Mod_id][CC_id]->prach_resources[gNB_id]->ra_PreambleIndex;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
// 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 get_bw_scaling(uint16_t nb_rb){
|
||||||
uint16_t bw_scaling;
|
uint16_t bw_scaling;
|
||||||
@@ -151,9 +218,12 @@ uint16_t get_bw_scaling(uint16_t nb_rb){
|
|||||||
return bw_scaling;
|
return bw_scaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UL time alignment
|
// UL time alignment procedures:
|
||||||
// If the current tx frame and slot match the TA configuration in ul_time_alignment
|
// - If the current tx frame and slot match the TA configuration in ul_time_alignment
|
||||||
// then timing advance is processed and set to be applied in the next UL transmission */
|
// then timing advance is processed and set to be applied in the next UL transmission
|
||||||
|
// - Application of timing adjustment according to TS 38.213 p4.2
|
||||||
|
// todo:
|
||||||
|
// - handle RAR TA application as per ch 4.2 TS 38.213
|
||||||
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
||||||
|
|
||||||
if (ue->mac_enabled == 1) {
|
if (ue->mac_enabled == 1) {
|
||||||
@@ -165,10 +235,36 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
|||||||
|
|
||||||
uint8_t numerology = ue->frame_parms.numerology_index;
|
uint8_t numerology = ue->frame_parms.numerology_index;
|
||||||
uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL;
|
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);
|
||||||
|
|
||||||
LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d\n", __FUNCTION__, frame_tx, slot_tx);
|
LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d -- UE_mode %d\n", __FUNCTION__, frame_tx, slot_tx, ue->UE_mode[gNB_id]);
|
||||||
|
|
||||||
nr_process_timing_advance(ue->Mod_id, ue->CC_id, ul_time_alignment->ta_command, numerology, bwp_ul_NB_RB);
|
if (ue->UE_mode[gNB_id] == RA_RESPONSE){
|
||||||
|
|
||||||
|
ue->timing_advance = ul_time_alignment->ta_command * bw_scaling / factor_mu;
|
||||||
|
|
||||||
|
LOG_D(PHY, "In %s: [UE %d] [%d.%d] Received (RAR) timing advance command %d new value is %u \n",
|
||||||
|
__FUNCTION__,
|
||||||
|
ue->Mod_id,
|
||||||
|
frame_tx,
|
||||||
|
slot_tx,
|
||||||
|
ul_time_alignment->ta_command,
|
||||||
|
ue->timing_advance);
|
||||||
|
|
||||||
|
} else if (ue->UE_mode[gNB_id] == PUSCH){
|
||||||
|
|
||||||
|
ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu;
|
||||||
|
|
||||||
|
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,
|
||||||
|
slot_tx,
|
||||||
|
ul_time_alignment->ta_command,
|
||||||
|
ue->timing_advance);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ul_time_alignment->ta_frame = -1;
|
ul_time_alignment->ta_frame = -1;
|
||||||
ul_time_alignment->ta_slot = -1;
|
ul_time_alignment->ta_slot = -1;
|
||||||
@@ -177,38 +273,14 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB){
|
|
||||||
|
|
||||||
// 3GPP TS 38.213 p4.2
|
|
||||||
// scale by the scs numerology
|
|
||||||
int factor_mu = 1 << mu;
|
|
||||||
uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB);
|
|
||||||
|
|
||||||
PHY_vars_UE_g[Mod_id][CC_id]->timing_advance += (ta_command - 31) * bw_scaling / factor_mu;
|
|
||||||
|
|
||||||
LOG_D(PHY, "[UE %d] Got timing advance command %u from MAC, new value is %d\n", Mod_id, ta_command, PHY_vars_UE_g[Mod_id][CC_id]->timing_advance);
|
|
||||||
}
|
|
||||||
|
|
||||||
// WIP
|
|
||||||
// - todo: handle TA application as per ch 4.2 TS 38.213
|
|
||||||
void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, int frame_rx, int nr_slot_rx, uint16_t ta_command) {
|
|
||||||
|
|
||||||
int factor_mu = 1 << ue->frame_parms.numerology_index;
|
|
||||||
uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL;
|
|
||||||
uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB);
|
|
||||||
|
|
||||||
// Transmission timing adjustment (TS 38.213 p4.2)
|
|
||||||
ue->timing_advance = bw_scaling / factor_mu;
|
|
||||||
|
|
||||||
LOG_D(PHY, "[UE %d] Frame %d Slot %d, Received (RAR) timing advance command %d new value is %u \n", ue->Mod_id, frame_rx, nr_slot_rx, ta_command, ue->timing_advance);
|
|
||||||
}
|
|
||||||
|
|
||||||
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id) {
|
uint8_t gNB_id) {
|
||||||
|
|
||||||
int slot_tx = proc->nr_slot_tx;
|
int slot_tx = proc->nr_slot_tx;
|
||||||
int frame_tx = proc->frame_tx;
|
int frame_tx = proc->frame_tx;
|
||||||
runmode_t mode = normal_txrx;
|
|
||||||
|
AssertFatal(ue->CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
|
||||||
|
|
||||||
@@ -239,15 +311,11 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
|||||||
nr_ue_pusch_common_procedures(ue,
|
nr_ue_pusch_common_procedures(ue,
|
||||||
slot_tx,
|
slot_tx,
|
||||||
&ue->frame_parms,1);
|
&ue->frame_parms,1);
|
||||||
//ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->pusch_pdu.nrOfLayers);
|
|
||||||
}
|
|
||||||
//LOG_M("txdata.m","txs",ue->common_vars.txdata[0],1228800,1,1);
|
|
||||||
|
|
||||||
/* RACH */
|
}
|
||||||
if (get_softmodem_params()->do_ra==1) {
|
|
||||||
if ((ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
|
if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) {
|
||||||
nr_ue_prach_procedures(ue, proc, gNB_id, mode);
|
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 for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
|
||||||
|
|
||||||
@@ -262,8 +330,7 @@ void nr_ue_measurement_procedures(uint16_t l,
|
|||||||
PHY_VARS_NR_UE *ue,
|
PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t eNB_id,
|
uint8_t eNB_id,
|
||||||
uint16_t slot,
|
uint16_t slot){
|
||||||
runmode_t mode){
|
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
||||||
int frame_rx = proc->frame_rx;
|
int frame_rx = proc->frame_rx;
|
||||||
@@ -316,11 +383,7 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
|
|||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t abstraction_flag)
|
uint8_t abstraction_flag)
|
||||||
{
|
{
|
||||||
// int i;
|
|
||||||
//int pbch_tx_ant=0;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
//static uint8_t first_run = 1;
|
|
||||||
//uint8_t pbch_trials = 0;
|
|
||||||
|
|
||||||
DevAssert(ue);
|
DevAssert(ue);
|
||||||
|
|
||||||
@@ -345,9 +408,13 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
|
|||||||
|
|
||||||
// Switch to PRACH state if it is first PBCH after initial synch and no timing correction is performed
|
// Switch to PRACH state if it is first PBCH after initial synch and no timing correction is performed
|
||||||
if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1){
|
if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1){
|
||||||
ue->UE_mode[gNB_id] = PRACH;
|
if (get_softmodem_params()->do_ra) {
|
||||||
ue->prach_resources[gNB_id]->sync_frame = frame_rx;
|
ue->UE_mode[gNB_id] = PRACH;
|
||||||
ue->prach_resources[gNB_id]->init_msg1 = 0;
|
ue->prach_resources[gNB_id]->sync_frame = frame_rx;
|
||||||
|
ue->prach_resources[gNB_id]->init_msg1 = 0;
|
||||||
|
} else {
|
||||||
|
ue->UE_mode[gNB_id] = PUSCH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PHY_PROC
|
#ifdef DEBUG_PHY_PROC
|
||||||
@@ -439,6 +506,8 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
|||||||
int frame_rx = proc->frame_rx;
|
int frame_rx = proc->frame_rx;
|
||||||
int nr_slot_rx = proc->nr_slot_rx;
|
int nr_slot_rx = proc->nr_slot_rx;
|
||||||
unsigned int dci_cnt=0;
|
unsigned int dci_cnt=0;
|
||||||
|
fapi_nr_dci_indication_t dci_ind = {0};
|
||||||
|
nr_downlink_indication_t dl_indication;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active
|
// unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active
|
||||||
@@ -635,8 +704,6 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
|||||||
pdcch_vars->nb_search_space);
|
pdcch_vars->nb_search_space);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fapi_nr_dci_indication_t dci_ind={0};
|
|
||||||
nr_downlink_indication_t dl_indication={0};
|
|
||||||
dci_cnt = nr_dci_decoding_procedure(ue, proc, &dci_ind);
|
dci_cnt = nr_dci_decoding_procedure(ue, proc, &dci_ind);
|
||||||
|
|
||||||
#ifdef NR_PDCCH_SCHED_DEBUG
|
#ifdef NR_PDCCH_SCHED_DEBUG
|
||||||
@@ -694,15 +761,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// fill dl_indication message
|
// fill dl_indication message
|
||||||
dl_indication.module_id = ue->Mod_id;
|
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, gNB_id);
|
||||||
dl_indication.cc_id = ue->CC_id;
|
|
||||||
dl_indication.gNB_index = gNB_id;
|
|
||||||
dl_indication.frame = frame_rx;
|
|
||||||
dl_indication.slot = nr_slot_rx;
|
|
||||||
dl_indication.thread_id = proc->thread_id;
|
|
||||||
dl_indication.rx_ind = NULL; //no data, only dci for now
|
|
||||||
dl_indication.dci_ind = &dci_ind;
|
|
||||||
|
|
||||||
// send to mac
|
// send to mac
|
||||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||||
|
|
||||||
@@ -851,85 +910,6 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WIP fix:
|
|
||||||
// - time domain indication hardcoded to 0 for k2 offset
|
|
||||||
// - extend TS 38.213 ch 8.3 Msg3 PUSCH
|
|
||||||
// - b buffer
|
|
||||||
// - ulsch power offset
|
|
||||||
// - UE_mode == PUSCH case (should be handled by TA updates)
|
|
||||||
// - harq
|
|
||||||
// - optimize: mu_pusch, j and table_6_1_2_1_1_2_time_dom_res_alloc_A are already defined in nr_ue_procedures
|
|
||||||
void nr_process_rar(nr_downlink_indication_t *dl_info) {
|
|
||||||
|
|
||||||
module_id_t module_id = dl_info->module_id;
|
|
||||||
int cc_id = dl_info->cc_id, frame_rx = dl_info->frame, nr_slot_rx = dl_info->slot, ta_command;
|
|
||||||
uint8_t gNB_index = dl_info->gNB_index; // *rar;
|
|
||||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[module_id][cc_id];
|
|
||||||
NR_UE_DLSCH_t *dlsch0 = ue->dlsch_ra[gNB_index];
|
|
||||||
UE_MODE_t UE_mode = ue->UE_mode[gNB_index];
|
|
||||||
NR_PRACH_RESOURCES_t *prach_resources = ue->prach_resources[gNB_index];
|
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d slot %d Received RAR mode %d\n", module_id, frame_rx, nr_slot_rx, UE_mode);
|
|
||||||
|
|
||||||
if (ue->mac_enabled == 1) {
|
|
||||||
if ((UE_mode != PUSCH) && (prach_resources->Msg3 != NULL)) {
|
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d slot %d Invoking MAC for RAR (current preamble %d)\n", module_id, frame_rx, nr_slot_rx, prach_resources->ra_PreambleIndex);
|
|
||||||
|
|
||||||
ta_command = nr_ue_process_rar(ue->Mod_id,
|
|
||||||
cc_id,
|
|
||||||
frame_rx,
|
|
||||||
nr_slot_rx,
|
|
||||||
dlsch0->harq_processes[0]->b,
|
|
||||||
&ue->pdcch_vars[dl_info->thread_id][gNB_index]->pdcch_config[0].rnti,
|
|
||||||
prach_resources->ra_PreambleIndex,
|
|
||||||
dlsch0->harq_processes[0]->b); // alter the 'b' buffer so it contains only the selected RAR header and RAR payload
|
|
||||||
|
|
||||||
if (ta_command != 0xffff) {
|
|
||||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d slot %d Got Temporary C-RNTI %x and timing advance %d from RAR\n",
|
|
||||||
ue->Mod_id,
|
|
||||||
frame_rx,
|
|
||||||
nr_slot_rx,
|
|
||||||
ue->pdcch_vars[dl_info->thread_id][gNB_index]->pdcch_config[0].rnti,
|
|
||||||
ta_command);
|
|
||||||
|
|
||||||
nr_process_timing_advance_rar(ue, frame_rx, nr_slot_rx, ta_command);
|
|
||||||
|
|
||||||
if (ue->mode != debug_prach)
|
|
||||||
ue->UE_mode[gNB_index] = RA_RESPONSE;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
LOG_W(PHY,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match !!!\n", ue->Mod_id, prach_resources->ra_PreambleIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// rar = dlsch0->harq_processes[0]->b+1;
|
|
||||||
// ta_command = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
|
||||||
// nr_process_timing_advance_rar(ue, frame_rx, nr_slot_rx, ta_command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if contention resolution fails, go back to UE mode PRACH
|
|
||||||
void nr_ra_failed(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index) {
|
|
||||||
|
|
||||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
|
||||||
ue->UE_mode[gNB_index] = PRACH;
|
|
||||||
|
|
||||||
for (int i=0; i <RX_NB_TH_MAX; i++ ) {
|
|
||||||
ue->pdcch_vars[i][gNB_index]->pdcch_config[0].rnti = 0;
|
|
||||||
}
|
|
||||||
LOG_E(PHY,"[UE %d] [RAPROC] Random-access procedure fails, going back to PRACH\n", Mod_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nr_ra_succeeded(uint8_t Mod_id,
|
|
||||||
uint8_t CC_id,
|
|
||||||
uint8_t gNB_index){
|
|
||||||
LOG_I(PHY,"[UE %d][RAPROC] RA procedure succeeded. UE set to PUSCH mode\n", Mod_id);
|
|
||||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
|
||||||
ue->ulsch_Msg3_active[gNB_index] = 0;
|
|
||||||
ue->UE_mode[gNB_index] = PUSCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
int eNB_id,
|
int eNB_id,
|
||||||
@@ -937,7 +917,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
NR_UE_DLSCH_t *dlsch0,
|
NR_UE_DLSCH_t *dlsch0,
|
||||||
NR_UE_DLSCH_t *dlsch1,
|
NR_UE_DLSCH_t *dlsch1,
|
||||||
int *dlsch_errors,
|
int *dlsch_errors,
|
||||||
runmode_t mode,
|
|
||||||
uint8_t dlsch_parallel) {
|
uint8_t dlsch_parallel) {
|
||||||
|
|
||||||
if (dlsch0==NULL)
|
if (dlsch0==NULL)
|
||||||
@@ -955,6 +934,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
uint16_t nb_symb_sch = 9;
|
uint16_t nb_symb_sch = 9;
|
||||||
nr_downlink_indication_t dl_indication;
|
nr_downlink_indication_t dl_indication;
|
||||||
fapi_nr_rx_indication_t rx_ind;
|
fapi_nr_rx_indication_t rx_ind;
|
||||||
|
uint16_t number_pdus = 1;
|
||||||
// params for UL time alignment procedure
|
// params for UL time alignment procedure
|
||||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[eNB_id];
|
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_frame = ue->frame_parms.slots_per_frame;
|
||||||
@@ -1213,42 +1193,33 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
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 ------ \n", frame_rx, nr_slot_rx);
|
||||||
LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS);
|
LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS);
|
||||||
|
|
||||||
if(ret<dlsch0->max_ldpc_iterations+1){
|
if(ret<dlsch0->max_ldpc_iterations+1){
|
||||||
|
|
||||||
// fill dl_indication message
|
|
||||||
dl_indication.module_id = ue->Mod_id;
|
|
||||||
dl_indication.cc_id = ue->CC_id;
|
|
||||||
dl_indication.gNB_index = eNB_id;
|
|
||||||
dl_indication.frame = frame_rx;
|
|
||||||
dl_indication.slot = nr_slot_rx;
|
|
||||||
dl_indication.thread_id = proc->thread_id;
|
|
||||||
dl_indication.rx_ind = &rx_ind; // hang on rx_ind instance
|
|
||||||
dl_indication.dci_ind = NULL;
|
|
||||||
|
|
||||||
//dl_indication.rx_ind->number_pdus
|
|
||||||
switch (pdsch) {
|
switch (pdsch) {
|
||||||
case RA_PDSCH:
|
case RA_PDSCH:
|
||||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
|
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, eNB_id);
|
||||||
break;
|
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, eNB_id, ue, dlsch0, number_pdus);
|
||||||
|
|
||||||
|
ue->UE_mode[eNB_id] = RA_RESPONSE;
|
||||||
|
break;
|
||||||
case PDSCH:
|
case PDSCH:
|
||||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
|
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, eNB_id);
|
||||||
break;
|
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, eNB_id, ue, dlsch0, number_pdus);
|
||||||
|
break;
|
||||||
case SI_PDSCH:
|
case SI_PDSCH:
|
||||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB;
|
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rx_ind.rx_indication_body[0].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b;
|
LOG_D(PHY, "In %s DL PDU length in bits: %d, in bytes: %d \n", __FUNCTION__, dlsch0->harq_processes[harq_pid]->TBS, dlsch0->harq_processes[harq_pid]->TBS / 8);
|
||||||
rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3;
|
|
||||||
LOG_D(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length);
|
|
||||||
rx_ind.number_pdus = 1;
|
|
||||||
|
|
||||||
// send to mac
|
// send to mac
|
||||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
if (ue->if_inst && ue->if_inst->dl_indication) {
|
||||||
ue->if_inst->dl_indication(&dl_indication, ul_time_alignment);
|
ue->if_inst->dl_indication(&dl_indication, ul_time_alignment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO CRC check for CW0
|
// TODO CRC check for CW0
|
||||||
@@ -1607,7 +1578,7 @@ void *UE_thread_slot1_dl_processing(void *arg) {
|
|||||||
abstraction_flag);
|
abstraction_flag);
|
||||||
}
|
}
|
||||||
// do procedures for RA-RNTI
|
// do procedures for RA-RNTI
|
||||||
if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) {
|
if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1) && (UE_mode != PUSCH)) {
|
||||||
ue_pdsch_procedures(ue,
|
ue_pdsch_procedures(ue,
|
||||||
proc,
|
proc,
|
||||||
eNB_id,
|
eNB_id,
|
||||||
@@ -1725,7 +1696,6 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
|
|||||||
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
runmode_t mode,
|
|
||||||
uint8_t dlsch_parallel
|
uint8_t dlsch_parallel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -1779,9 +1749,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
nr_ue_rsrp_measurements(ue, gNB_id, proc, nr_slot_rx, 0);
|
||||||
nr_ue_rsrp_measurements(ue,proc,nr_slot_rx,0);
|
|
||||||
//}
|
|
||||||
|
|
||||||
if ((ue->decode_MIB == 1) && slot_pbch) {
|
if ((ue->decode_MIB == 1) && slot_pbch) {
|
||||||
|
|
||||||
@@ -1909,7 +1877,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch[proc->thread_id][gNB_id][0],
|
ue->dlsch[proc->thread_id][gNB_id][0],
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx, mode);
|
nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do procedures for SI-RNTI
|
// do procedures for SI-RNTI
|
||||||
@@ -1929,7 +1897,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch_SI[gNB_id],
|
ue->dlsch_SI[gNB_id],
|
||||||
NULL,
|
NULL,
|
||||||
&ue->dlsch_SI_errors[gNB_id],
|
&ue->dlsch_SI_errors[gNB_id],
|
||||||
mode,
|
|
||||||
dlsch_parallel);
|
dlsch_parallel);
|
||||||
|
|
||||||
// deactivate dlsch once dlsch proc is done
|
// deactivate dlsch once dlsch proc is done
|
||||||
@@ -1955,7 +1922,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch_p[gNB_id],
|
ue->dlsch_p[gNB_id],
|
||||||
NULL,
|
NULL,
|
||||||
&ue->dlsch_p_errors[gNB_id],
|
&ue->dlsch_p_errors[gNB_id],
|
||||||
mode,
|
|
||||||
dlsch_parallel);
|
dlsch_parallel);
|
||||||
|
|
||||||
// deactivate dlsch once dlsch proc is done
|
// deactivate dlsch once dlsch proc is done
|
||||||
@@ -1965,7 +1931,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do procedures for RA-RNTI
|
// do procedures for RA-RNTI
|
||||||
if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) {
|
if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1) && (ue->UE_mode[gNB_id] != PUSCH)) {
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN);
|
||||||
nr_ue_pdsch_procedures(ue,
|
nr_ue_pdsch_procedures(ue,
|
||||||
proc,
|
proc,
|
||||||
@@ -1981,7 +1947,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch_ra[gNB_id],
|
ue->dlsch_ra[gNB_id],
|
||||||
NULL,
|
NULL,
|
||||||
&ue->dlsch_ra_errors[gNB_id],
|
&ue->dlsch_ra_errors[gNB_id],
|
||||||
mode,
|
|
||||||
dlsch_parallel);
|
dlsch_parallel);
|
||||||
|
|
||||||
// deactivate dlsch once dlsch proc is done
|
// deactivate dlsch once dlsch proc is done
|
||||||
@@ -2008,7 +1973,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch[proc->thread_id][gNB_id][0],
|
ue->dlsch[proc->thread_id][gNB_id][0],
|
||||||
ue->dlsch[proc->thread_id][gNB_id][1],
|
ue->dlsch[proc->thread_id][gNB_id][1],
|
||||||
&ue->dlsch_errors[gNB_id],
|
&ue->dlsch_errors[gNB_id],
|
||||||
mode,
|
|
||||||
dlsch_parallel);
|
dlsch_parallel);
|
||||||
|
|
||||||
|
|
||||||
@@ -2169,66 +2133,51 @@ uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WIP
|
|
||||||
// todo:
|
// todo:
|
||||||
// - set tx_total_RE
|
|
||||||
// - power control as per 38.213 ch 7.4
|
// - power control as per 38.213 ch 7.4
|
||||||
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, runmode_t runmode) {
|
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id) {
|
||||||
|
|
||||||
int frame_tx = proc->frame_tx, nr_slot_tx = proc->nr_slot_tx, prach_power; // tx_amp
|
int frame_tx = proc->frame_tx, nr_slot_tx = proc->nr_slot_tx, prach_power; // tx_amp
|
||||||
uint16_t /*preamble_tx = 50,*/ pathloss;
|
|
||||||
uint8_t mod_id = ue->Mod_id;
|
uint8_t mod_id = ue->Mod_id;
|
||||||
UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id);
|
|
||||||
NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id];
|
NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id];
|
||||||
|
AssertFatal(prach_resources != NULL, "ue->prach_resources[%u] == NULL\n", gNB_id);
|
||||||
uint8_t nr_prach = 0;
|
uint8_t nr_prach = 0;
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
if (!prach_resources->init_msg1 && ((MAX_FRAME_NUMBER+frame_tx-ue->prach_resources[gNB_id]->sync_frame)% MAX_FRAME_NUMBER)>150){
|
|
||||||
ue->prach_cnt = 0;
|
|
||||||
prach_resources->init_msg1 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ue->mac_enabled == 0){
|
if (ue->mac_enabled == 0){
|
||||||
// prach_resources->ra_PreambleIndex = preamble_tx;
|
|
||||||
prach_resources->ra_TDD_map_index = 0;
|
prach_resources->ra_TDD_map_index = 0;
|
||||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10;
|
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10;
|
||||||
prach_resources->ra_RNTI = 0x1234;
|
prach_resources->ra_RNTI = 0x1234;
|
||||||
nr_prach = 1;
|
nr_prach = 1;
|
||||||
|
prach_resources->init_msg1 = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// ask L2 for RACH transport
|
|
||||||
if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) {
|
LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources\n", __FUNCTION__, frame_tx, nr_slot_tx);
|
||||||
LOG_D(PHY, "Getting PRACH resources. Frame %d Slot %d \n", 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);
|
||||||
// flush Msg3 Buffer
|
|
||||||
if (prach_resources->Msg3 == NULL){
|
|
||||||
for(int i = 0; i<NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
|
||||||
ue->ulsch_Msg3_active[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nr_prach = nr_ue_get_rach(ue->prach_resources[gNB_id], &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_slot_tx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ue->prach_resources[gNB_id] != NULL && nr_prach == 1 && prach_resources->init_msg1) {
|
if (nr_prach == 1) {
|
||||||
|
|
||||||
pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
|
if (ue->mac_enabled == 1) {
|
||||||
LOG_D(PHY,"runmode %d\n",runmode);
|
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)));
|
||||||
|
ue->tx_power_dBm[nr_slot_tx] = min(nr_get_Pcmax(mod_id), ra_preamble_rx_power);
|
||||||
|
|
||||||
if ((ue->mac_enabled == 1) && (runmode != calib_prach_tx)) {
|
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",
|
||||||
ue->tx_power_dBm[nr_slot_tx] = prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER + pathloss;
|
mod_id,
|
||||||
|
frame_tx,
|
||||||
|
nr_slot_tx,
|
||||||
|
prach_resources->ra_PreambleIndex,
|
||||||
|
pathloss,
|
||||||
|
ue->tx_power_dBm[nr_slot_tx],
|
||||||
|
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER,
|
||||||
|
prach_resources->ra_RNTI);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, nr_slot_tx %d : Generating PRACH, preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x\n",
|
|
||||||
ue->Mod_id,
|
|
||||||
frame_tx,
|
|
||||||
nr_slot_tx,
|
|
||||||
prach_resources->ra_PreambleIndex,
|
|
||||||
pathloss,
|
|
||||||
ue->tx_power_dBm[nr_slot_tx],
|
|
||||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER,
|
|
||||||
prach_resources->ra_RNTI);
|
|
||||||
|
|
||||||
//ue->tx_total_RE[nr_slot_tx] = 96; // todo
|
|
||||||
ue->prach_vars[gNB_id]->amp = AMP;
|
ue->prach_vars[gNB_id]->amp = AMP;
|
||||||
|
|
||||||
/* #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
|
/* #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
|
||||||
@@ -2239,51 +2188,38 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
|||||||
ue->prach_vars[gNB_id]->amp = AMP;
|
ue->prach_vars[gNB_id]->amp = AMP;
|
||||||
#endif */
|
#endif */
|
||||||
|
|
||||||
if ((runmode == calib_prach_tx) && (((proc->frame_tx&0xfffe)%100)==0))
|
|
||||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d, nr_slot_tx %d : PRACH TX power %d dBm, amp %d\n", ue->Mod_id,
|
|
||||||
proc->frame_rx,
|
|
||||||
proc->nr_slot_tx,
|
|
||||||
ue->tx_power_dBm[nr_slot_tx],
|
|
||||||
ue->prach_vars[gNB_id]->amp);
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
prach_power = generate_nr_prach(ue, gNB_id, nr_slot_tx);
|
prach_power = generate_nr_prach(ue, gNB_id, nr_slot_tx);
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d][RAPROC] PRACH PL %d dB, power %d dBm, digital power %d dB (amp %d)\n",
|
LOG_D(PHY, "In %s: [UE %d][RAPROC][%d.%d]: Generated PRACH Msg1 (TX power PRACH %d dBm, digital power %d dBW (amp %d)\n",
|
||||||
ue->Mod_id,
|
__FUNCTION__,
|
||||||
pathloss,
|
mod_id,
|
||||||
|
frame_tx,
|
||||||
|
nr_slot_tx,
|
||||||
ue->tx_power_dBm[nr_slot_tx],
|
ue->tx_power_dBm[nr_slot_tx],
|
||||||
dB_fixed(prach_power),
|
dB_fixed(prach_power),
|
||||||
ue->prach_vars[gNB_id]->amp);
|
ue->prach_vars[gNB_id]->amp);
|
||||||
|
|
||||||
if (ue->mac_enabled == 1)
|
if (ue->mac_enabled == 1)
|
||||||
nr_Msg1_transmitted(ue->Mod_id, ue->CC_id, frame_tx, gNB_id);
|
nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id);
|
||||||
|
|
||||||
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, nr_slot_tx %d: Generated PRACH Msg1 (gNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB) \n",
|
|
||||||
ue->Mod_id,
|
|
||||||
frame_tx,
|
|
||||||
nr_slot_tx,
|
|
||||||
gNB_id,
|
|
||||||
prach_resources->ra_PreambleIndex,
|
|
||||||
ue->tx_power_dBm[nr_slot_tx],
|
|
||||||
pathloss);
|
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d] frame %d nr_slot_tx %d : prach_cnt %d\n", ue->Mod_id, frame_tx, nr_slot_tx, ue->prach_cnt);
|
|
||||||
|
|
||||||
ue->prach_cnt++;
|
|
||||||
|
|
||||||
if (ue->prach_cnt == 3)
|
|
||||||
ue->prach_cnt = 0;
|
|
||||||
} else if (nr_prach == 2) {
|
} else if (nr_prach == 2) {
|
||||||
nr_ra_succeeded(mod_id, ue->CC_id, gNB_id);
|
|
||||||
|
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){
|
||||||
|
|
||||||
|
LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id);
|
||||||
|
|
||||||
|
ue->UE_mode[gNB_id] = PRACH;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue
|
|
||||||
if (runmode == calib_prach_tx)
|
|
||||||
ue->prach_resources[gNB_id] = NULL;
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,8 +202,6 @@ void nr_generate_pucch3_4(int32_t **txdataF,
|
|||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
static int bwp_id = 1;
|
|
||||||
|
|
||||||
bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t *proc, bool reset_harq)
|
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;
|
uint8_t sr_payload = 0;
|
||||||
@@ -234,6 +232,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
|||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||||
NR_PUCCH_Resource_t *pucch_resource;
|
NR_PUCCH_Resource_t *pucch_resource;
|
||||||
uint16_t crnti = mac->crnti;
|
uint16_t crnti = mac->crnti;
|
||||||
|
NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
|
||||||
|
|
||||||
/* update current context */
|
/* update current context */
|
||||||
|
|
||||||
@@ -762,7 +761,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
|||||||
number_of_code_word = 1;
|
number_of_code_word = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ue->n_connected_eNB > 1) {
|
if (ue->n_connected_gNB > 1) {
|
||||||
LOG_E(PHY,"PUCCH ACK feedback is not implemented for mutiple gNB cells : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
LOG_E(PHY,"PUCCH ACK feedback is not implemented for mutiple gNB cells : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -781,19 +780,15 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
|||||||
|
|
||||||
if (harq_status->ack == DL_ACKNACK_NO_SET) {
|
if (harq_status->ack == DL_ACKNACK_NO_SET) {
|
||||||
LOG_E(PHY,"PUCCH Downlink acknowledgment has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
LOG_E(PHY,"PUCCH Downlink acknowledgment has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
else if (harq_status->vDAI_DL == DL_DAI_NO_SET) {
|
else if (harq_status->vDAI_DL == DL_DAI_NO_SET) {
|
||||||
LOG_E(PHY,"PUCCH Downlink DAI has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
LOG_E(PHY,"PUCCH Downlink DAI has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
else if (harq_status->vDAI_DL > NR_DL_MAX_DAI) {
|
else if (harq_status->vDAI_DL > NR_DL_MAX_DAI) {
|
||||||
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);
|
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);
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
else if (harq_status->send_harq_status == 0) {
|
else if (harq_status->send_harq_status == 0) {
|
||||||
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);
|
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);
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@@ -809,6 +804,8 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
|||||||
number_harq_feedback++;
|
number_harq_feedback++;
|
||||||
ack_data[code_word][dai_current - 1] = harq_status->ack;
|
ack_data[code_word][dai_current - 1] = harq_status->ack;
|
||||||
dai[code_word][dai_current - 1] = dai_current;
|
dai[code_word][dai_current - 1] = dai_current;
|
||||||
|
harq_status->slot_for_feedback_ack = NR_MAX_SLOTS_PER_FRAME;
|
||||||
|
harq_status->send_harq_status = 0;
|
||||||
}
|
}
|
||||||
if (do_reset == TRUE) {
|
if (do_reset == TRUE) {
|
||||||
init_downlink_harq_status(ue->dlsch[thread_idx][gNB_id][code_word]->harq_processes[dl_harq_pid]);
|
init_downlink_harq_status(ue->dlsch[thread_idx][gNB_id][code_word]->harq_processes[dl_harq_pid]);
|
||||||
@@ -939,6 +936,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
|
|||||||
pucch_format_nr_t format_pucch;
|
pucch_format_nr_t format_pucch;
|
||||||
int ready_pucch_resource_id = FALSE; /* in the case that it is already given */
|
int ready_pucch_resource_id = FALSE; /* in the case that it is already given */
|
||||||
NR_PUCCH_Resource_t *pucch_resource;
|
NR_PUCCH_Resource_t *pucch_resource;
|
||||||
|
NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
|
||||||
|
|
||||||
/* ini values to unset */
|
/* ini values to unset */
|
||||||
*initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE;
|
*initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE;
|
||||||
@@ -1111,6 +1109,8 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
|
|||||||
int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size)
|
int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size)
|
||||||
{
|
{
|
||||||
int pucch_resource_set_id = 0;
|
int pucch_resource_set_id = 0;
|
||||||
|
NR_BWP_Id_t bwp_id = mac->DL_BWP_Id;
|
||||||
|
|
||||||
//long *pucch_max_pl_bits = NULL;
|
//long *pucch_max_pl_bits = NULL;
|
||||||
|
|
||||||
/* from TS 38.331 field maxPayloadMinus1
|
/* from TS 38.331 field maxPayloadMinus1
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ UE_nr_rxtx_proc_t proc;
|
|||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
double cpuf;
|
double cpuf;
|
||||||
uint8_t nfapi_mode = 0;
|
//uint8_t nfapi_mode = 0;
|
||||||
uint16_t NB_UE_INST = 1;
|
uint16_t NB_UE_INST = 1;
|
||||||
|
|
||||||
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||||
@@ -427,7 +427,7 @@ int main(int argc, char **argv)
|
|||||||
UE->dlsch_ra[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
UE->dlsch_ra[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
||||||
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
|
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
|
||||||
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[0][0];
|
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[0][0];
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_processes[harq_pid]->pdsch_pdu.pdsch_pdu_rel15;
|
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
|
||||||
//time_stats_t *rm_stats, *te_stats, *i_stats;
|
//time_stats_t *rm_stats, *te_stats, *i_stats;
|
||||||
uint8_t is_crnti = 0, llr8_flag = 0;
|
uint8_t is_crnti = 0, llr8_flag = 0;
|
||||||
unsigned int TBS = 8424;
|
unsigned int TBS = 8424;
|
||||||
@@ -519,7 +519,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
//if (i<16)
|
//if (i<16)
|
||||||
// printf("encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]);
|
// printf("encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]);
|
||||||
if (dlsch->harq_processes[0]->f[i] == 0)
|
if (dlsch->harq_process.f[i] == 0)
|
||||||
modulated_input[i] = 1.0; ///sqrt(2); //QPSK
|
modulated_input[i] = 1.0; ///sqrt(2); //QPSK
|
||||||
else
|
else
|
||||||
modulated_input[i] = -1.0; ///sqrt(2);
|
modulated_input[i] = -1.0; ///sqrt(2);
|
||||||
@@ -547,7 +547,7 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
channel_output_uncoded[i] = 0;
|
channel_output_uncoded[i] = 0;
|
||||||
|
|
||||||
if (channel_output_uncoded[i] != dlsch->harq_processes[harq_pid]->f[i])
|
if (channel_output_uncoded[i] != dlsch->harq_process.f[i])
|
||||||
errors_bit_uncoded = errors_bit_uncoded + 1;
|
errors_bit_uncoded = errors_bit_uncoded + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ double cpuf;
|
|||||||
|
|
||||||
int sf_ahead=4 ;
|
int sf_ahead=4 ;
|
||||||
int sl_ahead=0;
|
int sl_ahead=0;
|
||||||
uint8_t nfapi_mode = 0;
|
//uint8_t nfapi_mode = 0;
|
||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
// dummy functions
|
// dummy functions
|
||||||
@@ -151,6 +151,12 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nr_derive_key(int alg_type, uint8_t alg_id,
|
||||||
|
const uint8_t key[32], uint8_t **out)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void config_common(int Mod_idP,
|
void config_common(int Mod_idP,
|
||||||
int pdsch_AntennaPorts,
|
int pdsch_AntennaPorts,
|
||||||
NR_ServingCellConfigCommon_t *scc
|
NR_ServingCellConfigCommon_t *scc
|
||||||
@@ -172,6 +178,13 @@ int is_x2ap_enabled(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nFAPI P7 dummy functions
|
||||||
|
|
||||||
|
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||||
|
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||||
|
|
||||||
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -186,8 +199,7 @@ void update_dmrs_config(NR_CellGroupConfig_t *scg,PHY_VARS_NR_UE *ue, int8_t* dm
|
|||||||
int g_mcsIndex = -1, g_mcsTableIdx = 0, g_rbStart = -1, g_rbSize = -1;
|
int g_mcsIndex = -1, g_mcsTableIdx = 0, g_rbStart = -1, g_rbSize = -1;
|
||||||
void nr_dlsim_preprocessor(module_id_t module_id,
|
void nr_dlsim_preprocessor(module_id_t module_id,
|
||||||
frame_t frame,
|
frame_t frame,
|
||||||
sub_frame_t slot,
|
sub_frame_t slot) {
|
||||||
int num_slots_per_tdd) {
|
|
||||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||||
AssertFatal(UE_info->num_UEs == 1, "can have only a single UE\n");
|
AssertFatal(UE_info->num_UEs == 1, "can have only a single UE\n");
|
||||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[0];
|
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[0];
|
||||||
@@ -203,15 +215,25 @@ void nr_dlsim_preprocessor(module_id_t module_id,
|
|||||||
sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
|
sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
|
||||||
sched_ctrl->cce_index = 0;
|
sched_ctrl->cce_index = 0;
|
||||||
|
|
||||||
/* set "any" value for PUCCH (simulator evaluates PDSCH only) */
|
|
||||||
sched_ctrl->pucch_sched_idx = 0;
|
|
||||||
sched_ctrl->pucch_occ_idx = 0;
|
|
||||||
|
|
||||||
sched_ctrl->rbStart = g_rbStart;
|
sched_ctrl->rbStart = g_rbStart;
|
||||||
sched_ctrl->rbSize = g_rbSize;
|
sched_ctrl->rbSize = g_rbSize;
|
||||||
sched_ctrl->mcs = g_mcsIndex;
|
sched_ctrl->mcs = g_mcsIndex;
|
||||||
sched_ctrl->time_domain_allocation = 2;
|
sched_ctrl->time_domain_allocation = 2;
|
||||||
sched_ctrl->mcsTableIdx = g_mcsTableIdx;
|
sched_ctrl->mcsTableIdx = g_mcsTableIdx;
|
||||||
|
/* the simulator assumes the HARQ PID is equal to the slot number */
|
||||||
|
sched_ctrl->dl_harq_pid = slot;
|
||||||
|
/* The scheduler uses lists to track whether a HARQ process is
|
||||||
|
* free/busy/awaiting retransmission, and updates the HARQ process states.
|
||||||
|
* However, in the simulation, we never get ack or nack for any HARQ process,
|
||||||
|
* thus the list and HARQ states don't match what the scheduler expects.
|
||||||
|
* Therefore, below lines just "repair" everything so that the scheduler
|
||||||
|
* won't remark that there is no HARQ feedback */
|
||||||
|
sched_ctrl->feedback_dl_harq.head = -1; // always overwrite feedback HARQ process
|
||||||
|
if (sched_ctrl->harq_processes[slot].round == 0) // depending on round set in simulation ...
|
||||||
|
add_front_nr_list(&sched_ctrl->available_dl_harq, slot); // ... make PID available
|
||||||
|
else
|
||||||
|
add_front_nr_list(&sched_ctrl->retrans_dl_harq, slot); // ... make PID retransmission
|
||||||
|
sched_ctrl->harq_processes[slot].is_waiting = false;
|
||||||
AssertFatal(sched_ctrl->rbStart >= 0, "invalid rbStart %d\n", sched_ctrl->rbStart);
|
AssertFatal(sched_ctrl->rbStart >= 0, "invalid rbStart %d\n", sched_ctrl->rbStart);
|
||||||
AssertFatal(sched_ctrl->rbSize > 0, "invalid rbSize %d\n", sched_ctrl->rbSize);
|
AssertFatal(sched_ctrl->rbSize > 0, "invalid rbSize %d\n", sched_ctrl->rbSize);
|
||||||
AssertFatal(sched_ctrl->mcs >= 0, "invalid sched_ctrl->mcs %d\n", sched_ctrl->mcs);
|
AssertFatal(sched_ctrl->mcs >= 0, "invalid sched_ctrl->mcs %d\n", sched_ctrl->mcs);
|
||||||
@@ -671,6 +693,9 @@ int main(int argc, char **argv)
|
|||||||
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,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||||
phy_init_nr_gNB(gNB,0,0);
|
phy_init_nr_gNB(gNB,0,0);
|
||||||
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
||||||
|
NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info;
|
||||||
|
UE_info->num_UEs=1;
|
||||||
|
|
||||||
// stub to configure frame_parms
|
// stub to configure frame_parms
|
||||||
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
||||||
// call MAC to configure common parameters
|
// call MAC to configure common parameters
|
||||||
@@ -836,10 +861,10 @@ int main(int argc, char **argv)
|
|||||||
scheduled_response.thread_id = UE_proc.thread_id;
|
scheduled_response.thread_id = UE_proc.thread_id;
|
||||||
|
|
||||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||||
NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info;
|
|
||||||
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
|
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
|
||||||
snrRun = 0;
|
snrRun = 0;
|
||||||
|
|
||||||
|
|
||||||
for (SNR = snr0; SNR < snr1; SNR += .2) {
|
for (SNR = snr0; SNR < snr1; SNR += .2) {
|
||||||
|
|
||||||
varArray_t *table_tx=initVarArray(1000,sizeof(double));
|
varArray_t *table_tx=initVarArray(1000,sizeof(double));
|
||||||
@@ -885,7 +910,7 @@ int main(int argc, char **argv)
|
|||||||
NR_DL_UE_HARQ_t *UE_harq_process = dlsch0->harq_processes[harq_pid];
|
NR_DL_UE_HARQ_t *UE_harq_process = dlsch0->harq_processes[harq_pid];
|
||||||
|
|
||||||
NR_gNB_DLSCH_t *gNB_dlsch = gNB->dlsch[0][0];
|
NR_gNB_DLSCH_t *gNB_dlsch = gNB->dlsch[0][0];
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_processes[slot]->pdsch_pdu.pdsch_pdu_rel15;
|
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
|
||||||
|
|
||||||
UE_harq_process->harq_ack.ack = 0;
|
UE_harq_process->harq_ack.ack = 0;
|
||||||
round = 0;
|
round = 0;
|
||||||
@@ -901,15 +926,11 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
UE_info->UE_sched_ctrl[0].harq_processes[harq_pid].round = round;
|
UE_info->UE_sched_ctrl[0].harq_processes[harq_pid].round = round;
|
||||||
gNB->dlsch[0][0]->harq_processes[harq_pid]->round = round;
|
|
||||||
for (int i=0; i<MAX_NUM_CORESET; i++)
|
for (int i=0; i<MAX_NUM_CORESET; i++)
|
||||||
gNB_mac->UE_info.num_pdcch_cand[0][i] = 0;
|
gNB_mac->UE_info.num_pdcch_cand[0][i] = 0;
|
||||||
|
|
||||||
if (css_flag == 0) {
|
if (css_flag == 0) {
|
||||||
const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160};
|
nr_schedule_ue_spec(0, frame, slot);
|
||||||
const NR_TDD_UL_DL_Pattern_t *tdd_pattern = &scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
|
||||||
const int num_slots_per_tdd = slots_per_frame[*scc->ssbSubcarrierSpacing] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity);
|
|
||||||
nr_schedule_ue_spec(0, frame, slot, num_slots_per_tdd);
|
|
||||||
} else {
|
} else {
|
||||||
nr_schedule_css_dlsch_phytest(0,frame,slot);
|
nr_schedule_css_dlsch_phytest(0,frame,slot);
|
||||||
}
|
}
|
||||||
@@ -1021,7 +1042,6 @@ int main(int argc, char **argv)
|
|||||||
phy_procedures_nrUE_RX(UE,
|
phy_procedures_nrUE_RX(UE,
|
||||||
&UE_proc,
|
&UE_proc,
|
||||||
0,
|
0,
|
||||||
normal_txrx,
|
|
||||||
dlsch_threads);
|
dlsch_threads);
|
||||||
|
|
||||||
//printf("dlsim round %d ends\n",round);
|
//printf("dlsim round %d ends\n",round);
|
||||||
@@ -1054,8 +1074,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < available_bits; i++) {
|
for (i = 0; i < available_bits; i++) {
|
||||||
|
|
||||||
if(((gNB_dlsch->harq_processes[harq_pid]->f[i] == 0) && (UE_llr[i] <= 0)) ||
|
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
|
||||||
((gNB_dlsch->harq_processes[harq_pid]->f[i] == 1) && (UE_llr[i] >= 0)))
|
((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0)))
|
||||||
{
|
{
|
||||||
if(errors_scrambling == 0) {
|
if(errors_scrambling == 0) {
|
||||||
LOG_D(PHY,"\n");
|
LOG_D(PHY,"\n");
|
||||||
@@ -1068,7 +1088,7 @@ int main(int argc, char **argv)
|
|||||||
for (i = 0; i < TBS; i++) {
|
for (i = 0; i < TBS; i++) {
|
||||||
|
|
||||||
estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
||||||
test_input_bit[i] = (gNB_dlsch->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
|
test_input_bit[i] = (gNB_dlsch->harq_process.b[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
|
||||||
|
|
||||||
if (estimated_output_bit[i] != test_input_bit[i]) {
|
if (estimated_output_bit[i] != test_input_bit[i]) {
|
||||||
if(errors_bit == 0)
|
if(errors_bit == 0)
|
||||||
@@ -1108,9 +1128,9 @@ int main(int argc, char **argv)
|
|||||||
if (print_perf==1) {
|
if (print_perf==1) {
|
||||||
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n",
|
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n",
|
||||||
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex,
|
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex,
|
||||||
gNB->dlsch[0][0]->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3,
|
gNB->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3,
|
||||||
gNB->dlsch[0][0]->harq_processes[0]->K,
|
gNB->dlsch[0][0]->harq_process.K,
|
||||||
gNB->dlsch[0][0]->harq_processes[0]->K/((gNB->dlsch[0][0]->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3)>3824?22:10));
|
gNB->dlsch[0][0]->harq_process.K/((gNB->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3)>3824?22:10));
|
||||||
printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
|
printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
|
||||||
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
|
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
|
||||||
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
|
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
|
||||||
|
|||||||
@@ -2,8 +2,27 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { re
|
|||||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
||||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||||
//int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
//int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||||
//int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return(0); }
|
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||||
|
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||||
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
||||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
||||||
|
nfapi_mode_t nfapi_mod;
|
||||||
|
nfapi_mode_t nfapi_getmode(void) {
|
||||||
|
return nfapi_mod;
|
||||||
|
}
|
||||||
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
||||||
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
||||||
|
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
|
||||||
|
fapi_nr_dci_indication_t *dci_ind,
|
||||||
|
fapi_nr_rx_indication_t *rx_ind,
|
||||||
|
UE_nr_rxtx_proc_t *proc,
|
||||||
|
PHY_VARS_NR_UE *ue,
|
||||||
|
uint8_t gNB_id) {}
|
||||||
|
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||||
|
uint8_t pdu_type,
|
||||||
|
uint8_t gNB_id,
|
||||||
|
PHY_VARS_NR_UE *ue,
|
||||||
|
NR_UE_DLSCH_t *dlsch0,
|
||||||
|
uint16_t n_pdus) {}
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { re
|
|||||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
||||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||||
//int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return(0); }
|
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||||
|
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||||
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
||||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
||||||
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
||||||
@@ -83,7 +86,6 @@ void nr_get_prach_resources(module_id_t mod_id,
|
|||||||
int CC_id,
|
int CC_id,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
uint8_t t_id,
|
uint8_t t_id,
|
||||||
uint8_t first_Msg3,
|
|
||||||
NR_PRACH_RESOURCES_t *prach_resources,
|
NR_PRACH_RESOURCES_t *prach_resources,
|
||||||
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated){
|
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated){
|
||||||
|
|
||||||
@@ -206,9 +208,6 @@ void nr_get_prach_resources(module_id_t mod_id,
|
|||||||
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB);
|
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo Msg3-DeltaPreamble should be provided from higher layers, otherwise is 0
|
|
||||||
mac->deltaPreamble_Msg3 = 0;
|
|
||||||
deltaPreamble_Msg3 = mac->deltaPreamble_Msg3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PLThreshold = prach_resources->RA_PCMAX - nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB;
|
PLThreshold = prach_resources->RA_PCMAX - nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB;
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ ngap_gNB_config_t ngap_config;
|
|||||||
uint32_t ngap_generate_gNB_id(void) {return 0;}
|
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;}
|
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;}
|
||||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { return;}
|
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { return;}
|
||||||
|
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) { return;}
|
||||||
|
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { return;}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ RAN_CONTEXT_t RC;
|
|||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
double cpuf;
|
double cpuf;
|
||||||
uint8_t nfapi_mode = 0;
|
//uint8_t nfapi_mode = 0;
|
||||||
uint16_t NB_UE_INST = 1;
|
uint16_t NB_UE_INST = 1;
|
||||||
|
|
||||||
// needed for some functions
|
// needed for some functions
|
||||||
@@ -675,7 +675,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (UE->is_synchronized == 0) {
|
if (UE->is_synchronized == 0) {
|
||||||
UE_nr_rxtx_proc_t proc={0};
|
UE_nr_rxtx_proc_t proc={0};
|
||||||
ret = nr_initial_sync(&proc, UE, normal_txrx,1);
|
ret = nr_initial_sync(&proc, UE, 1);
|
||||||
printf("nr_initial_sync1 returns %d\n",ret);
|
printf("nr_initial_sync1 returns %d\n",ret);
|
||||||
if (ret<0) n_errors++;
|
if (ret<0) n_errors++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include "OCG_vars.h"
|
#include "OCG_vars.h"
|
||||||
#include <openair2/LAYER2/MAC/mac_vars.h>
|
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||||
#include <openair2/RRC/LTE/rrc_vars.h>
|
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||||
|
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||||
|
|
||||||
|
|
||||||
#define NR_PRACH_DEBUG 1
|
#define NR_PRACH_DEBUG 1
|
||||||
@@ -62,7 +63,7 @@ RU_t *ru;
|
|||||||
double cpuf;
|
double cpuf;
|
||||||
extern uint16_t prach_root_sequence_map0_3[838];
|
extern uint16_t prach_root_sequence_map0_3[838];
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
uint8_t nfapi_mode=0;
|
//uint8_t nfapi_mode=0;
|
||||||
int sl_ahead = 0;
|
int sl_ahead = 0;
|
||||||
|
|
||||||
//void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
|
//void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
|
||||||
@@ -70,6 +71,10 @@ int sl_ahead = 0;
|
|||||||
/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
|
/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
|
||||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||||
softmodem_params_t *get_softmodem_params(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); }
|
||||||
|
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||||
|
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||||
|
|
||||||
void
|
void
|
||||||
rrc_data_ind(
|
rrc_data_ind(
|
||||||
@@ -137,6 +142,12 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nr_derive_key(int alg_type, uint8_t alg_id,
|
||||||
|
const uint8_t key[32], uint8_t **out)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
@@ -671,7 +682,7 @@ int main(int argc, char **argv){
|
|||||||
UE_nr_rxtx_proc_t proc={0};
|
UE_nr_rxtx_proc_t proc={0};
|
||||||
proc.frame_tx = frame;
|
proc.frame_tx = frame;
|
||||||
proc.nr_slot_tx = slot;
|
proc.nr_slot_tx = slot;
|
||||||
nr_ue_prach_procedures(UE,&proc,0,0);
|
nr_ue_prach_procedures(UE, &proc, 0);
|
||||||
|
|
||||||
/* tx_lev_dB not used later, no need to set */
|
/* tx_lev_dB not used later, no need to set */
|
||||||
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ openair0_config_t openair0_cfg[MAX_CARDS];
|
|||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
double cpuf;
|
double cpuf;
|
||||||
uint8_t nfapi_mode = 0;
|
//uint8_t nfapi_mode = 0;
|
||||||
uint16_t NB_UE_INST = 1;
|
uint16_t NB_UE_INST = 1;
|
||||||
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
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};
|
uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user