reset for remerging
This commit is contained in:
+172
-13
@@ -8,49 +8,208 @@ pipeline {
|
||||
disableConcurrentBuilds()
|
||||
timestamps()
|
||||
gitLabConnection('OAI GitLab')
|
||||
//gitlabBuilds(builds: ["Build", "Test"])
|
||||
gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim"])
|
||||
}
|
||||
|
||||
stages {
|
||||
stage ("Verify Parameters") {
|
||||
stage ("Verify Guidelines") {
|
||||
steps {
|
||||
echo 'Verify Parameters'
|
||||
echo "Git URL is ${GIT_URL}"
|
||||
echo "GitLab Act is ${env.gitlabActionType}"
|
||||
script {
|
||||
if ("MERGE".equals(env.gitlabActionType)) {
|
||||
// GitLab-Jenkins pugin integration is lacking to perform the merge by itself
|
||||
// GitLab-Jenkins plugin integration is lacking to perform the merge by itself
|
||||
// Doing it manually --> it may have merge conflicts
|
||||
sh "./ci-scripts/doGitLabMerge.sh ${env.gitlabSourceBranch} ${env.gitlabMergeRequestLastCommit} ${env.gitlabTargetBranch} ${GIT_COMMIT}"
|
||||
sh "./ci-scripts/checkCodingFormattingRules.sh ${env.gitlabSourceBranch} ${env.gitlabTargetBranch}"
|
||||
sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
|
||||
sh "zip -r -qq localZip.zip ."
|
||||
|
||||
// Running astyle options on the list of modified files by the merge request
|
||||
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
|
||||
sh "./ci-scripts/checkCodingFormattingRules.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}"
|
||||
def res=readFile('./oai_rules_result.txt').trim();
|
||||
if ("0".equals(res)) {
|
||||
addGitLabMRComment comment: "All Changed files in Merge Request follow OAI Formatting Rules"
|
||||
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): All Changed files in Merge Request follow OAI Formatting Rules"
|
||||
addGitLabMRComment comment: message
|
||||
} else {
|
||||
addGitLabMRComment comment: "Some Changed files in Merge Request DO NOT follow OAI Formatting Rules"
|
||||
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some Changed files in Merge Request DO NOT follow OAI Formatting Rules"
|
||||
addGitLabMRComment comment: message
|
||||
}
|
||||
} else {
|
||||
echo "Git Branch is ${GIT_BRANCH}"
|
||||
echo "Git Commit is ${GIT_COMMIT}"
|
||||
|
||||
sh "zip -r -qq localZip.zip ."
|
||||
// Running astyle options on all C/H files in the repository
|
||||
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
|
||||
sh "./ci-scripts/checkCodingFormattingRules.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
script {
|
||||
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI"
|
||||
addGitLabMRComment comment: message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- cppcheck") {
|
||||
steps {
|
||||
sh "./ci-scripts/createVM.sh --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- enb-usrp") {
|
||||
steps {
|
||||
sh "./ci-scripts/createVM.sh --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- basic-sim") {
|
||||
steps {
|
||||
sh "./ci-scripts/createVM.sh --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- phy-sim") {
|
||||
steps {
|
||||
sh "./ci-scripts/createVM.sh --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- enb-ethernet") {
|
||||
steps {
|
||||
sh "./ci-scripts/createVM.sh --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- ue-ethernet") {
|
||||
steps {
|
||||
sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Variant Builds") {
|
||||
parallel {
|
||||
stage ("Analysis with cppcheck") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Analysis with cppcheck") {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build eNb-USRP") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build eNb-USRP") {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build basic simulator") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build basic-sim") {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build physical simulators") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build phy-sim") {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build eNb-ethernet") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build eNb-ethernet") {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build UE-ethernet") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build UE-ethernet") {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
dir ('archives') {
|
||||
sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth"
|
||||
}
|
||||
if(fileExists('archives/vm_build_logs.zip')) {
|
||||
archiveArtifacts artifacts: 'archives/vm_build_logs.zip'
|
||||
}
|
||||
if ("MERGE".equals(env.gitlabActionType)) {
|
||||
sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
|
||||
} else {
|
||||
sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
|
||||
}
|
||||
if(fileExists('build_results.html')) {
|
||||
archiveArtifacts artifacts: 'build_results.html'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Variant Tests") {
|
||||
parallel {
|
||||
stage ("Test physical simulators") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Test phy-sim") {
|
||||
sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Test basic simulator") {
|
||||
steps {
|
||||
//gitlabCommitStatus(name: "Test basic-sim") {
|
||||
sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
dir ('archives') {
|
||||
sh "if [ -d */test ]; then zip -r -qq vm_tests_logs.zip */test ; fi"
|
||||
}
|
||||
if(fileExists('archives/vm_tests_logs.zip')) {
|
||||
archiveArtifacts artifacts: 'archives/vm_tests_logs.zip'
|
||||
archiveArtifacts artifacts: 'archives/*/test/results_autotests*.xml'
|
||||
archiveArtifacts artifacts: 'archives/*/test/*.xsl'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Destroy all Virtual Machines") {
|
||||
steps {
|
||||
sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
echo "End of script"
|
||||
// Stage destroy may not be run if error in previous stage
|
||||
sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
success {
|
||||
script {
|
||||
def message = "OAI build #" + BUILD_ID + " passed (" + BUILD_URL + ")"
|
||||
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")"
|
||||
if ("MERGE".equals(env.gitlabActionType)) {
|
||||
echo "This is a MERGE event"
|
||||
addGitLabMRComment comment: message
|
||||
def message2 = "OAI build #" + BUILD_ID + " passed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
||||
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
||||
slackSend channel: 'ci-enb', color: 'good', message: message2
|
||||
} else {
|
||||
slackSend channel: 'ci-enb', color: 'good', message: message
|
||||
@@ -59,11 +218,11 @@ pipeline {
|
||||
}
|
||||
failure {
|
||||
script {
|
||||
def message = "OAI build #" + BUILD_ID + " failed (" + BUILD_URL + ")"
|
||||
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")"
|
||||
if ("MERGE".equals(env.gitlabActionType)) {
|
||||
echo "This is a MERGE event"
|
||||
addGitLabMRComment comment: message
|
||||
def message2 = "OAI build #" + BUILD_ID + " failed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
||||
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
||||
slackSend channel: 'ci-enb', color: 'danger', message: message2
|
||||
} else {
|
||||
slackSend channel: 'ci-enb', color: 'danger', message: message
|
||||
|
||||
@@ -1,51 +1,121 @@
|
||||
#!/bin/bash
|
||||
|
||||
function usage {
|
||||
echo "OAI Coding / Formatting Guideline Check script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
echo " Requirement: astyle shall be installed"
|
||||
echo ""
|
||||
echo " By default (no options) the complete repository will be checked"
|
||||
echo " In case of merge request, provided source and target branch,"
|
||||
echo " the script will check only the modified files"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo " checkCodingFormattingRules.sh [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "--------"
|
||||
echo " --src-branch #### OR -sb ####"
|
||||
echo " Specify the source branch of the merge request."
|
||||
echo ""
|
||||
echo " --target-branch #### OR -tb ####"
|
||||
echo " Specify the target branch of the merge request (usually develop)."
|
||||
echo ""
|
||||
echo " --help OR -h"
|
||||
echo " Print this help message."
|
||||
echo ""
|
||||
}
|
||||
|
||||
if [ $# -ne 4 ] && [ $# -ne 1 ] && [ $# -ne 0 ]
|
||||
then
|
||||
echo "Syntax Error: not the correct number of arguments"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo " ---- Checking the whole repository ----"
|
||||
echo ""
|
||||
NB_FILES_TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt --recursive *.c *.h | grep -c Formatted `
|
||||
echo "Nb Files that do NOT follow OAI rules: $NB_FILES_TO_FORMAT"
|
||||
echo $NB_FILES_TO_FORMAT > ./oai_rules_result.txt
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $# -eq 2 ]
|
||||
then
|
||||
# Merge request scenario
|
||||
|
||||
SOURCE_BRANCH=$1
|
||||
echo "Source Branch is : $SOURCE_BRANCH"
|
||||
|
||||
TARGET_BRANCH=$2
|
||||
echo "Target Branch is : $TARGET_BRANCH"
|
||||
|
||||
MERGE_COMMMIT=`git log -n1 | grep commit | sed -e "s@commit @@"`
|
||||
echo "Merged Commit is : $MERGE_COMMMIT"
|
||||
TARGET_INIT_COMMIT=`cat .git/refs/remotes/origin/$TARGET_BRANCH`
|
||||
echo "Target Init is : $TARGET_INIT_COMMIT"
|
||||
|
||||
# Retrieve the list of modified files since the latest develop commit
|
||||
MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq`
|
||||
NB_TO_FORMAT=0
|
||||
for FULLFILE in $MODIFIED_FILES
|
||||
do
|
||||
echo $FULLFILE
|
||||
filename=$(basename -- "$FULLFILE")
|
||||
EXT="${filename##*.}"
|
||||
if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ]
|
||||
then
|
||||
TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted `
|
||||
NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT))
|
||||
fi
|
||||
done
|
||||
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT"
|
||||
echo $NB_TO_FORMAT > ./oai_rules_result.txt
|
||||
checker=0
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
shift
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
-sb|--src-branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
let "checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tb|--target-branch)
|
||||
TARGET_BRANCH="$2"
|
||||
let "checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
|
||||
if [ $# -ne 0 ] || [ $# -ne 2 ]
|
||||
done
|
||||
|
||||
|
||||
if [ $checker -ne 3 ]
|
||||
then
|
||||
echo "Syntax error: $0 without any option will check all files in repository"
|
||||
echo " or: $0 source-branch target-branch"
|
||||
echo " will only check files that are pushed for a merge-request"
|
||||
echo "Source Branch is : $SOURCE_BRANCH"
|
||||
echo "Target Branch is : $TARGET_BRANCH"
|
||||
echo ""
|
||||
echo "Syntax Error: missing option"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Merge request scenario
|
||||
|
||||
MERGE_COMMMIT=`git log -n1 | grep commit | sed -e "s@commit @@"`
|
||||
TARGET_INIT_COMMIT=`cat .git/refs/remotes/origin/$TARGET_BRANCH`
|
||||
|
||||
echo " ---- Checking the modified files by the merge request ----"
|
||||
echo ""
|
||||
echo "Source Branch is : $SOURCE_BRANCH"
|
||||
echo "Target Branch is : $TARGET_BRANCH"
|
||||
echo "Merged Commit is : $MERGE_COMMMIT"
|
||||
echo "Target Init is : $TARGET_INIT_COMMIT"
|
||||
|
||||
# Retrieve the list of modified files since the latest develop commit
|
||||
MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq`
|
||||
NB_TO_FORMAT=0
|
||||
for FULLFILE in $MODIFIED_FILES
|
||||
do
|
||||
echo $FULLFILE
|
||||
filename=$(basename -- "$FULLFILE")
|
||||
EXT="${filename##*.}"
|
||||
if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ]
|
||||
then
|
||||
TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted `
|
||||
NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT))
|
||||
fi
|
||||
done
|
||||
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT"
|
||||
echo $NB_TO_FORMAT > ./oai_rules_result.txt
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,23 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -ne 4 ]
|
||||
function usage {
|
||||
echo "OAI GitLab merge request applying script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo ""
|
||||
echo " doGitLabMerge.sh [OPTIONS] [MANDATORY_OPTIONS]"
|
||||
echo ""
|
||||
echo "Mandatory Options:"
|
||||
echo "------------------"
|
||||
echo ""
|
||||
echo " --src-branch #### OR -sb ####"
|
||||
echo " Specify the source branch of the merge request."
|
||||
echo ""
|
||||
echo " --src-commit #### OR -sc ####"
|
||||
echo " Specify the source commit ID (SHA-1) of the merge request."
|
||||
echo ""
|
||||
echo " --target-branch #### OR -tb ####"
|
||||
echo " Specify the target branch of the merge request (usually develop)."
|
||||
echo ""
|
||||
echo " --target-commit #### OR -tc ####"
|
||||
echo " Specify the target commit ID (SHA-1) of the merge request."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "--------"
|
||||
echo " --help OR -h"
|
||||
echo " Print this help message."
|
||||
echo ""
|
||||
}
|
||||
|
||||
if [ $# -ne 8 ] && [ $# -ne 1 ]
|
||||
then
|
||||
echo "Syntax Error: $0 src-branch src-commit-id dest-branch dest-commit-id"
|
||||
echo "Syntax Error: not the correct number of arguments"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SOURCE_BRANCH=$1
|
||||
checker=0
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
shift
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-sb|--src-branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
let "checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-sc|--src-commit)
|
||||
SOURCE_COMMIT_ID="$2"
|
||||
let "checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tb|--target-branch)
|
||||
TARGET_BRANCH="$2"
|
||||
let "checker|=0x4"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tc|--target-commit)
|
||||
TARGET_COMMIT_ID="$2"
|
||||
let "checker|=0x8"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
echo "Source Branch is : $SOURCE_BRANCH"
|
||||
|
||||
SOURCE_COMMIT_ID=$2
|
||||
echo "Source Commit ID is : $SOURCE_COMMIT_ID"
|
||||
|
||||
TARGET_BRANCH=$3
|
||||
echo "Target Branch is : $TARGET_BRANCH"
|
||||
|
||||
TARGET_COMMIT_ID=$4
|
||||
echo "Target Commit ID is : $TARGET_COMMIT_ID"
|
||||
|
||||
if [ $checker -ne 15 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: missing option"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git config user.email "jenkins@openairinterface.org"
|
||||
git config user.name "OAI Jenkins"
|
||||
|
||||
@@ -25,3 +104,10 @@ git checkout -f $SOURCE_COMMIT_ID
|
||||
|
||||
git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI"
|
||||
|
||||
STATUS=`git status | egrep -c "You have unmerged paths.|fix conflicts"`
|
||||
if [ $STATUS -ne 0 ]
|
||||
then
|
||||
echo "There are merge conflicts.. Cannot perform further build tasks"
|
||||
STATUS=-1
|
||||
fi
|
||||
exit $STATUS
|
||||
|
||||
+147
-273
@@ -170,7 +170,7 @@ set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
|
||||
# add autotools definitions that were maybe used!
|
||||
set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
|
||||
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -DASN_DISABLE_OER_SUPPORT -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 "
|
||||
@@ -244,7 +244,7 @@ add_boolean_option(TEST_OMG False "???")
|
||||
add_boolean_option(DEBUG_OMG False "???")
|
||||
add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope")
|
||||
add_boolean_option(PRINT_STATS False "This adds the possibility to see the status")
|
||||
add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" )
|
||||
add_boolean_option(T_TRACER True "Activate the T tracer, a debugging/monitoring framework" )
|
||||
add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs")
|
||||
add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace")
|
||||
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
|
||||
@@ -262,7 +262,6 @@ if (${ENABLE_ITTI})
|
||||
# add .h files if depend on (this one is generated)
|
||||
${ITTI_DIR}/intertask_interface.h
|
||||
${ITTI_DIR}/intertask_interface.c
|
||||
${ITTI_DIR}/intertask_interface_dump.c
|
||||
${ITTI_DIR}/backtrace.c
|
||||
${ITTI_DIR}/memory_pools.c
|
||||
${ITTI_DIR}/signals.c
|
||||
@@ -281,8 +280,8 @@ endif (${ENABLE_ITTI})
|
||||
# (so creating new asn.1 objects instead of modifying the object attributes)
|
||||
# New C code source file, cmake must be re-run (instead of re-running make only)
|
||||
#############
|
||||
set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1")
|
||||
set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1")
|
||||
# set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1")
|
||||
# set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1")
|
||||
set(asn1_generated_dir ${OPENAIR_BIN_DIR})
|
||||
|
||||
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
|
||||
@@ -302,31 +301,35 @@ elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
|
||||
make_version(RRC_VERSION 10 2 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
|
||||
else()
|
||||
make_version(RRC_VERSION 14 3 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel11")
|
||||
make_version(RRC_VERSION 11 18 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-11.18.0.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel12")
|
||||
make_version(RRC_VERSION 12 16 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-12.16.0.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel13")
|
||||
make_version(RRC_VERSION 13 9 1)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel14")
|
||||
make_version(RRC_VERSION 14 7 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel15")
|
||||
make_version(RRC_VERSION 15 2 2)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.2.asn1)
|
||||
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
|
||||
add_definitions(-DRRC_VERSION=${RRC_VERSION})
|
||||
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
|
||||
if(NOT EXISTS ${asn1c_call})
|
||||
message( FATAL_ERROR "The script ${asn1c_call} must be present" )
|
||||
endif(NOT EXISTS ${asn1c_call})
|
||||
execute_process(COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
message("calling asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}")
|
||||
execute_process(COMMAND mkdir -p ${RRC_FULL_DIR}
|
||||
COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${asn1c_call}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
if(NOT EXISTS ${fix_asn1c_call})
|
||||
message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" )
|
||||
endif(NOT EXISTS ${fix_asn1c_call})
|
||||
execute_process(COMMAND ${fix_asn1c_call} ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${fix_asn1c_call}: error")
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
|
||||
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
|
||||
file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
|
||||
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
|
||||
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn_constant.h)
|
||||
set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
|
||||
add_library(RRC_LIB ${rrc_h} ${rrc_source}
|
||||
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c
|
||||
@@ -336,9 +339,9 @@ include_directories ("${RRC_FULL_DIR}")
|
||||
# add the command to generate the source code
|
||||
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
|
||||
add_custom_command (
|
||||
OUTPUT ${RRC_FULL_DIR}/asn1_constants.h
|
||||
COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
COMMAND ${fix_asn1c_call} ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION}
|
||||
OUTPUT ${RRC_FULL_DIR}/asn_constant.h
|
||||
COMMAND mkdir -p ${RRC_FULL_DIR}
|
||||
COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
DEPENDS ${RRC_GRAMMAR}
|
||||
)
|
||||
|
||||
@@ -346,65 +349,56 @@ add_custom_command (
|
||||
# Same limitation as described in RRC: unknown generated file list
|
||||
# so we generate it at cmake time
|
||||
##############
|
||||
add_list1_option(S1AP_RELEASE R10 "S1AP ASN.1 grammar version" R8 R9 R10)
|
||||
add_list1_option(S1AP_RELEASE R14 "S1AP ASN.1 grammar version" R8 R9 R10 R14 R15)
|
||||
|
||||
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
|
||||
if (${S1AP_RELEASE} STREQUAL "R8")
|
||||
make_version(S1AP_VERSION 8 10 0)
|
||||
set (ASN1RELDIR R8.10)
|
||||
set(S1AP_ASN_FILES "s1ap-8.10.0.asn1")
|
||||
elseif (${S1AP_RELEASE} STREQUAL "R9")
|
||||
make_version(S1AP_VERSION 9 8 0)
|
||||
set (ASN1RELDIR R9.8)
|
||||
make_version(S1AP_VERSION 9 10 0)
|
||||
set(S1AP_ASN_FILES "s1ap-9.10.0.asn1")
|
||||
elseif (${S1AP_RELEASE} STREQUAL "R10")
|
||||
make_version(S1AP_VERSION 10 5 0)
|
||||
set (ASN1RELDIR R10.5)
|
||||
make_version(S1AP_VERSION 10 9 0)
|
||||
set(S1AP_ASN_FILES "s1ap-10.9.0.asn1")
|
||||
elseif (${S1AP_RELEASE} STREQUAL "R11")
|
||||
make_version(S1AP_VERSION 11 8 0)
|
||||
set(S1AP_ASN_FILES "s1ap-11.8.0.asn1")
|
||||
elseif (${S1AP_RELEASE} STREQUAL "R12")
|
||||
make_version(S1AP_VERSION 12 7 0)
|
||||
set(S1AP_ASN_FILES "s1ap-12.7.0.asn1")
|
||||
elseif (${S1AP_RELEASE} STREQUAL "R13")
|
||||
make_version(S1AP_VERSION 13 6 0)
|
||||
set(S1AP_ASN_FILES "s1ap-13.6.0.asn1")
|
||||
elseif (${S1AP_RELEASE} STREQUAL "R14")
|
||||
make_version(S1AP_VERSION 14 5 0)
|
||||
set(S1AP_ASN_FILES "s1ap-14.5.0.asn1")
|
||||
else (${S1AP_RELEASE} STREQUAL "R15")
|
||||
make_version(S1AP_VERSION 15 1 0)
|
||||
set(S1AP_ASN_FILES "s1ap-15.1.0.asn1")
|
||||
endif(${S1AP_RELEASE} STREQUAL "R8")
|
||||
add_definitions(-DS1AP_VERSION=${S1AP_VERSION})
|
||||
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
|
||||
set(S1AP_ASN_FILES
|
||||
${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
|
||||
${S1AP_ASN_DIR}/S1AP-Constants.asn
|
||||
${S1AP_ASN_DIR}/S1AP-IEs.asn
|
||||
${S1AP_ASN_DIR}/S1AP-PDU.asn
|
||||
)
|
||||
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${ASN1RELDIR})
|
||||
#message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
|
||||
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
|
||||
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${S1AP_RELEASE})
|
||||
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE})
|
||||
message("calling ASN1C_PREFIX=S1AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}")
|
||||
execute_process(COMMAND mkdir -p ${S1AP_C_DIR}
|
||||
COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${asn1c_call}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "asn1tostruct.py: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_RELEASE}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${fix_asn1c_call}: error")
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
|
||||
|
||||
set(S1AP_OAI_generated
|
||||
${S1AP_C_DIR}/s1ap_decoder.c
|
||||
${S1AP_C_DIR}/s1ap_encoder.c
|
||||
${S1AP_C_DIR}/s1ap_xer_print.c
|
||||
${S1AP_C_DIR}/s1ap_compare.c
|
||||
${S1AP_C_DIR}/s1ap_ies_defs.h
|
||||
)
|
||||
file(GLOB s1ap_h ${S1AP_C_DIR}/*.h)
|
||||
set(s1ap_h ${s1ap_h} )
|
||||
set(s1ap_h ${s1ap_h})
|
||||
|
||||
add_custom_command (
|
||||
OUTPUT ${S1AP_OAI_generated}
|
||||
COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
|
||||
COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
|
||||
COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_RELEASE}
|
||||
DEPENDS ${S1AP_ASN_FILES}
|
||||
)
|
||||
OUTPUT ${S1AP_C_DIR}/S1AP_asn_constant.h
|
||||
COMMAND mkdir -p ${S1AP_C_DIR}
|
||||
COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
|
||||
DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
|
||||
)
|
||||
add_library(S1AP_LIB
|
||||
${S1AP_OAI_generated}
|
||||
${S1AP_source}
|
||||
${S1AP_DIR}/s1ap_common.c
|
||||
)
|
||||
@@ -413,7 +407,6 @@ include_directories ("${S1AP_C_DIR}")
|
||||
include_directories ("${S1AP_DIR}")
|
||||
|
||||
add_library(S1AP_ENB
|
||||
${S1AP_C_DIR}/s1ap_ies_defs.h
|
||||
${S1AP_DIR}/s1ap_eNB.c
|
||||
${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
|
||||
${S1AP_DIR}/s1ap_eNB_decoder.c
|
||||
@@ -428,70 +421,52 @@ add_library(S1AP_ENB
|
||||
${S1AP_DIR}/s1ap_eNB_ue_context.c
|
||||
)
|
||||
|
||||
|
||||
|
||||
#X2AP
|
||||
# Same limitation as described in RRC/S1AP: unknown generated file list
|
||||
# so we generate it at cmake time
|
||||
##############
|
||||
add_list1_option(X2AP_RELEASE R11 "X2AP ASN.1 grammar version" R10 R11)
|
||||
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
|
||||
if (${X2AP_RELEASE} STREQUAL "R10")
|
||||
make_version(S1AP_VERSION 10 0 0)
|
||||
set (ASN1RELDIR R.UNKNOWN)
|
||||
elseif (${X2AP_RELEASE} STREQUAL "R11")
|
||||
make_version(S1AP_VERSION 11 2 0)
|
||||
set (ASN1RELDIR R11.2)
|
||||
endif(${X2AP_RELEASE} STREQUAL "R10")
|
||||
add_definitions(-DX2AP_VERSION=${X2AP_VERSION})
|
||||
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
|
||||
set(X2AP_ASN_FILES
|
||||
${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn
|
||||
${X2AP_ASN_DIR}/X2AP-Constants.asn
|
||||
${X2AP_ASN_DIR}/X2AP-IEs.asn
|
||||
${X2AP_ASN_DIR}/X2AP-PDU.asn
|
||||
${X2AP_ASN_DIR}/X2AP-Containers.asn
|
||||
)
|
||||
add_list1_option(X2AP_RELEASE R14 "X2AP ASN.1 grammar version" R8 R11 R12 R14 R15)
|
||||
|
||||
set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${ASN1RELDIR})
|
||||
#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
|
||||
execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
|
||||
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
|
||||
if (${X2AP_RELEASE} STREQUAL "R8")
|
||||
make_version(X2AP_VERSION 8 9 0)
|
||||
set(X2AP_ASN_FILES x2ap-8.9.0.asn1)
|
||||
elseif (${X2AP_RELEASE} STREQUAL "R11")
|
||||
make_version(X2AP_VERSION 11 9 0)
|
||||
set(X2AP_ASN_FILES x2ap-11.9.0.asn1)
|
||||
elseif (${X2AP_RELEASE} STREQUAL "R12")
|
||||
make_version(X2AP_VERSION 12 9 0)
|
||||
set(X2AP_ASN_FILES x2ap-12.9.0.asn1)
|
||||
elseif (${X2AP_RELEASE} STREQUAL "R14")
|
||||
make_version(X2AP_VERSION 14 6 0)
|
||||
set(X2AP_ASN_FILES x2ap-14.6.0.asn1)
|
||||
elseif (${X2AP_RELEASE} STREQUAL "R15")
|
||||
make_version(X2AP_VERSION 15 1 0)
|
||||
set(X2AP_ASN_FILES x2ap-15.1.0.asn1)
|
||||
endif(${X2AP_RELEASE} STREQUAL "R8")
|
||||
add_definitions(-DX2AP_VERSION=${X2AP_VERSION})
|
||||
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${X2AP_RELEASE})
|
||||
set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE})
|
||||
message("calling ASN1C_PREFIX=X2AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}")
|
||||
execute_process(COMMAND mkdir -p ${X2AP_C_DIR}
|
||||
COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${asn1c_call}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "asn1tostruct.py: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
execute_process(COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_RELEASE}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${fix_asn1c_call}: error")
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)
|
||||
|
||||
set(X2AP_OAI_generated
|
||||
${X2AP_C_DIR}/x2ap_decoder.c
|
||||
${X2AP_C_DIR}/x2ap_encoder.c
|
||||
${X2AP_C_DIR}/x2ap_xer_print.c
|
||||
${X2AP_C_DIR}/x2ap_ies_defs.h
|
||||
)
|
||||
file(GLOB x2ap_h ${X2AP_C_DIR}/*.h)
|
||||
set(x2ap_h ${x2ap_h} )
|
||||
set(x2ap_h ${x2ap_h})
|
||||
|
||||
#message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}")
|
||||
add_custom_command (
|
||||
OUTPUT ${X2AP_OAI_generated}
|
||||
COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
|
||||
COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
|
||||
COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_RELEASE}
|
||||
DEPENDS ${X2AP_ASN_FILES}
|
||||
OUTPUT ${X2AP_C_DIR}/X2AP_asn_constant.h
|
||||
COMMAND mkdir -p ${X2AP_C_DIR}
|
||||
COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
|
||||
DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
|
||||
)
|
||||
|
||||
add_library(X2AP_LIB
|
||||
${X2AP_OAI_generated}
|
||||
${X2AP_source}
|
||||
${X2AP_DIR}/x2ap_common.c
|
||||
)
|
||||
@@ -515,12 +490,12 @@ set (CONFIG_SOURCES
|
||||
${CONFIG_ROOTDIR}/config_load_configmodule.c
|
||||
${CONFIG_ROOTDIR}/config_userapi.c
|
||||
${CONFIG_ROOTDIR}/config_cmdline.c
|
||||
)
|
||||
)
|
||||
set (CONFIG_LIBCONFIG_SOURCES
|
||||
${CONFIG_ROOTDIR}/libconfig/config_libconfig.c
|
||||
)
|
||||
)
|
||||
add_library(params_libconfig MODULE ${CONFIG_LIBCONFIG_SOURCES} )
|
||||
target_link_libraries(params_libconfig config)
|
||||
target_link_libraries(params_libconfig config)
|
||||
# shared library loader
|
||||
set (SHLIB_LOADER_SOURCES
|
||||
${OPENAIR_DIR}/common/utils/load_module_shlib.c
|
||||
@@ -621,9 +596,7 @@ add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the d
|
||||
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
|
||||
add_boolean_option(DEADLINE_SCHEDULER True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
|
||||
add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only valid without deadline scheduler). It is enabled only with >2 CPUs")
|
||||
add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver")
|
||||
add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????")
|
||||
add_boolean_option(OAISIM False "specific to oaisim")
|
||||
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
|
||||
|
||||
add_boolean_option(USE_MME False "this flag is used only one time in lte-softmodem.c")
|
||||
@@ -632,6 +605,10 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc
|
||||
add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams")
|
||||
add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams")
|
||||
|
||||
add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE")
|
||||
add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE")
|
||||
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
|
||||
|
||||
########################
|
||||
# Include order
|
||||
##########################
|
||||
@@ -652,9 +629,7 @@ add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
|
||||
# PHY options
|
||||
##########################
|
||||
add_boolean_option(DRIVER2013 True "only relevant for EXMIMO")
|
||||
add_boolean_option(ENABLE_NEW_MULTICAST False "specific to oaisim")
|
||||
add_boolean_option(EXMIMO_IOT True "????")
|
||||
add_boolean_option(LARGE_SCALE False "specific to oaisim: defines max eNB=2 and max UE=120")
|
||||
add_boolean_option(LOCALIZATION False "???")
|
||||
add_integer_option(MAX_NUM_CCs 1 "????")
|
||||
add_boolean_option(MU_RECEIVER False "????")
|
||||
@@ -665,6 +640,7 @@ add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector
|
||||
add_boolean_option(DEBUG_PHY False "Enable PHY layer debugging options")
|
||||
add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer procedures")
|
||||
add_boolean_option(DEBUG_DLSCH False "Enable debugging of DLSCH physical layer channel")
|
||||
add_boolean_option(MEX False "Enabling compilation with mex")
|
||||
|
||||
##########################
|
||||
# NAS LAYER OPTIONS
|
||||
@@ -677,7 +653,6 @@ add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)")
|
||||
##########################
|
||||
# ACCESS STRATUM LAYER2 OPTIONS
|
||||
##########################
|
||||
add_boolean_option(MAC_CONTEXT True "specific to oaisim")
|
||||
add_boolean_option(JUMBO_FRAME True "ENABLE LARGE SDU in ACCESS STRATUM (larger than common MTU)")
|
||||
|
||||
##########################
|
||||
@@ -923,7 +898,7 @@ set(UTIL_SRC
|
||||
${OPENAIR2_DIR}/UTIL/LISTS/list.c
|
||||
${OPENAIR2_DIR}/UTIL/LISTS/list2.c
|
||||
${OPENAIR2_DIR}/UTIL/LOG/log.c
|
||||
${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
|
||||
# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
|
||||
${OPENAIR2_DIR}/UTIL/MATH/oml.c
|
||||
${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
|
||||
# ${OPENAIR2_DIR}/UTIL/OCG/OCG.c
|
||||
@@ -985,7 +960,7 @@ set(SECU_CN_SRC
|
||||
)
|
||||
add_library(SECU_CN ${SECU_CN_SRC})
|
||||
|
||||
# Physical Channel Procedures Scheduling
|
||||
# Physical Channel Procedures Scheduling
|
||||
################################"
|
||||
set(SCHED_SRC
|
||||
${OPENAIR1_DIR}/SCHED/fapi_l1.c
|
||||
@@ -1078,13 +1053,14 @@ set(PHY_TURBOIF
|
||||
add_library(coding MODULE ${PHY_TURBOSRC} )
|
||||
set(PHY_SRC_COMMON
|
||||
# depend on code generation from asn1c
|
||||
${RRC_FULL_DIR}/asn1_constants.h
|
||||
${RRC_FULL_DIR}/asn_constant.h
|
||||
# actual source
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
|
||||
# ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slss.c
|
||||
# ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sldch.c
|
||||
# ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slsch.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/get_pmi.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich_common.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich_common.c
|
||||
@@ -1093,6 +1069,7 @@ set(PHY_SRC_COMMON
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach_common.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch_common.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_gold_generic.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/srs_modulation.c
|
||||
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
|
||||
@@ -1114,7 +1091,6 @@ set(PHY_SRC_COMMON
|
||||
${OPENAIR1_DIR}/PHY/INIT/init_top.c
|
||||
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
|
||||
${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
|
||||
@@ -1173,6 +1149,7 @@ set(PHY_SRC_UE
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/sss_ue.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c
|
||||
@@ -1220,6 +1197,27 @@ add_library(PHY ${PHY_SRC})
|
||||
add_library(PHY_UE ${PHY_SRC_UE})
|
||||
add_library(PHY_RU ${PHY_SRC_RU})
|
||||
|
||||
#Library for mex functions
|
||||
#########################3
|
||||
set(PHY_MEX_UE
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/get_pmi.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch_common.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
|
||||
${OPENAIR2_DIR}/UTIL/LOG/log.c
|
||||
)
|
||||
add_library(PHY_MEX ${PHY_MEX_UE})
|
||||
|
||||
#Layer 2 library
|
||||
#####################
|
||||
set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC)
|
||||
@@ -1334,6 +1332,7 @@ set (MAC_SRC
|
||||
${MAC_DIR}/eNB_scheduler_bch.c
|
||||
${MAC_DIR}/eNB_scheduler_primitives.c
|
||||
${MAC_DIR}/eNB_scheduler_RA.c
|
||||
${MAC_DIR}/eNB_scheduler_fairRR.c
|
||||
${MAC_DIR}/eNB_scheduler_phytest.c
|
||||
${MAC_DIR}/pre_processor.c
|
||||
${MAC_DIR}/config.c
|
||||
@@ -1720,12 +1719,14 @@ ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_channel.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_tv_channel.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/abstraction.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/channel_sim.c
|
||||
${OPENAIR1_DIR}/SIMULATION/RF/rf.c
|
||||
${OPENAIR1_DIR}/SIMULATION/RF/dac.c
|
||||
${OPENAIR1_DIR}/SIMULATION/RF/adc.c
|
||||
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
||||
)
|
||||
|
||||
|
||||
add_library(SIMU_ETH
|
||||
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
||||
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
|
||||
@@ -1812,11 +1813,13 @@ endif()
|
||||
# So, here are some hacks here. Hope this gets fixed in future!
|
||||
if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h")
|
||||
include_directories("/usr/include/atlas")
|
||||
LINK_DIRECTORIES("/usr/lib/lapack")
|
||||
LINK_DIRECTORIES("/usr/lib64")
|
||||
LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here!
|
||||
|
||||
|
||||
if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7
|
||||
list(APPEND ATLAS_LIBRARIES blas)
|
||||
|
||||
else() # Case for Ubuntu
|
||||
list(APPEND ATLAS_LIBRARIES cblas)
|
||||
endif()
|
||||
@@ -1842,6 +1845,8 @@ else()
|
||||
message("No Blas/Atlas libs found, some targets will fail")
|
||||
endif()
|
||||
|
||||
list(APPEND ATLAS_LIBRARIES lapack lapacke)
|
||||
|
||||
if (${XFORMS})
|
||||
include_directories ("/usr/include/X11")
|
||||
set(XFORMS_SOURCE
|
||||
@@ -1899,7 +1904,6 @@ add_definitions(-DASN1_MINIMUM_VERSION=924)
|
||||
add_executable(lte-softmodem
|
||||
${rrc_h}
|
||||
${s1ap_h}
|
||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
@@ -1924,7 +1928,7 @@ add_executable(lte-softmodem
|
||||
|
||||
target_link_libraries (lte-softmodem
|
||||
-Wl,--start-group
|
||||
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
|
||||
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
|
||||
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
-Wl,--end-group z dl)
|
||||
@@ -1939,7 +1943,6 @@ target_link_libraries (lte-softmodem ${T_LIB})
|
||||
add_executable(lte-softmodem-nos1
|
||||
${rrc_h}
|
||||
${s1ap_h}
|
||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
@@ -1962,7 +1965,7 @@ add_executable(lte-softmodem-nos1
|
||||
)
|
||||
target_link_libraries (lte-softmodem-nos1
|
||||
-Wl,--start-group
|
||||
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
|
||||
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
|
||||
${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
|
||||
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
-Wl,--end-group z dl )
|
||||
@@ -1978,10 +1981,11 @@ target_link_libraries (lte-softmodem-nos1 ${T_LIB})
|
||||
add_executable(lte-uesoftmodem
|
||||
${rrc_h}
|
||||
${s1ap_h}
|
||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/rfsim.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
|
||||
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
|
||||
@@ -2000,13 +2004,13 @@ add_executable(lte-uesoftmodem
|
||||
|
||||
target_link_libraries (lte-uesoftmodem
|
||||
-Wl,--start-group
|
||||
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
|
||||
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
|
||||
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem ${T_LIB})
|
||||
|
||||
@@ -2015,10 +2019,11 @@ target_link_libraries (lte-uesoftmodem ${T_LIB})
|
||||
add_executable(lte-uesoftmodem-nos1
|
||||
${rrc_h}
|
||||
${s1ap_h}
|
||||
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/rfsim.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
|
||||
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
|
||||
@@ -2038,13 +2043,13 @@ add_executable(lte-uesoftmodem-nos1
|
||||
|
||||
target_link_libraries (lte-uesoftmodem-nos1
|
||||
-Wl,--start-group
|
||||
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
|
||||
${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
|
||||
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
|
||||
${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
|
||||
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
-Wl,--end-group z dl )
|
||||
|
||||
target_link_libraries (lte-uesoftmodem-nos1 ${LIBXML2_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem-nos1 ${LIB_LMS_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
|
||||
|
||||
@@ -2075,103 +2080,12 @@ target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
|
||||
# Addexecutables for tests
|
||||
####################################
|
||||
|
||||
# A all in one network simulator
|
||||
################
|
||||
add_executable(oaisim
|
||||
${rrc_h}
|
||||
${s1ap_h}
|
||||
${x2ap_h}
|
||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
|
||||
# ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/sinr_sim.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/cor_SF_sim.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/event_handler.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/oaisim.c
|
||||
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
|
||||
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
||||
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
|
||||
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
|
||||
${OPENAIR_DIR}/common/utils/utils.c
|
||||
${OPENAIR_DIR}/common/utils/system.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
|
||||
${XFORMS_SOURCE}
|
||||
${T_SOURCE}
|
||||
${CONFIG_SOURCES}
|
||||
${SHLIB_LOADER_SOURCES}
|
||||
)
|
||||
|
||||
|
||||
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
|
||||
target_link_libraries (oaisim
|
||||
-Wl,-ldl,--start-group
|
||||
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE ${MSC_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB}
|
||||
${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
|
||||
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp z
|
||||
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
||||
#Force link with forms, regardless XFORMS option
|
||||
target_link_libraries (oaisim forms)
|
||||
target_link_libraries (oaisim ${T_LIB})
|
||||
|
||||
|
||||
# A all in one network simulator
|
||||
################
|
||||
add_executable(oaisim_nos1
|
||||
${rrc_h}
|
||||
${s1ap_h}
|
||||
${x2ap_h}
|
||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR1_DIR}/SCHED/prach_procedures.c
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
|
||||
# ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/sinr_sim.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/cor_SF_sim.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/event_handler.c
|
||||
${OPENAIR_TARGETS}/SIMU/USER/oaisim.c
|
||||
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
|
||||
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
||||
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
|
||||
${OPENAIR_DIR}/common/utils/system.c
|
||||
${XFORMS_SOURCE}
|
||||
${T_SOURCE}
|
||||
${CONFIG_SOURCES}
|
||||
${SHLIB_LOADER_SOURCES}
|
||||
)
|
||||
target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
|
||||
target_link_libraries (oaisim_nos1
|
||||
-Wl,--start-group
|
||||
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS ${MSC_LIB} ${ITTI_LIB} SIMU L2_UE ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
|
||||
-Wl,--end-group z dl )
|
||||
|
||||
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
|
||||
target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES}
|
||||
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
||||
#Force link with forms, regardless XFORMS option
|
||||
target_link_libraries (oaisim_nos1 forms)
|
||||
|
||||
#message("protobuflib is ${PROTOBUF_LIB}")
|
||||
|
||||
target_link_libraries (oaisim_nos1 ${T_LIB})
|
||||
|
||||
|
||||
# Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator
|
||||
#####################################
|
||||
|
||||
#special case for dlim TM4, which uses its own version of phy_scope code
|
||||
add_executable(dlsim_tm4
|
||||
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dlsim_tm4.c
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope_tm4.c
|
||||
${T_SOURCE}
|
||||
@@ -2184,7 +2098,6 @@ target_link_libraries (dlsim_tm4
|
||||
foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
|
||||
|
||||
add_executable(${myExe}
|
||||
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
|
||||
${XFORMS_SOURCE}
|
||||
${T_SOURCE}
|
||||
@@ -2206,7 +2119,6 @@ add_executable(test_epc_generate_scenario
|
||||
${OPENAIR2_DIR}/COMMON/messages_def.h
|
||||
${OPENAIR2_DIR}/COMMON/messages_types.h
|
||||
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
|
||||
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
)
|
||||
target_link_libraries (test_epc_generate_scenario
|
||||
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
|
||||
@@ -2226,7 +2138,6 @@ add_executable(test_epc_play_scenario
|
||||
${OPENAIR2_DIR}/COMMON/commonDef.h
|
||||
${OPENAIR2_DIR}/COMMON/messages_def.h
|
||||
${OPENAIR2_DIR}/COMMON/messages_types.h
|
||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
)
|
||||
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
|
||||
target_link_libraries (test_epc_play_scenario
|
||||
@@ -2262,7 +2173,7 @@ endforeach(myExe)
|
||||
if (${T_TRACER})
|
||||
foreach(i
|
||||
#all "add_executable" definitions (except tests, rb_tool, updatefw)
|
||||
lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1
|
||||
lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1
|
||||
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
|
||||
pdcchsim pucchsim prachsim syncsim
|
||||
#all "add_library" definitions
|
||||
@@ -2282,43 +2193,6 @@ endif (${T_TRACER})
|
||||
# Generated specific cases is not regular code
|
||||
###############################################
|
||||
|
||||
##################""
|
||||
# itti symbolic debug print require to generate a specific include file
|
||||
########################################
|
||||
|
||||
# retrieve the compiler options to send it to gccxml
|
||||
get_directory_property( DirDefs COMPILE_DEFINITIONS )
|
||||
foreach( d ${DirDefs} )
|
||||
list(APPEND itti_compiler_options "-D${d}")
|
||||
endforeach()
|
||||
get_directory_property( DirDefs INCLUDE_DIRECTORIES )
|
||||
foreach( d ${DirDefs} )
|
||||
list(APPEND itti_compiler_options "-I${d}")
|
||||
endforeach()
|
||||
|
||||
# castxml doesn't work with c11 (gcc 5 default)
|
||||
# force castxml and clang compilation with gnu89 standard
|
||||
# we can't use cXX standard as pthread_rwlock_t is gnu standard
|
||||
list(APPEND itti_compiler_options "-std=gnu89;-D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
|
||||
set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h)
|
||||
if(EXISTS /usr/bin/gccxml)
|
||||
set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H})
|
||||
else()
|
||||
set(xml_command castxml --castxml-gccxml ${itti_compiler_options} ${ITTI_H} -o ${OPENAIR_BIN_DIR}/messages.xml)
|
||||
endif()
|
||||
|
||||
add_custom_command (
|
||||
OUTPUT ${OPENAIR_BIN_DIR}/messages.xml
|
||||
COMMAND ${xml_command}
|
||||
DEPENDS ${S1AP_OAI_generated} ${RRC_FULL_DIR}/asn1_constants.h
|
||||
)
|
||||
|
||||
add_custom_command (
|
||||
OUTPUT ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
COMMAND sed -e 's/ *//' -e 's/\"/\\\\\"/g' -e 's/^/\"/' -e 's/$$/\\\\n\"/' ${OPENAIR_BIN_DIR}/messages.xml > ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||
DEPENDS ${OPENAIR_BIN_DIR}/messages.xml ${RRC_FULL_DIR}/asn1_constants.h
|
||||
)
|
||||
|
||||
################
|
||||
# Kernel modules
|
||||
###############
|
||||
|
||||
@@ -175,10 +175,10 @@ function test_compile() {
|
||||
fi
|
||||
if [ "$result" == "1" ]; then
|
||||
echo_success "$test_case_name.${tags} PASSED"
|
||||
xUnit_success "compilation" "$test_case_name.$tags" "PASS" "$result_string" "$xmlfile_testcase"
|
||||
xUnit_success "compilation" "$test_case_name.$tags" "PASS" "$result_string" "$xmlfile_testcase" ""
|
||||
else
|
||||
echo_error "$test_case_name.${tags} FAILED"
|
||||
xUnit_fail "compilation" "$test_case_name.$tags" "FAIL" "$result_string" "$xmlfile_testcase"
|
||||
xUnit_fail "compilation" "$test_case_name.$tags" "FAIL" "$result_string" "$xmlfile_testcase" ""
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -200,6 +200,8 @@ function test_compile() {
|
||||
#\param $14 -> tags to help identify the test case for readability in output xml file
|
||||
#\param $15 => password for the user to run certain commands as sudo
|
||||
#\param $16 => test config file params to be modified
|
||||
#\param $17 => bypass flag if main_exec if available
|
||||
#\param $18 -> desc to help identify the test case for readability in output xml file
|
||||
|
||||
function test_compile_and_run() {
|
||||
xUnit_start
|
||||
@@ -221,6 +223,8 @@ function test_compile_and_run() {
|
||||
tags=${14}
|
||||
mypassword=${15}
|
||||
test_config_file=${16}
|
||||
bypass_compile=${17}
|
||||
desc=${18}
|
||||
|
||||
build_dir=$tdir/$1/build
|
||||
#exec_file=$build_dir/$6
|
||||
@@ -231,8 +235,6 @@ function test_compile_and_run() {
|
||||
rm -fr $log_dir
|
||||
mkdir -p $log_dir
|
||||
|
||||
rm -fr $OPENAIR_DIR/cmake_targets/log
|
||||
|
||||
echo "" > $temp_exec_log
|
||||
echo "" > $log_file
|
||||
#echo "log_dir = $log_dir"
|
||||
@@ -243,6 +245,7 @@ function test_compile_and_run() {
|
||||
#echo "pre_exec_file = $pre_exec_file"
|
||||
#echo "nruns = $nruns"
|
||||
echo "class = $class"
|
||||
#echo "desc = $desc"
|
||||
|
||||
#compile_prog_array=()
|
||||
#read -a compile_prog_array <<<"$compile_prog"
|
||||
@@ -253,11 +256,19 @@ function test_compile_and_run() {
|
||||
|
||||
tags_array=()
|
||||
read -a tags_array <<<"$tags"
|
||||
desc_array=()
|
||||
readarray -t desc_array <<<"$desc"
|
||||
|
||||
main_exec_args_array=()
|
||||
readarray -t main_exec_args_array <<< "$exec_args"
|
||||
|
||||
|
||||
REAL_MAIN_EXEC=`eval "echo $main_exec"`
|
||||
if [ "$bypass_compile" == "1" ] && [ -f $REAL_MAIN_EXEC ]
|
||||
then
|
||||
echo "Bypassing compilation for $main_exec"
|
||||
else
|
||||
rm -fr $OPENAIR_DIR/cmake_targets/log
|
||||
|
||||
#for search_expr in "${compile_prog_array[@]}"
|
||||
#do
|
||||
echo "Compiling test case $test_case_name Log file = $log_file"
|
||||
@@ -283,6 +294,7 @@ function test_compile_and_run() {
|
||||
}>> $log_file 2>&1
|
||||
echo "</COMPILATION LOG>" >> $log_file 2>&1
|
||||
#done
|
||||
fi
|
||||
|
||||
#process the test case if it is that of execution
|
||||
if [ "$class" == "execution" ]; then
|
||||
@@ -291,6 +303,7 @@ function test_compile_and_run() {
|
||||
do
|
||||
global_result=1
|
||||
result_string=""
|
||||
PROPER_DESC=`echo ${desc_array[$tags_array_index]} | sed -e "s@^.*lsim.*est case.*(Test@Test@" -e "s@^ *(@@" -e "s/),$//"`
|
||||
|
||||
for (( run_index=1; run_index <= $nruns; run_index++ ))
|
||||
do
|
||||
@@ -359,16 +372,16 @@ function test_compile_and_run() {
|
||||
|
||||
if [ "$result_string" == "" ]; then
|
||||
echo_error "execution $test_case_name.$compile_prog.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL"
|
||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase"
|
||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
||||
else
|
||||
if [ "$global_result" == "0" ]; then
|
||||
echo_error "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL"
|
||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase"
|
||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
||||
fi
|
||||
|
||||
if [ "$global_result" == "1" ]; then
|
||||
echo_success "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = PASS "
|
||||
xUnit_success "execution" "$test_case_name.${tags_array[$tags_array_index]}" "PASS" "$result_string" "$xmlfile_testcase"
|
||||
xUnit_success "execution" "$test_case_name.${tags_array[$tags_array_index]}" "PASS" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -393,10 +406,18 @@ Options
|
||||
Run test cases in a group. For example, ./run_exec_autotests "0101* 010102"
|
||||
-p
|
||||
Use password for logging
|
||||
-np | --no-password
|
||||
No need for a password
|
||||
-q | --quiet
|
||||
Quiet mode; eliminate informational messages and comment prompts.
|
||||
-b | --bypass-compile
|
||||
Bypass compilation of main-exec if already present
|
||||
'
|
||||
}
|
||||
|
||||
function main () {
|
||||
QUIET=0
|
||||
BYPASS_COMPILE=0
|
||||
RUN_GROUP=0
|
||||
SET_PASSWORD=0
|
||||
passwd=""
|
||||
@@ -419,6 +440,16 @@ until [ -z "$1" ]
|
||||
SET_PASSWORD=1
|
||||
passwd=$2
|
||||
shift 2;;
|
||||
-np|--no-password)
|
||||
SET_PASSWORD=1
|
||||
shift ;;
|
||||
-q|--quiet)
|
||||
QUIET=1
|
||||
shift ;;
|
||||
-b|--bypass-compile)
|
||||
BYPASS_COMPILE=1
|
||||
echo "bypass option ON"
|
||||
shift ;;
|
||||
-h | --help)
|
||||
print_help
|
||||
exit 1;;
|
||||
@@ -449,15 +480,15 @@ xml_conf="$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml"
|
||||
|
||||
test_case_list=`xmlstarlet sel -T -t -m /testCaseList/testCase -s A:N:- "@id" -v "@id" -n $xml_conf`
|
||||
test_case_excl_list=`xmlstarlet sel -t -v "/testCaseList/TestCaseExclusionList" $xml_conf`
|
||||
echo "Test Case Exclusion List = $test_case_excl_list "
|
||||
if [ $QUIET -eq 0 ]; then echo "Test Case Exclusion List = $test_case_excl_list "; fi
|
||||
|
||||
test_case_excl_list=`sed "s/\+/\*/g" <<< "$test_case_excl_list" ` # Replace + with * for bash string substituion
|
||||
|
||||
read -a test_case_excl_array <<< "$test_case_excl_list"
|
||||
|
||||
echo "test_case_list = $test_case_list"
|
||||
if [ $QUIET -eq 0 ]; then echo "test_case_list = $test_case_list"; fi
|
||||
|
||||
echo "Test Case Exclusion List = $test_case_excl_list \n"
|
||||
if [ $QUIET -eq 0 ]; then echo "Test Case Exclusion List = $test_case_excl_list \n"; fi
|
||||
|
||||
readarray -t test_case_array <<<"$test_case_list"
|
||||
|
||||
@@ -484,7 +515,7 @@ for search_expr in "${test_case_array[@]}"
|
||||
do
|
||||
if [[ $search_expr == $search_excl ]];then
|
||||
flag_run_test_case=0
|
||||
echo_info "Test case $search_expr match found in test case excl group. Will skip the test case for execution..."
|
||||
if [ $QUIET -eq 0 ]; then echo_info "Test case $search_expr match found in test case excl group. Will skip the test case for execution..."; fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -533,8 +564,8 @@ for search_expr in "${test_case_array[@]}"
|
||||
|
||||
search_array_true=()
|
||||
|
||||
IFS=\" #set the shell's field separator
|
||||
set -f #don't try to glob
|
||||
IFS=\" #set the shell field separator
|
||||
set -f #dont try to glob
|
||||
#set -- $search_expr_true #split on $IFS
|
||||
for i in $search_expr_true
|
||||
do echo "i = $i"
|
||||
@@ -548,10 +579,10 @@ for search_expr in "${test_case_array[@]}"
|
||||
#echo "arg1 = ${search_array_true[0]}"
|
||||
#echo " arg2 = ${search_array_true[1]}"
|
||||
if [ "$class" == "compilation" ]; then
|
||||
test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags"
|
||||
test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$desc"
|
||||
elif [ "$class" == "execution" ]; then
|
||||
echo \'passwd\' | $SUDO killall -q oaisim_nos1
|
||||
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" "$test_config_file"
|
||||
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" "$test_config_file" "$BYPASS_COMPILE" "$desc"
|
||||
else
|
||||
echo "Unexpected class of test case...Skipping the test case $name ...."
|
||||
fi
|
||||
|
||||
@@ -955,21 +955,21 @@
|
||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
|
||||
<pre_exec_args></pre_exec_args>
|
||||
<main_exec> $OPENAIR_DIR/cmake_targets/lte-simulators/build/dlsim</main_exec>
|
||||
<main_exec_args> -m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70
|
||||
-m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70
|
||||
-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70
|
||||
-m14 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70
|
||||
-m15 -gG -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30
|
||||
-m14 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30
|
||||
-m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70
|
||||
-m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70
|
||||
-m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70
|
||||
-m26 -gF -s17.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -O70
|
||||
-m26 -gF -s17.3 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1600 -O70
|
||||
-m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O70
|
||||
-m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O70
|
||||
-m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O70</main_exec_args>
|
||||
<main_exec> $OPENAIR_DIR/targets/bin/dlsim.Rel14</main_exec>
|
||||
<main_exec_args> -m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60
|
||||
-m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O60
|
||||
-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60
|
||||
-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c2 -z2 -O60
|
||||
-m15 -gG -s1.4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O25
|
||||
-m15 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c2 -z2 -O25
|
||||
-m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O60
|
||||
-m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O60
|
||||
-m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60
|
||||
-m26 -gF -s17.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -O60
|
||||
-m26 -gF -s17.3 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1600 -O60
|
||||
-m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O60
|
||||
-m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O60
|
||||
-m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O60</main_exec_args>
|
||||
<tags>dlsim.test1 dlsim.test5 dlsim.test6 dlsim.test6b dlsim.test7 dlsim.test7b dlsim.test10 dlsim.test10b dlsim.test11 dlsim.TM2_test1 dlsim.TM2_test1b</tags>
|
||||
<search_expr_true>"passed"</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
@@ -989,13 +989,13 @@
|
||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
|
||||
<pre_exec_args></pre_exec_args>
|
||||
<main_exec> $OPENAIR_DIR/cmake_targets/lte-simulators/build/ulsim</main_exec>
|
||||
<main_exec_args> -B25 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L
|
||||
-B25 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 -L
|
||||
-B50 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L
|
||||
-B50 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 -L
|
||||
-B100 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L
|
||||
-B100 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 -L</main_exec_args>
|
||||
<main_exec> $OPENAIR_DIR/targets/bin/ulsim.Rel14</main_exec>
|
||||
<main_exec_args> -B25 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70
|
||||
-B25 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70
|
||||
-B50 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70
|
||||
-B50 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70
|
||||
-B100 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70
|
||||
-B100 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 </main_exec_args>
|
||||
<tags>ulsim.test1 ulsim.test2 ulsim.test3 ulsim.test4 ulsim.test5 ulsim.test6</tags>
|
||||
<search_expr_true>"passed"</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ eNBs =
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
|
||||
+22
-147
@@ -42,6 +42,7 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
|
||||
|
||||
MSC_GEN="False"
|
||||
XFORMS="True"
|
||||
UE_EXPANSION="False"
|
||||
PRINT_STATS="False"
|
||||
VCD_TIMING="False"
|
||||
DEADLINE_SCHEDULER_FLAG_USER="False"
|
||||
@@ -57,7 +58,7 @@ CFLAGS_PROCESSOR_USER=""
|
||||
RUN_GROUP=0
|
||||
TEST_CASE_GROUP=""
|
||||
BUILD_DOXYGEN=0
|
||||
T_TRACER="False"
|
||||
T_TRACER="True"
|
||||
DISABLE_HARDWARE_DEPENDENCY="False"
|
||||
CMAKE_BUILD_TYPE=""
|
||||
CMAKE_CMD="$CMAKE"
|
||||
@@ -111,8 +112,6 @@ Options
|
||||
-t | --transport protocol
|
||||
ETHERNET , None
|
||||
Adds this trasport protocol support in compilation
|
||||
--oaisim
|
||||
Makes the oaisim simulator. Hardware will be defaulted to \"None\".
|
||||
--phy_simulators
|
||||
Makes the unitary tests Layer 1 simulators
|
||||
--core_simulators
|
||||
@@ -124,12 +123,12 @@ Options
|
||||
-V | --vcd
|
||||
Adds a debgging facility to the binary files: GUI with major internal synchronization events
|
||||
-x | --xforms
|
||||
Adds a software oscilloscope feature to the produced binaries. If oaisim, then enable PRINT_STATS.
|
||||
Adds a software oscilloscope feature to the produced binaries.
|
||||
--install-system-files
|
||||
Install OpenArInterface required files in Linux system
|
||||
(will ask root password)
|
||||
--noS1
|
||||
Compiles oaisim or lte-softmodem without S1 interface, using direct link to IP instead
|
||||
Compiles lte-softmodem without S1 interface, using direct link to IP instead
|
||||
--verbose-compile
|
||||
Shows detailed compilation instructions in makefile
|
||||
--cflags_processor
|
||||
@@ -142,8 +141,8 @@ Options
|
||||
Enable deadline scheduler of Linux kernel (>=3.14.x).
|
||||
--disable-cpu-affinity
|
||||
Disables CPU Affinity between UHD/TX/RX Threads (Valid only when deadline scheduler is disabled). By defaulT, CPU Affinity is enabled when not using deadline scheduler. It is enabled only with >2 CPUs. For eNB, CPU_0-> Device library (UHD), CPU_1->TX Threads, CPU_2...CPU_MAX->Rx Threads. For UE, CPU_0->Device Library(UHD), CPU_1..CPU_MAX -> All the UE threads
|
||||
--T-tracer
|
||||
Enables the T tracer.
|
||||
--disable-T-Tracer
|
||||
Disables the T tracer.
|
||||
--disable-hardware-dependency
|
||||
Disable HW dependency during installation
|
||||
--ue-autotest-trace
|
||||
@@ -164,11 +163,8 @@ Options
|
||||
Generates a basic [1 UE + 1 eNB + no channel] simulator.
|
||||
See targets/ARCH/tcp_bridge/README.tcp_bridge_oai for documentation.
|
||||
Usage (first build):
|
||||
oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files
|
||||
Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files
|
||||
NI/ETTUS B201 + COTS UE : ./build_oai -I --eNB -x --install-system-files -w USRP
|
||||
Usage (Regular):
|
||||
oaisim : ./build_oai --oaisim -x
|
||||
Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x
|
||||
NI/ETTUS B201 + OAI ENB : ./build_oai --eNB -x -w USRP"
|
||||
}
|
||||
@@ -214,8 +210,12 @@ function main() {
|
||||
UE=1
|
||||
echo_info "Will compile UE"
|
||||
shift;;
|
||||
--mu)
|
||||
UE_EXPANSION="True"
|
||||
echo_info "Will compile with UE_EXPANSION"
|
||||
shift;;
|
||||
--UE-conf-nvram)
|
||||
conf_nvram_path=$(readlink -f "$1")
|
||||
conf_nvram_path=$(readlink -f $2)
|
||||
shift 2;;
|
||||
--UE-gen-nvram)
|
||||
gen_nvram_path=$(readlink -f $2)
|
||||
@@ -250,10 +250,6 @@ function main() {
|
||||
echo_info "Setting transport protocol to: $TP"
|
||||
fi
|
||||
shift 2;;
|
||||
--oaisim)
|
||||
oaisim=1
|
||||
echo_info "Will compile oaisim and drivers nasmesh, ..."
|
||||
shift;;
|
||||
--phy_simulators)
|
||||
SIMUS_PHY=1
|
||||
echo_info "Will compile dlsim, ulsim, ..."
|
||||
@@ -313,9 +309,9 @@ function main() {
|
||||
CPU_AFFINITY_FLAG_USER="False"
|
||||
echo_info "Disabling CPU Affinity (only valid when not using deadline scheduler)"
|
||||
shift 1;;
|
||||
--T-tracer)
|
||||
T_TRACER="True"
|
||||
echo_info "Enabling the T tracer"
|
||||
--disable-T-Tracer)
|
||||
T_TRACER="False"
|
||||
echo_info "Disabling the T tracer"
|
||||
shift 1;;
|
||||
--disable-hardware-dependency)
|
||||
echo_info "Disabling hardware dependency for compiling software"
|
||||
@@ -490,16 +486,6 @@ function main() {
|
||||
check_install_additional_tools
|
||||
fi
|
||||
|
||||
if [ "$oaisim" = "1" ] ; then
|
||||
#to be discussed
|
||||
# there is no RF device transport protocol
|
||||
HW="None"
|
||||
TP="ETHERNET"
|
||||
|
||||
if [ "$XFORMS" == "True" ] ; then
|
||||
PRINT_STATS="True"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo_info "3. building the compilation directives ..."
|
||||
@@ -540,6 +526,9 @@ function main() {
|
||||
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
|
||||
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
|
||||
echo "set ( XFORMS $XFORMS )" >> $cmake_file
|
||||
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
|
||||
# echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
|
||||
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
|
||||
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
|
||||
@@ -689,123 +678,7 @@ function main() {
|
||||
cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
|
||||
fi
|
||||
|
||||
# oaisim compilation
|
||||
###############
|
||||
if [ "$oaisim" = "1" ] ; then
|
||||
dconf=$OPENAIR_DIR/targets/bin
|
||||
if [ "$NOS1" = "1" ] ; then
|
||||
oaisim_build_dir=oaisim_noS1_build_oai
|
||||
oaisim_exec=oaisim_nos1
|
||||
else
|
||||
oaisim_build_dir=oaisim_build_oai
|
||||
oaisim_exec=oaisim
|
||||
fi
|
||||
|
||||
echo_info "Compiling $oaisim_exec ($oaisim_build_dir)"
|
||||
cmake_file=$DIR/$oaisim_build_dir/CMakeLists.txt
|
||||
cp $DIR/$oaisim_build_dir/CMakeLists.template $cmake_file
|
||||
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
|
||||
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
|
||||
echo "set ( XFORMS $XFORMS )" >> $cmake_file
|
||||
echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file
|
||||
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
|
||||
echo "set ( UE_NAS_USE_TUN $UE_NAS_USE_TUN )" >> $cmake_file
|
||||
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/$oaisim_build_dir/build
|
||||
mkdir -p $DIR/$oaisim_build_dir/build
|
||||
cd $DIR/$oaisim_build_dir/build
|
||||
eval $CMAKE_CMD
|
||||
compilations \
|
||||
$oaisim_build_dir $oaisim_exec \
|
||||
$oaisim_exec $dbin/$oaisim_exec.$REL
|
||||
compilations \
|
||||
$oaisim_build_dir $config_libconfig_shlib \
|
||||
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
|
||||
compilations \
|
||||
$oaisim_build_dir coding \
|
||||
libcoding.so $dbin/libcoding.so
|
||||
|
||||
if [ "$NOS1" != "1" ] ; then
|
||||
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/at_commands/build
|
||||
echo_info "Compiling at_nas_ue"
|
||||
mkdir -p $DIR/at_commands/build
|
||||
cd $DIR/at_commands/build
|
||||
eval $CMAKE_CMD
|
||||
compilations \
|
||||
at_commands at_nas_ue \
|
||||
at_nas_ue $dbin/at_nas_ue
|
||||
|
||||
# ue_ip driver compilation
|
||||
echo_info "Compiling UE specific part (ue_ip driver and usim tools)"
|
||||
compilations \
|
||||
oaisim_build_oai ue_ip \
|
||||
CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
|
||||
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
|
||||
mkdir -p $DIR/nas_sim_tools/build
|
||||
cd $DIR/nas_sim_tools/build
|
||||
eval $CMAKE_CMD
|
||||
compilations \
|
||||
nas_sim_tools usim \
|
||||
usim $dbin/usim
|
||||
compilations \
|
||||
nas_sim_tools nvram \
|
||||
nvram $dbin/nvram
|
||||
compilations \
|
||||
nas_sim_tools conf2uedata \
|
||||
conf2uedata $dbin/conf2uedata
|
||||
|
||||
# generate USIM data
|
||||
if [ -f $dbin/conf2uedata ]; then
|
||||
install_nas_tools $conf_nvram_path $gen_nvram_path
|
||||
else
|
||||
echo_warning "not generated UE NAS files: binaries not found"
|
||||
fi
|
||||
else
|
||||
|
||||
compilations \
|
||||
$oaisim_build_dir rb_tool \
|
||||
rb_tool $dbin/rb_tool
|
||||
|
||||
# nasmesh driver compilation
|
||||
compilations \
|
||||
$oaisim_build_dir nasmesh \
|
||||
CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
|
||||
|
||||
#oai_nw_drv
|
||||
#compilations \
|
||||
# $oaisim_build_dir oai_nw_drv \
|
||||
# CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
|
||||
fi
|
||||
|
||||
if [ "$TP" == "ETHERNET" ] ; then
|
||||
compilations \
|
||||
$oaisim_build_dir oai_eth_transpro \
|
||||
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
|
||||
ln -sf liboai_eth_transpro.so liboai_transpro.so
|
||||
ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
|
||||
echo_info "liboai_transpro.so is linked with ETHERNET library"
|
||||
fi
|
||||
|
||||
cmake_file=$DIR/oaisim_mme_build_oai/CMakeLists.txt
|
||||
cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
|
||||
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
|
||||
echo "set ( XFORMS $XFORMS )" >> $cmake_file
|
||||
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
|
||||
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
|
||||
#[ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_mme_build_oai/build
|
||||
#mkdir -p $DIR/oaisim_mme_build_oai/build
|
||||
#cd $DIR/oaisim_mme_build_oai/build
|
||||
#eval $CMAKE_CMD
|
||||
#compilations \
|
||||
# oaisim_mme_build_oai oaisim_mme \
|
||||
# oaisim_mme $dbin/oaisim_mme.$REL
|
||||
fi
|
||||
|
||||
# Telnet server compilation
|
||||
#####################
|
||||
@@ -968,7 +841,8 @@ fi
|
||||
{
|
||||
cd $OPENAIR_DIR/cmake_targets/basic_simulator/enb
|
||||
cmake .
|
||||
make -j`nproc` coding params_libconfig tcp_bridge_oai lte-softmodem
|
||||
make -j`nproc` lte-softmodem
|
||||
make -j`nproc` coding params_libconfig tcp_bridge_oai
|
||||
ln -sf libtcp_bridge_oai.so liboai_device.so
|
||||
cd ../..
|
||||
} > $dlog/basic_simulator_enb.txt 2>&1
|
||||
@@ -1005,7 +879,7 @@ fi
|
||||
echo "set(PACKAGE_NAME \"simulator_ue\")" >> $cmake_file
|
||||
echo "set (DEADLINE_SCHEDULER \"False\" )" >> $cmake_file
|
||||
echo "set (CPU_AFFINITY \"False\" )" >> $cmake_file
|
||||
echo "set ( T_TRACER \"False\" )" >> $cmake_file
|
||||
echo "set ( T_TRACER \"True\" )" >> $cmake_file
|
||||
echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file
|
||||
echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file
|
||||
echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file
|
||||
@@ -1023,7 +897,8 @@ fi
|
||||
{
|
||||
cd $OPENAIR_DIR/cmake_targets/basic_simulator/ue
|
||||
cmake .
|
||||
make -j`nproc` coding params_libconfig tcp_bridge_oai lte-uesoftmodem
|
||||
make -j`nproc` lte-uesoftmodem
|
||||
make -j`nproc` coding params_libconfig tcp_bridge_oai
|
||||
ln -sf libtcp_bridge_oai.so liboai_device.so
|
||||
cd ../..
|
||||
} > $dlog/basic_simulator_ue.txt 2>&1
|
||||
|
||||
@@ -56,7 +56,7 @@ white='\E[37m'
|
||||
reset_color='\E[00m'
|
||||
COLORIZE=1
|
||||
|
||||
cecho() {
|
||||
cecho() {
|
||||
# Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
@@ -147,10 +147,10 @@ clean_kernel() {
|
||||
clean_all_files() {
|
||||
set_openair_env
|
||||
dir=$OPENAIR_DIR/cmake_targets
|
||||
rm -rf $dir/log $OPENAIR_DIR/targets/bin/*
|
||||
rm -rf $dir/log $OPENAIR_DIR/targets/bin/*
|
||||
rm -rf $dir/lte_build_oai $dir/lte-simulators/build
|
||||
rm -rf $dir/oaisim_build_oai/build $dir/oaisim_build_oai/CMakeLists.txt
|
||||
rm -rf $dir/autotests/bin $dir/autotests/log $dir/autotests/*/build
|
||||
rm -rf $dir/autotests/bin $dir/autotests/log $dir/autotests/*/build
|
||||
}
|
||||
|
||||
###################################
|
||||
@@ -271,8 +271,23 @@ check_install_usrp_uhd_driver(){
|
||||
$SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y || true
|
||||
v=$(lsb_release -cs)
|
||||
$SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
|
||||
#The new USRP repository
|
||||
$SUDO add-apt-repository ppa:ettusresearch/uhd -y
|
||||
# The new USRP repository
|
||||
# Raphael Defosseux: Adding a loop on adding PPA because in CI the gpg key retrieve may
|
||||
# timeout due to proxy / network latencies in Eurecom on VM
|
||||
echo_info "\nAdding PPA repository ettusresearch/uhd\n"
|
||||
x=0
|
||||
while [ $x -le 5 ]
|
||||
do
|
||||
if $SUDO add-apt-repository ppa:ettusresearch/uhd -y
|
||||
then
|
||||
echo_info "add-apt-repository successful\n"
|
||||
break
|
||||
else
|
||||
echo_info "add-apt-repository failed, retrying...\n"
|
||||
sleep 30
|
||||
fi
|
||||
x=$((x + 1))
|
||||
done
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev
|
||||
$SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host
|
||||
@@ -337,7 +352,7 @@ check_install_bladerf_driver(){
|
||||
fi
|
||||
$SUDO apt-get install -y --allow-unauthenticated bladerf libbladerf-dev
|
||||
$SUDO apt-get install -y --allow-unauthenticated bladerf-firmware-fx3
|
||||
$SUDO apt-get install -y --allow-unauthenticated bladerf-fpga-hostedx40
|
||||
$SUDO apt-get install -y --allow-unauthenticated bladerf-fpga-hostedx40
|
||||
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
|
||||
install_bladerf_driver_from_source
|
||||
else
|
||||
@@ -358,7 +373,7 @@ check_install_lmssdr_driver(){
|
||||
echo_error "lmssdr support implies installing lmssdr drivers and tools" \
|
||||
" from sources. check:"
|
||||
echo_info "https://open-cells.com/index.php/2017/05/10/limesdr-installation/"
|
||||
echo_fatal "Cannot compile lmssdr device"
|
||||
echo_fatal "Cannot compile lmssdr device"
|
||||
fi
|
||||
|
||||
|
||||
@@ -455,7 +470,7 @@ check_install_additional_tools (){
|
||||
python2-matplotlib"
|
||||
fi
|
||||
$SUDO $INSTALLER install -y $PACKAGE_LIST
|
||||
|
||||
|
||||
$SUDO rm -fr /opt/ssh
|
||||
$SUDO GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/ssh.git /opt/ssh
|
||||
|
||||
@@ -489,24 +504,24 @@ check_install_oai_software() {
|
||||
$SUDO apt install -y software-properties-common
|
||||
case "$(get_distribution_release)" in
|
||||
"ubuntu14.04")
|
||||
specific_packages="libtasn1-3-dev gccxml libgnutls-dev libatlas-dev iproute libconfig8-dev"
|
||||
specific_packages="libtasn1-3-dev libgnutls-dev libatlas-dev iproute libconfig8-dev"
|
||||
# For iperf3
|
||||
$SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe"
|
||||
$SUDO apt-get update
|
||||
;;
|
||||
"ubuntu16.04")
|
||||
specific_packages="libtasn1-6-dev gccxml libgnutls-dev libatlas-dev iproute libconfig8-dev"
|
||||
specific_packages="libtasn1-6-dev libgnutls-dev libatlas-dev iproute libconfig8-dev"
|
||||
;;
|
||||
"ubuntu17.04")
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev libatlas-dev iproute libconfig8-dev"
|
||||
specific_packages="libtasn1-6-dev libgnutls28-dev libatlas-dev iproute libconfig8-dev"
|
||||
;;
|
||||
"ubuntu17.10")
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev iproute libconfig8-dev"
|
||||
specific_packages="libtasn1-6-dev libgnutls28-dev iproute libconfig8-dev"
|
||||
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
|
||||
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
|
||||
;;
|
||||
"ubuntu18.04")
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev iproute2 libconfig-dev"
|
||||
specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev"
|
||||
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
|
||||
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
|
||||
;;
|
||||
@@ -534,6 +549,8 @@ check_install_oai_software() {
|
||||
iptables-dev \
|
||||
libatlas-base-dev \
|
||||
libblas-dev \
|
||||
liblapack-dev\
|
||||
liblapacke-dev\
|
||||
libffi-dev \
|
||||
libforms-bin \
|
||||
libforms-dev \
|
||||
@@ -581,13 +598,10 @@ check_install_oai_software() {
|
||||
$SUDO $INSTALLER install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||
fi
|
||||
$SUDO $INSTALLER install -y python-epdb
|
||||
$SUDO $INSTALLER install -y gccxml
|
||||
else
|
||||
$SUDO $INSTALLER install -y mscgen pydb
|
||||
# Fedora repos already contain gccxml's successor castxml.
|
||||
$SUDO $INSTALLER install -y castxml
|
||||
fi
|
||||
|
||||
|
||||
$SUDO $INSTALLER install -y \
|
||||
autoconf \
|
||||
automake \
|
||||
@@ -663,8 +677,14 @@ install_asn1c_from_source(){
|
||||
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
|
||||
(
|
||||
$SUDO rm -rf /tmp/asn1c
|
||||
GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
|
||||
# GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
|
||||
git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
|
||||
cd /tmp/asn1c
|
||||
# better to use a given commit than a branch in case the branch
|
||||
# is updated and requires modifications in the source of OAI
|
||||
#git checkout velichkov_s1ap_plus_option_group
|
||||
git checkout ec830d70bbb014b769810355a2f321a91ccd8a58
|
||||
autoreconf -iv
|
||||
./configure
|
||||
make -j`nproc`
|
||||
$SUDO make install
|
||||
@@ -674,7 +694,7 @@ install_asn1c_from_source(){
|
||||
}
|
||||
|
||||
#################################################
|
||||
# 2. compile
|
||||
# 2. compile
|
||||
################################################
|
||||
|
||||
install_nas_tools() {
|
||||
@@ -703,7 +723,7 @@ set_openair_env(){
|
||||
[ -f "/.$fullpath" ] || fullpath=`readlink -f $PWD/$fullpath`
|
||||
openair_path=${fullpath%/cmake_targets/*}
|
||||
openair_path=${openair_path%/targets/*}
|
||||
openair_path=${openair_path%/openair[123]/*}
|
||||
openair_path=${openair_path%/openair[123]/*}
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
@@ -720,7 +740,7 @@ ppid=$$
|
||||
arraycounter=1
|
||||
echo_info "** Trapped CTRL-C. Killing all subprocesses now..."
|
||||
echo_info "** Calling sync now..."
|
||||
sync
|
||||
sync
|
||||
while true
|
||||
do
|
||||
FORLOOP=FALSE
|
||||
@@ -738,7 +758,7 @@ do
|
||||
arraycounter=`expr $arraycounter - 1`
|
||||
## We want to kill child process id first and then parent id's
|
||||
while [ $arraycounter -ne 0 ]
|
||||
do
|
||||
do
|
||||
echo "first we send ctrl-c to program"
|
||||
$SUDO kill -INT "${procid[$arraycounter]}"
|
||||
sleep 5
|
||||
|
||||
@@ -48,7 +48,7 @@ if [ "$1" = "eNB" ]; then
|
||||
else
|
||||
if [ "$1" = "UE" ]; then
|
||||
echo "bring up oai0 interface for UE"
|
||||
sudo ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sudo ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
$OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Regular → Executable
@@ -26,15 +26,17 @@ xUnit_start() {
|
||||
# \param $3 testcase result
|
||||
# \param $4 run result
|
||||
# \param $5 XML file local to test case for storing its own results
|
||||
# \param $6 proper description
|
||||
xUnit_fail() {
|
||||
class=$1
|
||||
test_case=$2
|
||||
result=$3
|
||||
run_result=$4
|
||||
xmlfile_testcase=$5
|
||||
desc=$6
|
||||
currtime=$(date +%s.%N)
|
||||
time=$(echo "$currtime - $XUNIT_START" | bc -l)
|
||||
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
|
||||
xml="<testcase classname='$class' name='$test_case' description='$desc' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
|
||||
echo -e "$xml" >> "$xmlfile_testcase"
|
||||
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
|
||||
XUNIT_FAILED=$((XUNIT_FAILED+1))
|
||||
@@ -48,15 +50,17 @@ xUnit_fail() {
|
||||
# \param $3 testcase result
|
||||
# \param $4 run result
|
||||
# \param $5 XML file local to test case for storing its own results
|
||||
# \param $6 proper description
|
||||
xUnit_success() {
|
||||
class=$1
|
||||
test_case=$2
|
||||
result=$3
|
||||
run_result=$4
|
||||
xmlfile_testcase=$5
|
||||
desc=$6
|
||||
currtime=$(date +%s.%N)
|
||||
time=$(echo "$currtime - $XUNIT_START" | bc -l)
|
||||
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
|
||||
xml="<testcase classname='$class' name='$test_case' description='$desc' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
|
||||
echo -e $xml >> $xmlfile_testcase
|
||||
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
|
||||
XUNIT_SUCCESS=$((XUNIT_SUCCESS+1))
|
||||
|
||||
@@ -29,9 +29,11 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include "config_userapi.h"
|
||||
|
||||
@@ -41,6 +43,7 @@ char *tmpval = value;
|
||||
int optisset=0;
|
||||
char defbool[2]="1";
|
||||
|
||||
|
||||
if ( value == NULL) {
|
||||
if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
|
||||
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
|
||||
@@ -103,15 +106,15 @@ char defbool[2]="1";
|
||||
if (optisset == 1) {
|
||||
cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET;
|
||||
}
|
||||
|
||||
return optisset;
|
||||
}
|
||||
|
||||
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
||||
{
|
||||
char **p = config_get_if()->argv;
|
||||
|
||||
|
||||
int c = config_get_if()->argc;
|
||||
int j;
|
||||
int i,j;
|
||||
char *pp;
|
||||
char *cfgpath;
|
||||
|
||||
@@ -122,42 +125,72 @@ char *cfgpath;
|
||||
return -1;
|
||||
}
|
||||
|
||||
j=0;
|
||||
p++;
|
||||
c--;
|
||||
while (c > 0 && *p != NULL) {
|
||||
if (strcmp(*p, "-h") == 0 || strcmp(*p, "--help") == 0 ) {
|
||||
config_printhelp(cfgoptions,numoptions);
|
||||
j = 0;
|
||||
i = 0;
|
||||
while (c > 0 ) {
|
||||
char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
|
||||
/* first check help options, either --help, -h or --help_<section> */
|
||||
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
|
||||
char *tokctx;
|
||||
pp=strtok_r(oneargv, "_",&tokctx);
|
||||
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
|
||||
if( prefix == NULL) {
|
||||
config_printhelp(cfgoptions,numoptions);
|
||||
if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
|
||||
exit_fun("[CONFIG] Exiting after displaying help\n");
|
||||
}
|
||||
} else {
|
||||
pp=strtok_r(NULL, "_",&tokctx);
|
||||
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
|
||||
printf ("Help for %s section:\n",prefix);
|
||||
config_printhelp(cfgoptions,numoptions);
|
||||
if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
|
||||
fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
|
||||
exit_fun(" Exiting after displaying help\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*p[0] == '-') {
|
||||
for(int i=0;i<numoptions;i++) {
|
||||
if ( ( cfgoptions[i].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) {
|
||||
/* now, check for non help options */
|
||||
if (oneargv[0] == '-') {
|
||||
for(int n=0;n<numoptions;n++) {
|
||||
if ( ( cfgoptions[n].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (prefix != NULL) {
|
||||
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
|
||||
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[n].optname);
|
||||
} else {
|
||||
sprintf(cfgpath,"%s",cfgoptions[i].optname);
|
||||
sprintf(cfgpath,"%s",cfgoptions[n].optname);
|
||||
}
|
||||
|
||||
if ( ((strlen(*p) == 2) && (strcmp(*p + 1,cfgpath) == 0)) ||
|
||||
((strlen(*p) > 2) && (strcmp(*p + 2,cfgpath ) == 0 )) ) {
|
||||
pp = *(p+1);
|
||||
if ( ( pp != NULL ) && (c>1) && (pp[0]!= '-') ) {
|
||||
|
||||
j += processoption(&(cfgoptions[i]), pp);
|
||||
} else {
|
||||
j += processoption(&(cfgoptions[i]), NULL);
|
||||
}
|
||||
if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
|
||||
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
|
||||
char *valptr=NULL;
|
||||
int ret;
|
||||
pp = config_get_if()->argv[i+1];
|
||||
if (pp != NULL && c > 1) {
|
||||
ret = strlen(pp);
|
||||
if (ret > 0 ) {
|
||||
if (pp[0] != '-')
|
||||
valptr=pp;
|
||||
else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
|
||||
valptr=pp;
|
||||
}
|
||||
}
|
||||
j += processoption(&(cfgoptions[n]), pp);
|
||||
if ( valptr != NULL ) {
|
||||
i++;
|
||||
c--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} /* for */
|
||||
} /* if (*p[0] == '-') */
|
||||
p++;
|
||||
} /* for n... */
|
||||
} /* if (oneargv[0] == '-') */
|
||||
free(oneargv);
|
||||
i++;
|
||||
c--;
|
||||
} /* fin du while */
|
||||
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "":prefix),j);
|
||||
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
|
||||
free(cfgpath);
|
||||
return j;
|
||||
} /* parse_cmdline*/
|
||||
|
||||
@@ -97,7 +97,77 @@ int st;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* from here: interface implementtion of the configuration module */
|
||||
int nooptfunc(void) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
int config_cmdlineonly_getlist(paramlist_def_t *ParamList,
|
||||
paramdef_t *params, int numparams, char *prefix)
|
||||
{
|
||||
ParamList->numelt = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
|
||||
{
|
||||
int defval;
|
||||
int fatalerror=0;
|
||||
int numdefvals=0;
|
||||
|
||||
|
||||
for(int i=0;i<numoptions;i++) {
|
||||
defval=0;
|
||||
switch(cfgoptions[i].type) {
|
||||
case TYPE_STRING:
|
||||
defval=config_setdefault_string(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_STRINGLIST:
|
||||
defval=config_setdefault_stringlist(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_UINT8:
|
||||
case TYPE_INT8:
|
||||
case TYPE_UINT16:
|
||||
case TYPE_INT16:
|
||||
case TYPE_UINT32:
|
||||
case TYPE_INT32:
|
||||
case TYPE_MASK:
|
||||
defval=config_setdefault_int(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
defval=config_setdefault_int64(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_UINTARRAY:
|
||||
case TYPE_INTARRAY:
|
||||
defval=config_setdefault_intlist(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_DOUBLE:
|
||||
defval=config_setdefault_double(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_IPV4ADDR:
|
||||
defval=config_setdefault_ipv4addr(&(cfgoptions[i]), prefix);
|
||||
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"[CONFIG] %s.%s type %i not supported\n",prefix, cfgoptions[i].optname,cfgoptions[i].type);
|
||||
fatalerror=1;
|
||||
break;
|
||||
} /* switch on param type */
|
||||
if (defval == 1) {
|
||||
numdefvals++;
|
||||
cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF;
|
||||
}
|
||||
} /* for loop on options */
|
||||
printf("[CONFIG] %s: %i/%i parameters successfully set \n",
|
||||
((prefix == NULL)?"(root)":prefix),
|
||||
numdefvals,numoptions );
|
||||
if (fatalerror == 1) {
|
||||
fprintf(stderr,"[CONFIG] fatal errors found when assigning %s parameters \n",
|
||||
prefix);
|
||||
}
|
||||
return numdefvals;
|
||||
}
|
||||
|
||||
configmodule_interface_t *load_configmodule(int argc, char **argv)
|
||||
{
|
||||
@@ -110,17 +180,19 @@ uint32_t tmpflags=0;
|
||||
int i;
|
||||
|
||||
/* first parse the command line to look for the -O option */
|
||||
opterr=0;
|
||||
for (i = 0;i<argc;i++) {
|
||||
if (strlen(argv[i]) < 2) continue;
|
||||
if ( argv[i][1] == 'O' && i < (argc -1)) {
|
||||
cfgparam = argv[i+1];
|
||||
}
|
||||
if ( argv[i][1] == 'h' ) {
|
||||
if ( strstr(argv[i], "help_config") != NULL ) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
||||
exit(0);
|
||||
}
|
||||
if ( (strcmp(argv[i]+1, "h") == 0) || (strstr(argv[i]+1, "help_") != NULL ) ) {
|
||||
tmpflags = CONFIG_HELP;
|
||||
}
|
||||
}
|
||||
optind=1;
|
||||
|
||||
/* look for the OAI_CONFIGMODULE environement variable */
|
||||
if ( cfgparam == NULL ) {
|
||||
@@ -129,21 +201,25 @@ int i;
|
||||
|
||||
/* default */
|
||||
if (cfgparam == NULL) {
|
||||
tmpflags = tmpflags | CONFIG_NOOOPT;
|
||||
cfgparam = DEFAULT_CFGMODE ":" DEFAULT_CFGFILENAME;
|
||||
}
|
||||
tmpflags = tmpflags | CONFIG_NOOOPT;
|
||||
if (strstr(argv[0],"uesoftmodem") == NULL) {
|
||||
cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME;
|
||||
} else {
|
||||
cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ;
|
||||
}
|
||||
}
|
||||
|
||||
/* parse the config parameters to set the config source */
|
||||
i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams);
|
||||
if (i< 0) {
|
||||
fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno));
|
||||
cfgmode=strdup(DEFAULT_CFGMODE);
|
||||
modeparams = strdup(DEFAULT_CFGFILENAME);
|
||||
exit(-1);
|
||||
}
|
||||
else if ( i == 1 ) {
|
||||
/* -O argument doesn't contain ":" separator, assume -O <conf file> option, default cfgmode to libconfig
|
||||
with one parameter, the path to the configuration file */
|
||||
modeparams=cfgmode;
|
||||
cfgmode=strdup(DEFAULT_CFGMODE);
|
||||
cfgmode=strdup(CONFIG_LIBCONFIGFILE);
|
||||
}
|
||||
|
||||
cfgptr = malloc(sizeof(configmodule_interface_t));
|
||||
@@ -153,7 +229,6 @@ int i;
|
||||
cfgptr->argc = argc;
|
||||
cfgptr->argv = argv;
|
||||
cfgptr->cfgmode=strdup(cfgmode);
|
||||
|
||||
cfgptr->num_cfgP=0;
|
||||
atoken=strtok_r(modeparams,":",&strtokctx);
|
||||
while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) {
|
||||
@@ -176,24 +251,33 @@ int i;
|
||||
for (i=0;i<cfgptr->num_cfgP; i++) {
|
||||
printf("%s ",cfgptr->cfgP[i]);
|
||||
}
|
||||
printf("\n");
|
||||
printf(", debug flags: 0x%08x\n",cfgptr->rtflags);
|
||||
|
||||
|
||||
i=load_config_sharedlib(cfgptr);
|
||||
if (i< 0) {
|
||||
fprintf(stderr,"[CONFIG] %s %d config module %s couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
|
||||
cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
|
||||
if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) {
|
||||
i=load_config_sharedlib(cfgptr);
|
||||
if (i == 0) {
|
||||
printf("[CONFIG] config module %s loaded\n",cfgmode);
|
||||
Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags);
|
||||
config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
|
||||
cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
|
||||
}
|
||||
} else {
|
||||
printf("[CONFIG] config module %s loaded\n",cfgmode);
|
||||
Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags);
|
||||
config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
|
||||
cfgptr->init = (configmodule_initfunc_t)nooptfunc;
|
||||
cfgptr->get = config_cmdlineonly_get;
|
||||
cfgptr->getlist = config_cmdlineonly_getlist;
|
||||
cfgptr->end = (configmodule_endfunc_t)nooptfunc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (modeparams != NULL) free(modeparams);
|
||||
if (cfgmode != NULL) free(cfgmode);
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
||||
// exit(-1);
|
||||
}
|
||||
return cfgptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,17 +41,19 @@
|
||||
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
|
||||
|
||||
/* default values for configuration module parameters */
|
||||
#define DEFAULT_CFGMODE "libconfig" // use libconfig file
|
||||
#define DEFAULT_CFGFILENAME "oai.conf" // default config file
|
||||
#define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file
|
||||
#define CONFIG_CMDLINEONLY "cmdline" // use only command line options
|
||||
#define DEFAULT_CFGFILENAME "oai.conf" // default config file
|
||||
|
||||
/* rtflags bit position definitions */
|
||||
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
|
||||
#define CONFIG_DEBUGPTR 1<<1 // print memory allocation/free debug messages
|
||||
#define CONFIG_DEBUGCMDLINE 1<<2 // print command line processing messages
|
||||
#define CONFIG_NOABORTONCHKF 1<<3 // disable abort execution when parameter checking function fails
|
||||
#define CONFIG_HELP 1<<20 // print help message
|
||||
#define CONFIG_ABORT 1<<21 // config failed,abort execution
|
||||
#define CONFIG_NOOOPT 1<<22 // no -O option found when parsing command line
|
||||
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
|
||||
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
|
||||
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
|
||||
#define CONFIG_NOABORTONCHKF (1<<3) // disable abort execution when parameter checking function fails
|
||||
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
|
||||
#define CONFIG_HELP (1<<20) // print help message
|
||||
#define CONFIG_ABORT (1<<21) // config failed,abort execution
|
||||
#define CONFIG_NOOOPT (1<<22) // no -O option found when parsing command line
|
||||
typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
|
||||
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
|
||||
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
|
||||
@@ -75,7 +77,7 @@ typedef struct configmodule_interface
|
||||
#ifdef CONFIG_LOADCONFIG_MAIN
|
||||
configmodule_interface_t *cfgptr=NULL;
|
||||
|
||||
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbg[debugflags]> \n \
|
||||
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \
|
||||
debugflags can also be defined in the config_libconfig section of the config file\n \
|
||||
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
|
||||
4->print command line processing debug messages\n ";
|
||||
@@ -97,9 +99,9 @@ extern configmodule_interface_t *cfgptr;
|
||||
#endif
|
||||
|
||||
|
||||
#define printf_params(...) if ( (cfgptr->rtflags & CONFIG_PRINTPARAMS) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_ptrs(...) if ( (cfgptr->rtflags & CONFIG_DEBUGPTR) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_cmdl(...) if ( (cfgptr->rtflags & CONFIG_DEBUGCMDLINE) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
|
||||
extern configmodule_interface_t *load_configmodule(int argc, char **argv);
|
||||
extern void end_configmodule(void);
|
||||
|
||||
@@ -148,7 +148,10 @@ typedef struct paramdef
|
||||
#define TYPE_MASK 10
|
||||
#define TYPE_DOUBLE 16
|
||||
#define TYPE_IPV4ADDR 20
|
||||
#define TYPE_LASTSCALAR 25
|
||||
|
||||
#define PARAM_ISLISTORARRAY(P) (P->type > TYPE_LASTSCALAR )
|
||||
#define PARAM_ISSCALAR(P) (P->type < TYPE_LASTSCALAR )
|
||||
|
||||
#define TYPE_STRINGLIST 50
|
||||
#define TYPE_INTARRAY 51
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "config_userapi.h"
|
||||
extern void exit_fun(const char* s); // lte-softmodem clean exit function
|
||||
|
||||
@@ -50,10 +52,30 @@ configmodule_interface_t *config_get_if(void)
|
||||
|
||||
char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
|
||||
{
|
||||
|
||||
if (ptr == NULL ) {
|
||||
ptr = malloc(sizeof(char *));
|
||||
if (ptr != NULL) {
|
||||
*ptr=NULL;
|
||||
cfgoptions->strptr=ptr;
|
||||
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
||||
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
|
||||
config_get_if()->numptrs++;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
|
||||
__FILE__, __LINE__, cfgoptions->optname, strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length);
|
||||
if(cfgoptions->numelt > 0) { /* already allocated */
|
||||
return *ptr;
|
||||
if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */
|
||||
if (*ptr != NULL) {
|
||||
return *ptr;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
|
||||
__FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (*ptr == NULL) {
|
||||
@@ -75,7 +97,7 @@ char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
|
||||
void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val)
|
||||
{
|
||||
int tmpval=val;
|
||||
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >1) {
|
||||
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
|
||||
tmpval =1;
|
||||
}
|
||||
switch (cfgoptions->type) {
|
||||
@@ -160,7 +182,7 @@ int st=0;
|
||||
}
|
||||
}
|
||||
if (st != 0) {
|
||||
fprintf(stderr,"[CONFIG] config_execcheck: %i parameters with wrong value\n", -st);
|
||||
fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
|
||||
if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
|
||||
exit_fun("exit because configuration failed\n");
|
||||
}
|
||||
@@ -173,7 +195,7 @@ int config_get(paramdef_t *params,int numparams, char *prefix)
|
||||
int ret= -1;
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
|
||||
fprintf(stderr,"[CONFIG] config_get, section %s skipped, config module not properly initialized\n",prefix);
|
||||
return ret;
|
||||
}
|
||||
configmodule_interface_t *cfgif = config_get_if();
|
||||
@@ -283,3 +305,115 @@ int config_checkstr_assign_integer(paramdef_t *param)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_setdefault_string(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
if( cfgoptions->defstrval != NULL) {
|
||||
status=1;
|
||||
|
||||
if (cfgoptions->numelt == 0 ) {
|
||||
config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
|
||||
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1);
|
||||
sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
|
||||
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr));
|
||||
} else {
|
||||
sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
|
||||
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr));
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
if( cfgoptions->defstrlistval != NULL) {
|
||||
cfgoptions->strlistptr=cfgoptions->defstrlistval;
|
||||
status=1;
|
||||
for(int j=0; j<cfgoptions->numelt; j++)
|
||||
printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, (char **)(&(cfgoptions->iptr)),sizeof(int32_t));
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(long long));
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->u64ptr)=cfgoptions->defuintval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr)));
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
if( cfgoptions->defintarrayval != NULL) {
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t*));
|
||||
cfgoptions->iptr=cfgoptions->defintarrayval;
|
||||
status=1;
|
||||
for (int j=0; j<cfgoptions->numelt ; j++) {
|
||||
printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_double(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->u64ptr)=cfgoptions->defdblval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr));
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr)
|
||||
{
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int));
|
||||
int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr );
|
||||
if (rst == 1 && *(cfgoptions->uptr) > 0) {
|
||||
printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
|
||||
return 1;
|
||||
} else {
|
||||
if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
|
||||
printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr);
|
||||
*cfgoptions->uptr=INADDR_ANY;
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
if (cfgoptions->defstrval != NULL) {
|
||||
status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -38,10 +38,15 @@
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/* get rid of "exit_fun undeclared" warning */
|
||||
extern void exit_fun(const char* s);
|
||||
|
||||
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
|
||||
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
|
||||
#define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] )
|
||||
#define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P))
|
||||
#define CONFIG_SETRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags |= P; }
|
||||
#define CONFIG_CLEARRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags &= (~P); }
|
||||
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
|
||||
/* utility functions, to be used by configuration module and/or configuration libraries */
|
||||
extern configmodule_interface_t *config_get_if(void);
|
||||
@@ -50,6 +55,7 @@ extern void config_printhelp(paramdef_t *,int numparams);
|
||||
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
|
||||
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
|
||||
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
|
||||
extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
|
||||
|
||||
/* apis to get parameters, to be used by oai modules, at configuration time */
|
||||
extern int config_get(paramdef_t *params,int numparams, char *prefix);
|
||||
@@ -66,6 +72,15 @@ extern int config_check_intrange(paramdef_t *param);
|
||||
extern int config_check_strval(paramdef_t *param);
|
||||
extern int config_checkstr_assign_integer(paramdef_t *param);
|
||||
|
||||
/* functions to set a parameter to its default value */
|
||||
extern int config_setdefault_string(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_int(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_double(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix);
|
||||
|
||||
#define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -129,8 +129,6 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
|
||||
switch(cfgoptions[i].type)
|
||||
{
|
||||
case TYPE_STRING:
|
||||
|
||||
printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.cfg)); fflush(stdout);
|
||||
if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
|
||||
if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) {
|
||||
fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
|
||||
@@ -138,7 +136,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.
|
||||
str[strlen(str)-1] = 0;
|
||||
}
|
||||
if (cfgoptions[i].numelt == 0 ) {
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
|
||||
// config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
|
||||
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
|
||||
sprintf( *(cfgoptions[i].strptr) , "%s", str);
|
||||
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
|
||||
@@ -147,21 +145,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.
|
||||
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
|
||||
}
|
||||
} else {
|
||||
if( cfgoptions[i].defstrval != NULL) {
|
||||
defval=1;
|
||||
|
||||
if (cfgoptions[i].numelt == 0 ) {
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
|
||||
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
|
||||
sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
|
||||
printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, *(cfgoptions[i].strptr));
|
||||
} else {
|
||||
sprintf((char *)*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
|
||||
printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, (char *)*(cfgoptions[i].strptr));
|
||||
}
|
||||
} else {
|
||||
notfound=1;
|
||||
}
|
||||
defval=config_setdefault_string(&(cfgoptions[i]),prefix);
|
||||
}
|
||||
break;
|
||||
case TYPE_STRINGLIST:
|
||||
@@ -169,14 +153,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.
|
||||
if ( setting != NULL) {
|
||||
read_strlist(&cfgoptions[i],setting,cfgpath);
|
||||
} else {
|
||||
if( cfgoptions[i].defstrlistval != NULL) {
|
||||
cfgoptions[i].strlistptr=cfgoptions[i].defstrlistval;
|
||||
defval=1;
|
||||
for(int j=0; j<cfgoptions[i].numelt; j++)
|
||||
printf_params("[LIBCONFIG] %s%i set to default value %s\n", cfgpath,j, cfgoptions[i].strlistptr[j]);
|
||||
} else {
|
||||
notfound=1;
|
||||
}
|
||||
defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix);
|
||||
}
|
||||
break;
|
||||
case TYPE_UINT8:
|
||||
@@ -186,23 +163,17 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.
|
||||
case TYPE_UINT32:
|
||||
case TYPE_INT32:
|
||||
case TYPE_MASK:
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
|
||||
if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
|
||||
config_assign_int(&(cfgoptions[i]),cfgpath,u);
|
||||
} else {
|
||||
if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
config_assign_int(&(cfgoptions[i]),cfgpath,cfgoptions[i].defintval);
|
||||
defval=1;
|
||||
printf_params("[LIBCONFIG] %s set to default value\n", cfgpath);
|
||||
} else {
|
||||
notfound=1;
|
||||
}
|
||||
defval=config_setdefault_int(&(cfgoptions[i]),prefix);
|
||||
}
|
||||
break;
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
|
||||
if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
|
||||
if(cfgoptions[i].type==TYPE_UINT64) {
|
||||
*(cfgoptions[i].u64ptr) = (uint64_t)llu;
|
||||
printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) );
|
||||
@@ -211,13 +182,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.
|
||||
printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) );
|
||||
}
|
||||
} else {
|
||||
if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions[i].u64ptr)=cfgoptions[i].defuintval;
|
||||
defval=1;
|
||||
printf_params("[LIBCONFIG] %s set to default value %llu\n", cfgpath, (long long unsigned)(*(cfgoptions[i].u64ptr)));
|
||||
} else {
|
||||
notfound=1;
|
||||
}
|
||||
defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
|
||||
}
|
||||
break;
|
||||
case TYPE_UINTARRAY:
|
||||
@@ -226,57 +191,28 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.
|
||||
if ( setting != NULL) {
|
||||
read_intarray(&cfgoptions[i],setting,cfgpath);
|
||||
} else {
|
||||
if( cfgoptions[i].defintarrayval != NULL) {
|
||||
config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t*));
|
||||
cfgoptions[i].iptr=cfgoptions[i].defintarrayval;
|
||||
defval=1;
|
||||
for (int j=0; j<cfgoptions[i].numelt ; j++) {
|
||||
printf_params("[LIBCONFIG] %s[%i] set to default value %i\n", cfgpath,j,(int)cfgoptions[i].iptr[j]);
|
||||
}
|
||||
} else {
|
||||
notfound=1;
|
||||
}
|
||||
defval=config_setdefault_intlist(&(cfgoptions[i]),prefix);
|
||||
}
|
||||
break;
|
||||
case TYPE_DOUBLE:
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
|
||||
if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
|
||||
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
|
||||
*(cfgoptions[i].dblptr) = dbl;
|
||||
printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
|
||||
} else {
|
||||
if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions[i].u64ptr)=cfgoptions[i].defdblval;
|
||||
defval=1;
|
||||
printf_params("[LIBCONFIG] %s set to default value %lf\n", cfgpath, *(cfgoptions[i].dblptr));
|
||||
} else {
|
||||
notfound=1;
|
||||
}
|
||||
defval=config_setdefault_double(&(cfgoptions[i]),prefix);
|
||||
}
|
||||
break;
|
||||
case TYPE_IPV4ADDR:
|
||||
config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].uptr), sizeof(int));
|
||||
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
|
||||
str=cfgoptions[i].defstrval;
|
||||
defval=1;
|
||||
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, str);
|
||||
}
|
||||
if (str != NULL) {
|
||||
rst=inet_pton(AF_INET, str,cfgoptions[i].uptr );
|
||||
if (rst == 1 && *(cfgoptions[i].uptr) > 0) {
|
||||
printf_params("[LIBCONFIG] %s: %s\n", cfgpath,str );
|
||||
} else {
|
||||
if ( strncmp(str,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
|
||||
printf_params("[LIBCONFIG] %s:%s (INADDR_ANY) \n",cfgpath,str);
|
||||
*cfgoptions[i].uptr=INADDR_ANY;
|
||||
} else {
|
||||
fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
|
||||
fatalerror=1;
|
||||
}
|
||||
defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix);
|
||||
} else {
|
||||
rst=config_assign_ipv4addr(cfgoptions, str);
|
||||
if (rst < 0) {
|
||||
fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
|
||||
fatalerror=1;
|
||||
}
|
||||
} else {
|
||||
notfound=1;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case TYPE_LIST:
|
||||
setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "common/config/config_userapi.h"
|
||||
|
||||
#define QUIT(x) do { \
|
||||
printf("T tracer: QUIT: %s\n", x); \
|
||||
exit(1); \
|
||||
@@ -17,6 +19,7 @@
|
||||
/* array used to activate/disactivate a log */
|
||||
static int T_IDs[T_NUMBER_OF_IDS];
|
||||
int *T_active = T_IDs;
|
||||
int T_stdout;
|
||||
|
||||
static int T_socket;
|
||||
|
||||
@@ -157,3 +160,22 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
||||
|
||||
new_thread(T_receive_thread, NULL);
|
||||
}
|
||||
|
||||
void T_Config_Init(void)
|
||||
{
|
||||
int T_port; /* by default we wait for the tracer */
|
||||
int T_nowait; /* default port to listen to to wait for the tracer */
|
||||
int T_dont_fork; /* default is to fork, see 'T_init' to understand */
|
||||
|
||||
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC ;
|
||||
|
||||
/* for a cleaner config file, TTracer params should be defined in a specific section... */
|
||||
config_get( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),TTRACER_CONFIG_PREFIX);
|
||||
|
||||
/* compatibility: look for TTracer command line options in root section */
|
||||
config_process_cmdline( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
if (T_stdout == 0) {
|
||||
T_init(T_port, 1-T_nowait, T_dont_fork);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-49
@@ -14,6 +14,7 @@
|
||||
/* T message IDs */
|
||||
#include "T_IDs.h"
|
||||
|
||||
#define T_ACTIVE_STDOUT 2
|
||||
/* known type - this is where you add new types */
|
||||
|
||||
#define T_INT(x) int, (x)
|
||||
@@ -94,12 +95,12 @@ struct T_header;
|
||||
#define T_ID(x) ((struct T_header *)(uintptr_t)(x))
|
||||
|
||||
/* T macro tricks */
|
||||
|
||||
extern int T_stdout;
|
||||
#define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\
|
||||
20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
|
||||
#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
|
||||
n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
|
||||
#define T(...) TN(__VA_ARGS__)
|
||||
#define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0)
|
||||
|
||||
/* type used to send arbitrary buffer data */
|
||||
typedef struct {
|
||||
@@ -109,7 +110,7 @@ typedef struct {
|
||||
|
||||
extern volatile int *T_freelist_head;
|
||||
extern T_cache_t *T_cache;
|
||||
|
||||
extern int *T_active;
|
||||
/* When running the basic simulator, we may fill the T cache too fast.
|
||||
* Let's not crash if it's full, just wait.
|
||||
*/
|
||||
@@ -151,50 +152,6 @@ extern T_cache_t *T_cache;
|
||||
abort(); \
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define T_PUT(type, var, argnum) \
|
||||
do { \
|
||||
if (T_LOCAL_size + sizeof(var) > T_BUFFER_MAX) { \
|
||||
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
|
||||
", consider increasing T_BUFFER_MAX (%d)\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
|
||||
abort(); \
|
||||
} \
|
||||
memcpy(T_LOCAL_buf + T_LOCAL_size, &var, sizeof(var)); \
|
||||
T_LOCAL_size += sizeof(var); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define T_PROCESS(x, argnum) \
|
||||
do { \
|
||||
T_PUT(typeof(x), x, argnum); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define T_PROCESS(x, argnum) \
|
||||
do { \
|
||||
if (__builtin_types_compatible_p(typeof(x), int)) \
|
||||
{ T_PUT(int, (intptr_t)(x), argnum); printf("int\n"); } \
|
||||
else if (__builtin_types_compatible_p(typeof(x), short)) \
|
||||
{ T_PUT(short, (intptr_t)(x), argnum); printf("short\n"); } \
|
||||
else if (__builtin_types_compatible_p(typeof(x), float)) \
|
||||
{ T_PUT(float, (x), argnum); printf("float\n"); } \
|
||||
else if (__builtin_types_compatible_p(typeof(x), char *)) \
|
||||
{ T_PUT(char *, (char *)(intptr_t)(x), argnum); printf("char *\n"); } \
|
||||
else if (__builtin_types_compatible_p(typeof(x), float *)) \
|
||||
{ T_PUT(float *, (float *)(intptr_t)(x), argnum); printf("float *\n"); } \
|
||||
else if (__builtin_types_compatible_p(typeof(x), void *)) \
|
||||
{ T_PUT(void *, (void *)(intptr_t)(x), argnum); printf("void *\n"); } \
|
||||
else { \
|
||||
printf("%s:%d:%s: unsupported type for argument %d in T macro\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__, argnum); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/* we have 4 versions of T_HEADER:
|
||||
* - bad quality C++ version with time
|
||||
* - good quality C version with time
|
||||
@@ -608,10 +565,30 @@ extern T_cache_t *T_cache;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
extern int *T_active;
|
||||
|
||||
#define CONFIG_HLP_TPORT "tracer port\n"
|
||||
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
|
||||
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
|
||||
#define CONFIG_HLP_STDOUT "print log messges on console\n"
|
||||
|
||||
|
||||
#define TTRACER_CONFIG_PREFIX "TTracer"
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* configuration parameters for TTRACE utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define CMDLINE_TTRACEPARAMS_DESC { \
|
||||
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \
|
||||
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0}, \
|
||||
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0}, \
|
||||
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0}, \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* log on stdout */
|
||||
void T_init(int remote_port, int wait_for_tracer, int dont_fork);
|
||||
|
||||
void T_Config_Init(void);
|
||||
#else /* T_TRACER */
|
||||
|
||||
/* if T_TRACER is not defined or is 0, the T is deactivated */
|
||||
|
||||
@@ -39,10 +39,10 @@ typedef struct {
|
||||
#define T_SHM_FILENAME "/T_shm_segment"
|
||||
|
||||
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
|
||||
#define VCD_NUM_FUNCTIONS 187
|
||||
#define VCD_NUM_FUNCTIONS 190
|
||||
|
||||
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
|
||||
#define VCD_NUM_VARIABLES 131
|
||||
#define VCD_NUM_VARIABLES 128
|
||||
|
||||
/* first VCD function (to be kept up to date! see in T_messages.txt) */
|
||||
#define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
|
||||
|
||||
@@ -750,6 +750,27 @@ ID = LEGACY_OSA_TRACE
|
||||
GROUP = ALL:LEGACY_OSA:LEGACY_GROUP_TRACE:LEGACY
|
||||
FORMAT = string,log
|
||||
|
||||
ID = LEGACY_SIM_INFO
|
||||
DESC = SIM legacy logs - info level
|
||||
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_INFO:LEGACY
|
||||
FORMAT = string,log
|
||||
ID = LEGACY_SIM_ERROR
|
||||
DESC = SIM legacy logs - error level
|
||||
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_ERROR:LEGACY
|
||||
FORMAT = string,log
|
||||
ID = LEGACY_SIM_WARNING
|
||||
DESC = SIM legacy logs - warning level
|
||||
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_WARNING:LEGACY
|
||||
FORMAT = string,log
|
||||
ID = LEGACY_SIM_DEBUG
|
||||
DESC = SIM legacy logs - debug level
|
||||
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_DEBUG:LEGACY
|
||||
FORMAT = string,log
|
||||
ID = LEGACY_SIM_TRACE
|
||||
DESC = SIM legacy logs - trace level
|
||||
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
|
||||
FORMAT = string,log
|
||||
|
||||
# this is a bad hack but I won't fix (function util_print_hex_octets
|
||||
# in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
|
||||
# does funky things with the LOG_x macros but we work on the C pre-processor
|
||||
@@ -1034,18 +1055,6 @@ ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX1_UE
|
||||
DESC = VCD variable SUBFRAME_NUMBER_RX1_UE
|
||||
GROUP = ALL:VCD:UE:VCD_VARIABLE
|
||||
FORMAT = ulong,value
|
||||
ID = VCD_VARIABLE_MISSED_SLOTS_ENB
|
||||
DESC = VCD variable MISSED_SLOTS_ENB
|
||||
GROUP = ALL:VCD:ENB:VCD_VARIABLE
|
||||
FORMAT = ulong,value
|
||||
ID = VCD_VARIABLE_DAQ_MBOX
|
||||
DESC = VCD variable DAQ_MBOX
|
||||
GROUP = ALL:VCD:ENB:VCD_VARIABLE
|
||||
FORMAT = ulong,value
|
||||
ID = VCD_VARIABLE_UE_OFFSET_MBOX
|
||||
DESC = VCD variable UE_OFFSET_MBOX
|
||||
GROUP = ALL:VCD:UE:VCD_VARIABLE
|
||||
FORMAT = ulong,value
|
||||
ID = VCD_VARIABLE_UE_RX_OFFSET
|
||||
DESC = VCD variable UE_RX_OFFSET
|
||||
GROUP = ALL:VCD:UE:VCD_VARIABLE
|
||||
@@ -1553,6 +1562,18 @@ ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1
|
||||
DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
ID = VCD_FUNCTION_SIM_DO_DL_SIGNAL
|
||||
DESC = VCD function SIM_DO_DL_SIGNAL
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
ID = VCD_FUNCTION_SIM_DO_UL_SIGNAL
|
||||
DESC = VCD function SIM_DO_UL_SIGNAL
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
ID = VCD_FUNCTION_SIM_UE_TRX_READ
|
||||
DESC = VCD function SIM_UE_TRX_READ
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
ID = VCD_FUNCTION_eNB_TX
|
||||
DESC = VCD function eNB_TX
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
|
||||
@@ -367,20 +367,24 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
||||
int port = remote_port;
|
||||
int dont_wait = wait_for_tracer ? 0 : 1;
|
||||
void *f;
|
||||
|
||||
printf("local tracer starting\n");
|
||||
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR){
|
||||
printf("local tracer received SIGPIPE\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
init_shm(shm_file);
|
||||
s = local_socket;
|
||||
|
||||
printf("local tracer starting step 2\n");
|
||||
if (dont_wait) {
|
||||
char t = 2;
|
||||
printf("local tracer in no wait mode \n");
|
||||
if (write(s, &t, 1) != 1) abort();
|
||||
}
|
||||
|
||||
printf("local tracer starting step 3\n");
|
||||
f = forwarder(port, s);
|
||||
|
||||
printf("local tracer main loop.... \n");
|
||||
/* read messages */
|
||||
while (1) {
|
||||
wait_message();
|
||||
|
||||
@@ -117,12 +117,7 @@ err:
|
||||
e.e[frame_arg].i, e.e[subframe_arg].i, e.e[buffer_arg].bsize);
|
||||
if (!(frame == e.e[frame_arg].i && subframe == e.e[subframe_arg].i))
|
||||
continue;
|
||||
#if 0
|
||||
for (i = 0; i < e.e[buffer_arg].bsize/2; i++) {
|
||||
short *x = e.e[buffer_arg].b;
|
||||
x[i] *= 14;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fwrite(e.e[buffer_arg].b, e.e[buffer_arg].bsize, 1, out) != 1)
|
||||
{ perror(output_file); exit(1); }
|
||||
processed_subframes++;
|
||||
|
||||
@@ -124,12 +124,6 @@ err:
|
||||
}
|
||||
last_frame = frame;
|
||||
last_subframe = subframe;
|
||||
#if 0
|
||||
for (i = 0; i < e.e[buffer_arg].bsize/2; i++) {
|
||||
short *x = e.e[buffer_arg].b;
|
||||
x[i] *= 14;
|
||||
}
|
||||
#endif
|
||||
if (verbose)
|
||||
printf("save output frame %d subframe %d size %d\n",
|
||||
e.e[frame_arg].i, e.e[subframe_arg].i, e.e[buffer_arg].bsize);
|
||||
|
||||
@@ -22,13 +22,7 @@ int main(void)
|
||||
widget_add_child(g, c1, c2, 0);
|
||||
|
||||
plot = new_xy_plot(g, 100, 100, "xy plot test", 30);
|
||||
#if 0
|
||||
c2 = new_container(g, HORIZONTAL);
|
||||
widget_add_child(g, c2, plot, -1);
|
||||
widget_add_child(g, c1, c2, -1);
|
||||
#else
|
||||
widget_add_child(g, c1, plot, -1);
|
||||
#endif
|
||||
|
||||
tlcol = new_color(g, "#ddf");
|
||||
tl = new_textlist(g, 300, 10, tlcol);
|
||||
|
||||
@@ -124,20 +124,6 @@ x_window *x_create_window(x_connection *_x, int width, int height,
|
||||
|
||||
XMapWindow(x->d, ret->w);
|
||||
|
||||
#if 0
|
||||
/* wait for window to be mapped */
|
||||
LOGD("wait for map\n");
|
||||
while (1) {
|
||||
XEvent ev;
|
||||
//XWindowEvent(x->d, ret->w, StructureNotifyMask, &ev);
|
||||
XWindowEvent(x->d, ret->w, ExposureMask, &ev);
|
||||
LOGD("got ev %d\n", ev.type);
|
||||
//if (ev.type == MapNotify) break;
|
||||
if (ev.type == Expose) break;
|
||||
}
|
||||
LOGD("XXX create connection %p window %p (win id %d pixmap %d) w h %d %d\n", x, ret, (int)ret->w, (int)ret->p, width, height);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -265,14 +251,6 @@ void x_events(gui *_gui)
|
||||
ev.xbutton.button, 1);
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case MapNotify:
|
||||
if ((w = find_x_window(g, ev.xmap.window)) != NULL) {
|
||||
struct x_window *xw = w->x;
|
||||
xw->repaint = 1;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default: if (gui_logd) WARN("TODO: X event type %d\n", ev.type); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,165 +7,6 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#if 0
|
||||
/* this version behaves differently when you resize the XY plot. Say
|
||||
* you increase the size. The old (smaller) view is put at the center
|
||||
* of the new view. Everything inside keeps the same size/aspect ratio.
|
||||
* The other version below resizes the old view so that it fully occupies
|
||||
* the new view. It may introduce aspect ratio changes, but usage seems
|
||||
* to suggest it's a better behaviour.
|
||||
*/
|
||||
static void paint(gui *_gui, widget *_this)
|
||||
{
|
||||
struct gui *g = _gui;
|
||||
struct xy_plot_widget *this = _this;
|
||||
int wanted_plot_width, allocated_plot_width;
|
||||
int wanted_plot_height, allocated_plot_height;
|
||||
float pxsize;
|
||||
float ticdist;
|
||||
float tic;
|
||||
float ticstep;
|
||||
int k, kmin, kmax;
|
||||
float allocated_xmin, allocated_xmax;
|
||||
float allocated_ymin, allocated_ymax;
|
||||
float center;
|
||||
int i;
|
||||
int n;
|
||||
|
||||
# define FLIP(v) (-(v) + allocated_plot_height-1)
|
||||
|
||||
LOGD("PAINT xy plot xywh %d %d %d %d\n", this->common.x, this->common.y, this->common.width, this->common.height);
|
||||
|
||||
//x_draw_rectangle(g->x, g->xwin, 1, this->common.x, this->common.y, this->common.width, this->common.height);
|
||||
|
||||
wanted_plot_width = this->wanted_width;
|
||||
allocated_plot_width = this->common.width - this->vrule_width;
|
||||
wanted_plot_height = this->wanted_height;
|
||||
allocated_plot_height = this->common.height - this->label_height * 2;
|
||||
|
||||
/* plot zone */
|
||||
/* TODO: refine height - height of hrule text may be != from label */
|
||||
x_draw_rectangle(g->x, g->xwin, 1,
|
||||
this->common.x + this->vrule_width,
|
||||
this->common.y,
|
||||
this->common.width - this->vrule_width -1, /* -1 to see right border */
|
||||
this->common.height - this->label_height * 2);
|
||||
|
||||
/* horizontal tics */
|
||||
pxsize = (this->xmax - this->xmin) / wanted_plot_width;
|
||||
ticdist = 100;
|
||||
tic = floor(log10(ticdist * pxsize));
|
||||
ticstep = powf(10, tic);
|
||||
center = (this->xmax + this->xmin) / 2;
|
||||
allocated_xmin = center - ((this->xmax - this->xmin) *
|
||||
allocated_plot_width / wanted_plot_width) / 2;
|
||||
allocated_xmax = center + ((this->xmax - this->xmin) *
|
||||
allocated_plot_width / wanted_plot_width) / 2;
|
||||
/* adjust tic if too tight */
|
||||
LOGD("pre x ticstep %g\n", ticstep);
|
||||
while (1) {
|
||||
if (ticstep / (allocated_xmax - allocated_xmin)
|
||||
* (allocated_plot_width - 1) > 40) break;
|
||||
ticstep *= 2;
|
||||
}
|
||||
LOGD("post x ticstep %g\n", ticstep);
|
||||
LOGD("xmin/max %g %g width wanted allocated %d %d alloc xmin/max %g %g ticstep %g\n", this->xmin, this->xmax, wanted_plot_width, allocated_plot_width, allocated_xmin, allocated_xmax, ticstep);
|
||||
kmin = ceil(allocated_xmin / ticstep);
|
||||
kmax = floor(allocated_xmax / ticstep);
|
||||
for (k = kmin; k <= kmax; k++) {
|
||||
/*
|
||||
(k * ticstep - allocated_xmin) / (allocated_max - allocated_xmin) =
|
||||
(x - 0) / (allocated_plot_width-1 - 0)
|
||||
*/
|
||||
char v[64];
|
||||
int vwidth, dummy;
|
||||
int x = (k * ticstep - allocated_xmin) /
|
||||
(allocated_xmax - allocated_xmin) *
|
||||
(allocated_plot_width - 1);
|
||||
x_draw_line(g->x, g->xwin, FOREGROUND_COLOR,
|
||||
this->common.x + this->vrule_width + x,
|
||||
this->common.y + this->common.height - this->label_height * 2,
|
||||
this->common.x + this->vrule_width + x,
|
||||
this->common.y + this->common.height - this->label_height * 2 - 5);
|
||||
sprintf(v, "%g", k * ticstep);
|
||||
x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy);
|
||||
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
|
||||
this->common.x + this->vrule_width + x - vwidth/2,
|
||||
this->common.y + this->common.height - this->label_height * 2 +
|
||||
this->label_baseline,
|
||||
v);
|
||||
LOGD("tic k %d val %g x %d\n", k, k * ticstep, x);
|
||||
}
|
||||
|
||||
/* vertical tics */
|
||||
pxsize = (this->ymax - this->ymin) / wanted_plot_height;
|
||||
ticdist = 30;
|
||||
tic = floor(log10(ticdist * pxsize));
|
||||
ticstep = powf(10, tic);
|
||||
center = (this->ymax + this->ymin) / 2;
|
||||
allocated_ymin = center - ((this->ymax - this->ymin) *
|
||||
allocated_plot_height / wanted_plot_height) / 2;
|
||||
allocated_ymax = center + ((this->ymax - this->ymin) *
|
||||
allocated_plot_height / wanted_plot_height) / 2;
|
||||
/* adjust tic if too tight */
|
||||
LOGD("pre y ticstep %g\n", ticstep);
|
||||
while (1) {
|
||||
if (ticstep / (allocated_ymax - allocated_ymin)
|
||||
* (allocated_plot_height - 1) > 20) break;
|
||||
ticstep *= 2;
|
||||
}
|
||||
LOGD("post y ticstep %g\n", ticstep);
|
||||
LOGD("ymin/max %g %g height wanted allocated %d %d alloc ymin/max %g %g ticstep %g\n", this->ymin, this->ymax, wanted_plot_height, allocated_plot_height, allocated_ymin, allocated_ymax, ticstep);
|
||||
kmin = ceil(allocated_ymin / ticstep);
|
||||
kmax = floor(allocated_ymax / ticstep);
|
||||
for (k = kmin; k <= kmax; k++) {
|
||||
char v[64];
|
||||
int vwidth, dummy;
|
||||
int y = (k * ticstep - allocated_ymin) /
|
||||
(allocated_ymax - allocated_ymin) *
|
||||
(allocated_plot_height - 1);
|
||||
sprintf(v, "%g", k * ticstep);
|
||||
x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy);
|
||||
x_draw_line(g->x, g->xwin, FOREGROUND_COLOR,
|
||||
this->common.x + this->vrule_width,
|
||||
this->common.y + FLIP(y),
|
||||
this->common.x + this->vrule_width + 5,
|
||||
this->common.y + FLIP(y));
|
||||
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
|
||||
this->common.x + this->vrule_width - vwidth - 2,
|
||||
this->common.y + FLIP(y) - this->label_height/2+this->label_baseline,
|
||||
v);
|
||||
}
|
||||
|
||||
/* label at bottom, in the middle */
|
||||
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
|
||||
this->common.x + (this->common.width - this->label_width) / 2,
|
||||
this->common.y + this->common.height - this->label_height
|
||||
+ this->label_baseline,
|
||||
this->label);
|
||||
|
||||
for (n = 0; n < this->nplots; n++) {
|
||||
/* points */
|
||||
float ax, bx, ay, by;
|
||||
ax = (allocated_plot_width-1) / (allocated_xmax - allocated_xmin);
|
||||
bx = -ax * allocated_xmin;
|
||||
ay = (allocated_plot_height-1) / (allocated_ymax - allocated_ymin);
|
||||
by = -ay * allocated_ymin;
|
||||
for (i = 0; i < this->plots[n].npoints; i++) {
|
||||
int x, y;
|
||||
x = ax * this->plots[n].x[i] + bx;
|
||||
y = ay * this->plots[n].y[i] + by;
|
||||
if (x >= 0 && x < allocated_plot_width &&
|
||||
y >= 0 && y < allocated_plot_height)
|
||||
x_add_point(g->x,
|
||||
this->common.x + this->vrule_width + x,
|
||||
this->common.y + FLIP(y));
|
||||
}
|
||||
x_plot_points(g->x, g->xwin, this->plots[n].color);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void paint(gui *_gui, widget *_this)
|
||||
{
|
||||
struct gui *g = _gui;
|
||||
|
||||
@@ -20,42 +20,6 @@ struct iqlog {
|
||||
int max_length;
|
||||
};
|
||||
|
||||
#if 0
|
||||
/* this function passes all received IQ samples to the views */
|
||||
static void _event(void *p, event e)
|
||||
{
|
||||
struct iqlog *l = p;
|
||||
int i;
|
||||
void *buffer;
|
||||
int bsize;
|
||||
int nsamples;
|
||||
|
||||
if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0)
|
||||
return;
|
||||
|
||||
buffer = e.e[l->buffer_arg].b;
|
||||
bsize = e.e[l->buffer_arg].bsize;
|
||||
|
||||
nsamples = bsize / (2*sizeof(int16_t));
|
||||
|
||||
if (nsamples > l->max_length) {
|
||||
l->i = realloc(l->i, nsamples * sizeof(float));
|
||||
if (l->i == NULL) abort();
|
||||
l->q = realloc(l->q, nsamples * sizeof(float));
|
||||
if (l->q == NULL) abort();
|
||||
l->max_length = nsamples;
|
||||
}
|
||||
|
||||
for (i = 0; i < nsamples; i++) {
|
||||
l->i[i] = ((int16_t *)buffer)[i*2];
|
||||
l->q[i] = ((int16_t *)buffer)[i*2+1];
|
||||
}
|
||||
|
||||
for (i = 0; i < l->common.vsize; i++)
|
||||
l->common.v[i]->append(l->common.v[i], l->i, l->q, nsamples);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _event(void *p, event e)
|
||||
{
|
||||
struct iqlog *l = p;
|
||||
|
||||
@@ -56,176 +56,6 @@
|
||||
#define SC_RNTI 9
|
||||
#define G_RNTI 10
|
||||
|
||||
#if 0
|
||||
typedef enum mac_lte_oob_event {
|
||||
ltemac_send_preamble,
|
||||
ltemac_send_sr,
|
||||
ltemac_sr_failure
|
||||
} mac_lte_oob_event;
|
||||
|
||||
typedef enum mac_lte_dl_retx {
|
||||
dl_retx_no,
|
||||
dl_retx_yes,
|
||||
dl_retx_unknown
|
||||
} mac_lte_dl_retx;
|
||||
|
||||
typedef enum mac_lte_crc_status {
|
||||
crc_fail = 0,
|
||||
crc_success = 1,
|
||||
crc_high_code_rate = 2,
|
||||
crc_pdsch_lost = 3,
|
||||
crc_duplicate_nonzero_rv = 4,
|
||||
crc_false_dci = 5
|
||||
} mac_lte_crc_status;
|
||||
|
||||
typedef enum mac_lte_carrier_id {
|
||||
carrier_id_primary,
|
||||
carrier_id_secondary_1,
|
||||
carrier_id_secondary_2,
|
||||
carrier_id_secondary_3,
|
||||
carrier_id_secondary_4
|
||||
} mac_lte_carrier_id;
|
||||
|
||||
typedef enum mac_lte_ce_mode {
|
||||
no_ce_mode = 0,
|
||||
ce_mode_a = 1,
|
||||
ce_mode_b = 2
|
||||
} mac_lte_ce_mode;
|
||||
|
||||
typedef enum mac_lte_nb_mode {
|
||||
no_nb_mode = 0,
|
||||
nb_mode = 1
|
||||
} mac_lte_nb_mode;
|
||||
|
||||
/* Context info attached to each LTE MAC frame */
|
||||
typedef struct mac_lte_info
|
||||
{
|
||||
/* Needed for decode */
|
||||
guint8 radioType;
|
||||
guint8 direction;
|
||||
guint8 rntiType;
|
||||
|
||||
/* Extra info to display */
|
||||
guint16 rnti;
|
||||
guint16 ueid;
|
||||
|
||||
/* Timing info */
|
||||
guint16 sysframeNumber;
|
||||
guint16 subframeNumber;
|
||||
|
||||
/* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
|
||||
gboolean subframeNumberOfGrantPresent;
|
||||
guint16 subframeNumberOfGrant;
|
||||
|
||||
/* Flag set only if doing PHY-level data test - i.e. there may not be a
|
||||
well-formed MAC PDU so just show as raw data */
|
||||
gboolean isPredefinedData;
|
||||
|
||||
/* Length of DL PDU or UL grant size in bytes */
|
||||
guint16 length;
|
||||
|
||||
/* 0=newTx, 1=first-retx, etc */
|
||||
guint8 reTxCount;
|
||||
guint8 isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */
|
||||
|
||||
/* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set */
|
||||
gboolean isExtendedBSRSizes;
|
||||
|
||||
/* UL only. Indicates if the R10 simultaneousPUCCH-PUSCH parameter is set for PCell */
|
||||
gboolean isSimultPUCCHPUSCHPCell;
|
||||
|
||||
/* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set for PSCell */
|
||||
gboolean isSimultPUCCHPUSCHPSCell;
|
||||
|
||||
/* Status of CRC check. For UE it is DL only. For eNodeB it is UL
|
||||
only. For an analyzer, it is present for both DL and UL. */
|
||||
gboolean crcStatusValid;
|
||||
mac_lte_crc_status crcStatus;
|
||||
|
||||
/* Carrier ID */
|
||||
mac_lte_carrier_id carrierId;
|
||||
|
||||
/* DL only. Is this known to be a retransmission? */
|
||||
mac_lte_dl_retx dl_retx;
|
||||
|
||||
/* DL only. CE mode to be used for RAR decoding */
|
||||
mac_lte_ce_mode ceMode;
|
||||
|
||||
/* DL and UL. NB-IoT mode of the UE */
|
||||
mac_lte_nb_mode nbMode;
|
||||
|
||||
/* More Physical layer info (see direction above for which side of union to use) */
|
||||
union {
|
||||
struct mac_lte_ul_phy_info
|
||||
{
|
||||
guint8 present; /* Remaining UL fields are present and should be displayed */
|
||||
guint8 modulation_type;
|
||||
guint8 tbs_index;
|
||||
guint8 resource_block_length;
|
||||
guint8 resource_block_start;
|
||||
guint8 harq_id;
|
||||
gboolean ndi;
|
||||
} ul_info;
|
||||
struct mac_lte_dl_phy_info
|
||||
{
|
||||
guint8 present; /* Remaining DL fields are present and should be displayed */
|
||||
guint8 dci_format;
|
||||
guint8 resource_allocation_type;
|
||||
guint8 aggregation_level;
|
||||
guint8 mcs_index;
|
||||
guint8 redundancy_version_index;
|
||||
guint8 resource_block_length;
|
||||
guint8 harq_id;
|
||||
gboolean ndi;
|
||||
guint8 transport_block; /* 0..1 */
|
||||
} dl_info;
|
||||
} detailed_phy_info;
|
||||
|
||||
/* Relating to out-of-band events */
|
||||
/* N.B. dissector will only look to these fields if length is 0... */
|
||||
mac_lte_oob_event oob_event;
|
||||
guint8 rapid;
|
||||
guint8 rach_attempt_number;
|
||||
#define MAX_SRs 20
|
||||
guint16 number_of_srs;
|
||||
guint16 oob_ueid[MAX_SRs];
|
||||
guint16 oob_rnti[MAX_SRs];
|
||||
} mac_lte_info;
|
||||
|
||||
|
||||
typedef struct mac_lte_tap_info {
|
||||
/* Info from context */
|
||||
guint16 rnti;
|
||||
guint16 ueid;
|
||||
guint8 rntiType;
|
||||
guint8 isPredefinedData;
|
||||
gboolean crcStatusValid;
|
||||
mac_lte_crc_status crcStatus;
|
||||
guint8 direction;
|
||||
|
||||
guint8 isPHYRetx;
|
||||
guint16 ueInTTI;
|
||||
|
||||
nstime_t mac_lte_time;
|
||||
|
||||
/* Number of bytes (which part is used depends upon context settings) */
|
||||
guint32 single_number_of_bytes;
|
||||
guint32 bytes_for_lcid[11];
|
||||
guint32 sdus_for_lcid[11];
|
||||
guint8 number_of_rars;
|
||||
guint8 number_of_paging_ids;
|
||||
|
||||
/* Number of padding bytes includes padding subheaders and trailing padding */
|
||||
guint16 padding_bytes;
|
||||
guint16 raw_length;
|
||||
} mac_lte_tap_info;
|
||||
|
||||
|
||||
/* Accessor function to check if a frame was considered to be ReTx */
|
||||
int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************/
|
||||
/* UDP framing format */
|
||||
/* ----------------------- */
|
||||
@@ -309,82 +139,3 @@ int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
|
||||
continues until the end of the frame) */
|
||||
#define MAC_LTE_PAYLOAD_TAG 0x01
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
/* Type to store parameters for configuring LCID->RLC channel settings for DRB */
|
||||
/* Some are optional, and may not be seen (e.g. on reestablishment) */
|
||||
typedef struct drb_mapping_t
|
||||
{
|
||||
guint16 ueid; /* Mandatory */
|
||||
guint8 drbid; /* Mandatory */
|
||||
gboolean lcid_present;
|
||||
guint8 lcid; /* Part of LogicalChannelConfig - optional */
|
||||
gboolean rlcMode_present;
|
||||
guint8 rlcMode; /* Part of RLC config - optional */
|
||||
gboolean rlc_ul_ext_li_field; /* Part of RLC config - optional */
|
||||
gboolean rlc_dl_ext_li_field; /* Part of RLC config - optional */
|
||||
gboolean rlc_ul_ext_am_sn; /* Part of RLC config - optional */
|
||||
gboolean rlc_dl_ext_am_sn; /* Part of RLC config - optional */
|
||||
gboolean um_sn_length_present;
|
||||
guint8 um_sn_length; /* Part of RLC config - optional */
|
||||
gboolean ul_priority_present;
|
||||
guint8 ul_priority; /* Part of LogicalChannelConfig - optional */
|
||||
gboolean pdcp_sn_size_present;
|
||||
guint8 pdcp_sn_size; /* Part of pdcp-Config - optional */
|
||||
} drb_mapping_t;
|
||||
|
||||
|
||||
/* Set details of an LCID -> drb channel mapping. To be called from
|
||||
configuration protocol (e.g. RRC) */
|
||||
void set_mac_lte_channel_mapping(drb_mapping_t *drb_mapping);
|
||||
|
||||
|
||||
/* Dedicated DRX config. Used to verify that a sensible config is given.
|
||||
Also, beginning to configure MAC with this config and (optionally) show
|
||||
DRX config and state (cycles/timers) attached to each UL/DL PDU! */
|
||||
typedef struct drx_config_t {
|
||||
gboolean configured;
|
||||
guint32 frameNum;
|
||||
guint32 previousFrameNum;
|
||||
|
||||
guint32 onDurationTimer;
|
||||
guint32 inactivityTimer;
|
||||
guint32 retransmissionTimer;
|
||||
guint32 longCycle;
|
||||
guint32 cycleOffset;
|
||||
/* Optional Short cycle */
|
||||
gboolean shortCycleConfigured;
|
||||
guint32 shortCycle;
|
||||
guint32 shortCycleTimer;
|
||||
} drx_config_t;
|
||||
|
||||
/* Functions to set/release up dedicated DRX config */
|
||||
void set_mac_lte_drx_config(guint16 ueid, drx_config_t *drx_config, packet_info *pinfo);
|
||||
void set_mac_lte_drx_config_release(guint16 ueid, packet_info *pinfo);
|
||||
|
||||
/* RRC can tell this dissector which RAPIDs are Group A, Group A&B */
|
||||
void set_mac_lte_rapid_ranges(guint groupA, guint all_RA);
|
||||
|
||||
/* RRC can indicate whether extended BSR sizes are used */
|
||||
void set_mac_lte_extended_bsr_sizes(guint16 ueid, gboolean use_ext_bsr_sizes, packet_info *pinfo);
|
||||
|
||||
/* RRC can indicate whether simultaneous PUCCH/PUSCH is used */
|
||||
typedef enum {
|
||||
SIMULT_PUCCH_PUSCH_PCELL = 0,
|
||||
SIMULT_PUCCH_PUSCH_PSCELL
|
||||
} simult_pucch_pusch_cell_type;
|
||||
void set_mac_lte_simult_pucch_pusch(guint16 ueid, simult_pucch_pusch_cell_type cell_type, gboolean use_simult_pucch_pusch, packet_info *pinfo);
|
||||
|
||||
/* Functions to be called from outside this module (e.g. in a plugin, where mac_lte_info
|
||||
isn't available) to get/set per-packet data */
|
||||
WS_DLL_PUBLIC
|
||||
mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo);
|
||||
WS_DLL_PUBLIC
|
||||
void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info);
|
||||
|
||||
/* Function to attempt to populate p_mac_lte_info using framing definition above */
|
||||
gboolean dissect_mac_lte_context_fields(struct mac_lte_info *p_mac_lte_info, tvbuff_t *tvb,
|
||||
gint *p_offset);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -95,7 +95,7 @@ hash_table_t *hashtable_create(const hash_size_t sizeP, hash_size_t (*hashfuncP)
|
||||
* Cleanup
|
||||
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the hash_table_t.
|
||||
*/
|
||||
hashtable_rc_t hashtable_destroy(hash_table_t * const hashtblP)
|
||||
hashtable_rc_t hashtable_destroy(hash_table_t * hashtblP)
|
||||
{
|
||||
hash_size_t n;
|
||||
hash_node_t *node, *oldnode;
|
||||
@@ -117,6 +117,7 @@ hashtable_rc_t hashtable_destroy(hash_table_t * const hashtblP)
|
||||
}
|
||||
free(hashtblP->nodes);
|
||||
free(hashtblP);
|
||||
hashtblP=NULL;
|
||||
return HASH_TABLE_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -35,9 +35,11 @@
|
||||
#ifndef ASSERTIONS_H_
|
||||
#define ASSERTIONS_H_
|
||||
|
||||
void output_log_mem(void);
|
||||
#define _Assert_Exit_ \
|
||||
{ \
|
||||
fprintf(stderr, "\nExiting execution\n"); \
|
||||
output_log_mem(); \
|
||||
display_backtrace(); \
|
||||
fflush(stdout); \
|
||||
fflush(stderr); \
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
#include "assertions.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "intertask_interface_dump.h"
|
||||
|
||||
#if T_TRACER
|
||||
#include "T.h"
|
||||
@@ -328,22 +327,17 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
|
||||
/* Increment the global message number */
|
||||
message_number = itti_increment_message_number ();
|
||||
|
||||
#if 0
|
||||
/* itti dump is disabled */
|
||||
itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name,
|
||||
sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
|
||||
#endif
|
||||
|
||||
if (destination_task_id != TASK_UNKNOWN) {
|
||||
|
||||
if (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_ENDED) {
|
||||
ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Message %s, number %lu with priority %d can not be sent from %s to queue (%u:%s), ended destination task!\n",
|
||||
itti_desc.messages_info[message_id].name,
|
||||
message_number,
|
||||
priority,
|
||||
itti_get_task_name(origin_task_id),
|
||||
destination_task_id,
|
||||
itti_get_task_name(destination_task_id));
|
||||
if (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_ENDED ||
|
||||
itti_desc.threads[destination_thread_id].task_state == TASK_STATE_NOT_CONFIGURED) {
|
||||
ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Message %s, number %lu with priority %d can not be sent from %s to queue (%u:%s), unconfigured or ended destination task!\n",
|
||||
itti_desc.messages_info[message_id].name,
|
||||
message_number,
|
||||
priority,
|
||||
itti_get_task_name(origin_task_id),
|
||||
destination_task_id,
|
||||
itti_get_task_name(destination_task_id));
|
||||
} else {
|
||||
if(!emulate_rf){
|
||||
/* We cannot send a message if the task is not running */
|
||||
@@ -429,22 +423,17 @@ int itti_try_send_msg_to_task(task_id_t destination_task_id, instance_t instance
|
||||
/* Increment the global message number */
|
||||
message_number = itti_increment_message_number ();
|
||||
|
||||
#if 0
|
||||
/* itti dump is disabled */
|
||||
itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name,
|
||||
sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
|
||||
#endif
|
||||
|
||||
if (destination_task_id != TASK_UNKNOWN) {
|
||||
|
||||
if (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_ENDED) {
|
||||
ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Message %s, number %lu with priority %d can not be sent from %s to queue (%u:%s), ended destination task!\n",
|
||||
itti_desc.messages_info[message_id].name,
|
||||
message_number,
|
||||
priority,
|
||||
itti_get_task_name(origin_task_id),
|
||||
destination_task_id,
|
||||
itti_get_task_name(destination_task_id));
|
||||
if (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_ENDED ||
|
||||
itti_desc.threads[destination_thread_id].task_state == TASK_STATE_NOT_CONFIGURED) {
|
||||
ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Message %s, number %lu with priority %d can not be sent from %s to queue (%u:%s), unconfigured or ended destination task!\n",
|
||||
itti_desc.messages_info[message_id].name,
|
||||
message_number,
|
||||
priority,
|
||||
itti_get_task_name(origin_task_id),
|
||||
destination_task_id,
|
||||
itti_get_task_name(destination_task_id));
|
||||
} else {
|
||||
/* We cannot send a message if the task is not running */
|
||||
AssertFatal (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_READY,
|
||||
@@ -727,15 +716,18 @@ void itti_mark_task_ready(task_id_t task_id)
|
||||
|
||||
AssertFatal (thread_id < itti_desc.thread_max, "Thread id (%d) is out of range (%d)!\n", thread_id, itti_desc.thread_max);
|
||||
|
||||
#if 0
|
||||
/* itti dump is disabled */
|
||||
/* Register the thread in itti dump */
|
||||
itti_dump_thread_use_ring_buffer();
|
||||
#endif
|
||||
|
||||
/* Mark the thread as using LFDS queue */
|
||||
lfds611_queue_use(itti_desc.tasks[task_id].message_queue);
|
||||
|
||||
#if defined(UE_EXPANSION) || defined(RTAI)
|
||||
/* Assign low priority to created threads */
|
||||
{
|
||||
struct sched_param sched_param;
|
||||
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
|
||||
sched_setscheduler(0, SCHED_FIFO, &sched_param);
|
||||
}
|
||||
#endif
|
||||
|
||||
itti_desc.threads[thread_id].task_state = TASK_STATE_READY;
|
||||
itti_desc.ready_tasks ++;
|
||||
|
||||
@@ -777,7 +769,7 @@ void itti_terminate_tasks(task_id_t task_id)
|
||||
}
|
||||
|
||||
int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_id_max, const task_info_t *tasks_info,
|
||||
const message_info_t *messages_info, const char * const messages_definition_xml, const char * const dump_file_name)
|
||||
const message_info_t *messages_info)
|
||||
{
|
||||
task_id_t task_id;
|
||||
thread_id_t thread_id;
|
||||
@@ -862,11 +854,6 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
|
||||
itti_desc.wait_tasks = 0;
|
||||
itti_desc.created_tasks = 0;
|
||||
itti_desc.ready_tasks = 0;
|
||||
#if 0
|
||||
/* itti dump is disabled */
|
||||
itti_dump_init (messages_definition_xml, dump_file_name);
|
||||
#endif
|
||||
|
||||
CHECK_INIT_RETURN(timer_init ());
|
||||
|
||||
return 0;
|
||||
@@ -931,11 +918,6 @@ void itti_wait_tasks_end(void)
|
||||
ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Some threads are still running, force exit\n");
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* itti dump is disabled */
|
||||
itti_dump_exit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void itti_send_terminate_message(task_id_t task_id)
|
||||
|
||||
@@ -1,790 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/** @brief Intertask Interface Signal Dumper
|
||||
* Allows users to connect their itti_analyzer to this process and dump
|
||||
* signals exchanged between tasks.
|
||||
* @author Sebastien Roux <sebastien.roux@eurecom.fr>
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE // required for pthread_setname_np()
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <sys/eventfd.h>
|
||||
|
||||
#include "assertions.h"
|
||||
#include "liblfds611.h"
|
||||
|
||||
#include "itti_types.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "intertask_interface_dump.h"
|
||||
|
||||
#if T_TRACER
|
||||
#include "T.h"
|
||||
#endif
|
||||
|
||||
static const int itti_dump_debug = 0; // 0x8 | 0x4 | 0x2;
|
||||
|
||||
# define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) fprintf(stdout, "[ITTI_DUMP][D]"x, ##args); } \
|
||||
while(0)
|
||||
#define ITTI_DUMP_ERROR(x, args...) do { fprintf(stdout, "[ITTI_DUMP][E]"x, ##args); } \
|
||||
while(0)
|
||||
|
||||
|
||||
typedef struct itti_dump_queue_item_s {
|
||||
MessageDef *data;
|
||||
uint32_t data_size;
|
||||
uint32_t message_number;
|
||||
uint32_t message_type;
|
||||
uint32_t message_size;
|
||||
} itti_dump_queue_item_t;
|
||||
|
||||
typedef struct {
|
||||
int sd;
|
||||
uint32_t last_message_number;
|
||||
} itti_client_desc_t;
|
||||
|
||||
typedef struct itti_desc_s {
|
||||
/* Asynchronous thread that write to file/accept new clients */
|
||||
pthread_t itti_acceptor_thread;
|
||||
pthread_attr_t attr;
|
||||
|
||||
/* List of messages to dump.
|
||||
* NOTE: we limit the size of this queue to retain only the last exchanged
|
||||
* messages. The size can be increased by setting up the ITTI_QUEUE_MAX_ELEMENTS
|
||||
* in mme_default_values.h or by putting a custom in the configuration file.
|
||||
*/
|
||||
struct lfds611_ringbuffer_state *itti_message_queue;
|
||||
|
||||
int nb_connected;
|
||||
|
||||
/* Event fd used to notify new messages (semaphore) */
|
||||
int event_fd;
|
||||
int itti_listen_socket;
|
||||
|
||||
itti_client_desc_t itti_clients[ITTI_DUMP_MAX_CON];
|
||||
} itti_desc_t;
|
||||
|
||||
typedef struct {
|
||||
itti_socket_header_t socket_header;
|
||||
|
||||
itti_signal_header_t signal_header;
|
||||
|
||||
/* Message payload is added here, this struct is used as an header */
|
||||
} itti_dump_message_t;
|
||||
|
||||
typedef struct {
|
||||
itti_socket_header_t socket_header;
|
||||
} itti_statistic_message_t;
|
||||
|
||||
static const itti_message_types_t itti_dump_xml_definition_end = ITTI_DUMP_XML_DEFINITION_END;
|
||||
static const itti_message_types_t itti_dump_message_type_end = ITTI_DUMP_MESSAGE_TYPE_END;
|
||||
|
||||
static itti_desc_t itti_dump_queue;
|
||||
static FILE *dump_file = NULL;
|
||||
static int itti_dump_running = 1;
|
||||
|
||||
static volatile uint32_t pending_messages = 0;
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
static int itti_dump_send_message(int sd, itti_dump_queue_item_t *message)
|
||||
{
|
||||
itti_dump_message_t *new_message;
|
||||
ssize_t bytes_sent = 0, total_sent = 0;
|
||||
uint8_t *data_ptr;
|
||||
|
||||
/* Allocate memory for message header and payload */
|
||||
size_t size = sizeof(itti_dump_message_t) + message->data_size + sizeof(itti_message_types_t);
|
||||
|
||||
AssertFatal (sd > 0, "Socket descriptor (%d) is invalid!\n", sd);
|
||||
AssertFatal (message != NULL, "Message is NULL!\n");
|
||||
|
||||
new_message = malloc(size);
|
||||
AssertFatal (new_message != NULL, "New message allocation failed!\n");
|
||||
|
||||
/* Preparing the header */
|
||||
new_message->socket_header.message_size = size;
|
||||
new_message->socket_header.message_type = ITTI_DUMP_MESSAGE_TYPE;
|
||||
/* Adds message number in unsigned decimal ASCII format */
|
||||
snprintf(new_message->signal_header.message_number_char, sizeof(new_message->signal_header.message_number_char),
|
||||
MESSAGE_NUMBER_CHAR_FORMAT, message->message_number);
|
||||
new_message->signal_header.message_number_char[sizeof(new_message->signal_header.message_number_char) - 1] = '\n';
|
||||
/* Appends message payload */
|
||||
memcpy(&new_message[1], message->data, message->data_size);
|
||||
|
||||
memcpy(((void *) &new_message[1]) + message->data_size, &itti_dump_message_type_end, sizeof(itti_message_types_t));
|
||||
|
||||
data_ptr = (uint8_t *)&new_message[0];
|
||||
|
||||
do {
|
||||
bytes_sent = send(sd, &data_ptr[total_sent], size - total_sent, 0);
|
||||
|
||||
if (bytes_sent < 0) {
|
||||
ITTI_DUMP_ERROR("[%d] Failed to send %zu bytes to socket (%d:%s)\n",
|
||||
sd, size, errno, strerror(errno));
|
||||
free(new_message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
total_sent += bytes_sent;
|
||||
} while (total_sent != size);
|
||||
|
||||
free(new_message);
|
||||
return total_sent;
|
||||
}
|
||||
|
||||
static int itti_dump_fwrite_message(itti_dump_queue_item_t *message)
|
||||
{
|
||||
itti_dump_message_t new_message_header;
|
||||
|
||||
if ((dump_file != NULL) && (message != NULL)) {
|
||||
|
||||
new_message_header.socket_header.message_size = message->message_size + sizeof(itti_dump_message_t) + sizeof(itti_message_types_t);
|
||||
new_message_header.socket_header.message_type = message->message_type;
|
||||
snprintf(new_message_header.signal_header.message_number_char, sizeof(new_message_header.signal_header.message_number_char),
|
||||
MESSAGE_NUMBER_CHAR_FORMAT, message->message_number);
|
||||
new_message_header.signal_header.message_number_char[sizeof(new_message_header.signal_header.message_number_char) - 1] = '\n';
|
||||
|
||||
fwrite (&new_message_header, sizeof(itti_dump_message_t), 1, dump_file);
|
||||
fwrite (message->data, message->data_size, 1, dump_file);
|
||||
fwrite (&itti_dump_message_type_end, sizeof(itti_message_types_t), 1, dump_file);
|
||||
fflush (dump_file);
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int itti_dump_send_xml_definition(const int sd, const char *message_definition_xml,
|
||||
const uint32_t message_definition_xml_length)
|
||||
{
|
||||
itti_socket_header_t *itti_dump_message;
|
||||
/* Allocate memory for message header and payload */
|
||||
size_t itti_dump_message_size;
|
||||
ssize_t bytes_sent = 0, total_sent = 0;
|
||||
uint8_t *data_ptr;
|
||||
|
||||
AssertFatal (sd > 0, "Socket descriptor (%d) is invalid!\n", sd);
|
||||
AssertFatal (message_definition_xml != NULL, "Message definition XML is NULL!\n");
|
||||
|
||||
itti_dump_message_size = sizeof(itti_socket_header_t) + message_definition_xml_length + sizeof(itti_message_types_t);
|
||||
|
||||
itti_dump_message = calloc(1, itti_dump_message_size);
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, "[%d] Sending XML definition message of size %zu to observer peer\n",
|
||||
sd, itti_dump_message_size);
|
||||
|
||||
itti_dump_message->message_size = itti_dump_message_size;
|
||||
itti_dump_message->message_type = ITTI_DUMP_XML_DEFINITION;
|
||||
|
||||
/* Copying message definition */
|
||||
memcpy (&itti_dump_message[1], message_definition_xml, message_definition_xml_length);
|
||||
memcpy (((void *) &itti_dump_message[1]) + message_definition_xml_length, &itti_dump_xml_definition_end, sizeof(itti_message_types_t));
|
||||
|
||||
data_ptr = (uint8_t *)&itti_dump_message[0];
|
||||
|
||||
do {
|
||||
bytes_sent = send(sd, &data_ptr[total_sent], itti_dump_message_size - total_sent, 0);
|
||||
|
||||
if (bytes_sent < 0) {
|
||||
ITTI_DUMP_ERROR("[%d] Failed to send %zu bytes to socket (%d:%s)\n",
|
||||
sd, itti_dump_message_size, errno, strerror(errno));
|
||||
free(itti_dump_message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
total_sent += bytes_sent;
|
||||
} while (total_sent != itti_dump_message_size);
|
||||
|
||||
free(itti_dump_message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void itti_dump_user_data_delete_function(void *user_data, void *user_state)
|
||||
{
|
||||
(void)user_state; // UNUSED
|
||||
|
||||
if (user_data != NULL) {
|
||||
itti_dump_queue_item_t *item;
|
||||
task_id_t task_id;
|
||||
int result;
|
||||
|
||||
item = (itti_dump_queue_item_t *)user_data;
|
||||
|
||||
if (item->data != NULL) {
|
||||
task_id = ITTI_MSG_ORIGIN_ID(item->data);
|
||||
result = itti_free(task_id, item->data);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
} else {
|
||||
task_id = TASK_UNKNOWN;
|
||||
}
|
||||
|
||||
result = itti_free(task_id, item);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
}
|
||||
}
|
||||
|
||||
static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t message_size,
|
||||
uint32_t message_type)
|
||||
{
|
||||
struct lfds611_freelist_element *new_queue_element = NULL;
|
||||
int overwrite_flag;
|
||||
AssertFatal (new != NULL, "Message to queue is NULL!\n");
|
||||
|
||||
new->message_type = message_type;
|
||||
new->message_size = message_size;
|
||||
|
||||
ITTI_DUMP_DEBUG (0x1, " itti_dump_enqueue_message: lfds611_ringbuffer_get_write_element\n");
|
||||
new_queue_element = lfds611_ringbuffer_get_write_element (itti_dump_queue.itti_message_queue, &new_queue_element, &overwrite_flag);
|
||||
|
||||
if (overwrite_flag != 0) {
|
||||
// no free element available: overwrite a non read one => data loss!
|
||||
void *old = NULL;
|
||||
|
||||
lfds611_freelist_get_user_data_from_element(new_queue_element, &old);
|
||||
ITTI_DUMP_DEBUG (0x4, " overwrite_flag set, freeing old data %p %p\n", new_queue_element, old);
|
||||
itti_dump_user_data_delete_function (old, NULL);
|
||||
}
|
||||
|
||||
lfds611_freelist_set_user_data_in_element(new_queue_element, new);
|
||||
lfds611_ringbuffer_put_write_element(itti_dump_queue.itti_message_queue, new_queue_element);
|
||||
|
||||
if (overwrite_flag == 0) {
|
||||
{
|
||||
ssize_t write_ret;
|
||||
eventfd_t sem_counter = 1;
|
||||
|
||||
/* Call to write for an event fd must be of 8 bytes */
|
||||
write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
|
||||
AssertFatal (write_ret == sizeof(sem_counter), "Write to dump event failed (%d/%d)!\n", (int) write_ret, (int) sizeof(sem_counter));
|
||||
}
|
||||
// add one to pending_messages, atomically
|
||||
__sync_fetch_and_add (&pending_messages, 1);
|
||||
}
|
||||
|
||||
ITTI_DUMP_DEBUG (0x2, " Added element to queue %p %p, pending %u, type %u\n", new_queue_element, new, pending_messages, message_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void itti_dump_socket_exit(void)
|
||||
{
|
||||
close(itti_dump_queue.event_fd);
|
||||
close(itti_dump_queue.itti_listen_socket);
|
||||
|
||||
/* Leave the thread as we detected end signal */
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
static int itti_dump_flush_ring_buffer(int flush_all)
|
||||
{
|
||||
struct lfds611_freelist_element *element = NULL;
|
||||
void *user_data;
|
||||
int j;
|
||||
int consumer;
|
||||
|
||||
/* Check if there is a least one consumer */
|
||||
consumer = 0;
|
||||
|
||||
if (dump_file != NULL) {
|
||||
consumer = 1;
|
||||
} else {
|
||||
for (j = 0; j < ITTI_DUMP_MAX_CON; j++) {
|
||||
if (itti_dump_queue.itti_clients[j].sd > 0) {
|
||||
consumer = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (consumer > 0) {
|
||||
do {
|
||||
/* Acquire the ring element */
|
||||
lfds611_ringbuffer_get_read_element(itti_dump_queue.itti_message_queue, &element);
|
||||
|
||||
// subtract one from pending_messages, atomically
|
||||
__sync_fetch_and_sub (&pending_messages, 1);
|
||||
|
||||
if (element == NULL) {
|
||||
if (flush_all != 0) {
|
||||
flush_all = 0;
|
||||
} else {
|
||||
AssertFatal (0, "Dump event with no data!\n");
|
||||
}
|
||||
} else {
|
||||
/* Retrieve user part of the message */
|
||||
lfds611_freelist_get_user_data_from_element(element, &user_data);
|
||||
|
||||
ITTI_DUMP_DEBUG (0x2, " removed element from queue %p %p, pending %u\n", element, user_data, pending_messages);
|
||||
|
||||
if (((itti_dump_queue_item_t *)user_data)->message_type == ITTI_DUMP_EXIT_SIGNAL) {
|
||||
lfds611_ringbuffer_put_read_element(itti_dump_queue.itti_message_queue, element);
|
||||
itti_dump_socket_exit();
|
||||
}
|
||||
|
||||
/* Write message to file */
|
||||
itti_dump_fwrite_message((itti_dump_queue_item_t *)user_data);
|
||||
|
||||
/* Send message to remote analyzer */
|
||||
for (j = 0; j < ITTI_DUMP_MAX_CON; j++) {
|
||||
if (itti_dump_queue.itti_clients[j].sd > 0) {
|
||||
itti_dump_send_message(itti_dump_queue.itti_clients[j].sd,
|
||||
(itti_dump_queue_item_t *)user_data);
|
||||
}
|
||||
}
|
||||
|
||||
itti_dump_user_data_delete_function (user_data, NULL);
|
||||
lfds611_freelist_set_user_data_in_element(element, NULL);
|
||||
|
||||
/* We have finished with this element, reinsert it in the ring buffer */
|
||||
lfds611_ringbuffer_put_read_element(itti_dump_queue.itti_message_queue, element);
|
||||
}
|
||||
} while(flush_all
|
||||
);
|
||||
}
|
||||
|
||||
return (consumer);
|
||||
}
|
||||
|
||||
static int itti_dump_handle_new_connection(int sd, const char *xml_definition, uint32_t xml_definition_length)
|
||||
{
|
||||
if (itti_dump_queue.nb_connected < ITTI_DUMP_MAX_CON) {
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < ITTI_DUMP_MAX_CON; i++) {
|
||||
/* Let's find a place to store the new client */
|
||||
if (itti_dump_queue.itti_clients[i].sd == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, " Found place to store new connection: %d\n", i);
|
||||
|
||||
AssertFatal (i < ITTI_DUMP_MAX_CON, "No more connection available (%d/%d) for socked %d!\n", i, ITTI_DUMP_MAX_CON, sd);
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, " Socket %d accepted\n", sd);
|
||||
|
||||
/* Send the XML message definition */
|
||||
if (itti_dump_send_xml_definition(sd, xml_definition, xml_definition_length) < 0) {
|
||||
AssertError (0, {}, "Failed to send XML definition!\n");
|
||||
close (sd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
itti_dump_queue.itti_clients[i].sd = sd;
|
||||
itti_dump_queue.nb_connected++;
|
||||
} else {
|
||||
ITTI_DUMP_DEBUG(0x2, " Socket %d rejected\n", sd);
|
||||
/* We have reached max number of users connected...
|
||||
* Reject the connection.
|
||||
*/
|
||||
close (sd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *itti_dump_socket(void *arg_p)
|
||||
{
|
||||
uint32_t message_definition_xml_length;
|
||||
char *message_definition_xml;
|
||||
int rc;
|
||||
int itti_listen_socket, max_sd;
|
||||
int on = 1;
|
||||
fd_set read_set, working_set;
|
||||
struct sockaddr_in servaddr; /* socket address structure */
|
||||
|
||||
struct timeval *timeout_p = NULL;
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, " Creating TCP dump socket on port %u\n", ITTI_PORT);
|
||||
|
||||
message_definition_xml = (char *)arg_p;
|
||||
AssertFatal (message_definition_xml != NULL, "Message definition XML is NULL!\n");
|
||||
|
||||
message_definition_xml_length = strlen(message_definition_xml) + 1;
|
||||
|
||||
if ((itti_listen_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
|
||||
ITTI_DUMP_ERROR(" ocket creation failed (%d:%s)\n", errno, strerror(errno));
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
/* Allow socket reuse */
|
||||
rc = setsockopt(itti_listen_socket, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&on, sizeof(on));
|
||||
|
||||
if (rc < 0) {
|
||||
ITTI_DUMP_ERROR(" setsockopt SO_REUSEADDR failed (%d:%s)\n", errno, strerror(errno));
|
||||
close(itti_listen_socket);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
/* Set socket to be non-blocking.
|
||||
* NOTE: sockets accepted will inherit this option.
|
||||
*/
|
||||
rc = ioctl(itti_listen_socket, FIONBIO, (char *)&on);
|
||||
|
||||
if (rc < 0) {
|
||||
ITTI_DUMP_ERROR(" ioctl FIONBIO (non-blocking) failed (%d:%s)\n", errno, strerror(errno));
|
||||
close(itti_listen_socket);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
memset(&servaddr, 0, sizeof(servaddr));
|
||||
servaddr.sin_family = AF_INET;
|
||||
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
servaddr.sin_port = htons(ITTI_PORT);
|
||||
|
||||
if (bind(itti_listen_socket, (struct sockaddr *) &servaddr,
|
||||
sizeof(servaddr)) < 0) {
|
||||
ITTI_DUMP_ERROR(" Bind failed (%d:%s)\n", errno, strerror(errno));
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
if (listen(itti_listen_socket, 5) < 0) {
|
||||
ITTI_DUMP_ERROR(" Listen failed (%d:%s)\n", errno, strerror(errno));
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
FD_ZERO(&read_set);
|
||||
|
||||
/* Add the listener */
|
||||
FD_SET(itti_listen_socket, &read_set);
|
||||
|
||||
/* Add the event fd */
|
||||
FD_SET(itti_dump_queue.event_fd, &read_set);
|
||||
|
||||
/* Max of both sd */
|
||||
max_sd = itti_listen_socket > itti_dump_queue.event_fd ? itti_listen_socket : itti_dump_queue.event_fd;
|
||||
|
||||
itti_dump_queue.itti_listen_socket = itti_listen_socket;
|
||||
|
||||
/* Loop waiting for incoming connects or for incoming data
|
||||
* on any of the connected sockets.
|
||||
*/
|
||||
while (1) {
|
||||
int desc_ready;
|
||||
int client_socket = -1;
|
||||
int i;
|
||||
|
||||
memcpy(&working_set, &read_set, sizeof(read_set));
|
||||
timeout_p = NULL;
|
||||
|
||||
/* No timeout: select blocks till a new event has to be handled
|
||||
* on sd's.
|
||||
*/
|
||||
rc = select(max_sd + 1, &working_set, NULL, NULL, timeout_p);
|
||||
|
||||
if (rc < 0) {
|
||||
ITTI_DUMP_ERROR(" select failed (%d:%s)\n", errno, strerror(errno));
|
||||
pthread_exit(NULL);
|
||||
} else if (rc == 0) {
|
||||
/* Timeout */
|
||||
if (itti_dump_flush_ring_buffer(1) == 0) {
|
||||
if (itti_dump_running) {
|
||||
ITTI_DUMP_DEBUG (0x4, " No messages consumers, waiting ...\n");
|
||||
usleep(100 * 1000);
|
||||
} else {
|
||||
itti_dump_socket_exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
desc_ready = rc;
|
||||
|
||||
for (i = 0; i <= max_sd && desc_ready > 0; i++) {
|
||||
if (FD_ISSET(i, &working_set)) {
|
||||
desc_ready -= 1;
|
||||
|
||||
if (i == itti_dump_queue.event_fd) {
|
||||
/* Notification of new element to dump from other tasks */
|
||||
eventfd_t sem_counter;
|
||||
ssize_t read_ret;
|
||||
|
||||
/* Read will always return 1 for kernel versions > 2.6.30 */
|
||||
read_ret = read (itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
|
||||
|
||||
if (read_ret < 0) {
|
||||
ITTI_DUMP_ERROR(" Failed read for semaphore: %s\n", strerror(errno));
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
AssertFatal (read_ret == sizeof(sem_counter), "Failed to read from dump event FD (%d/%d)!\n", (int) read_ret, (int) sizeof(sem_counter));
|
||||
|
||||
if (itti_dump_flush_ring_buffer(0) == 0) {
|
||||
if (itti_dump_running) {
|
||||
ITTI_DUMP_DEBUG (0x4, " No messages consumers, waiting ...\n");
|
||||
usleep(100 * 1000);
|
||||
{
|
||||
ssize_t write_ret;
|
||||
|
||||
sem_counter = 1;
|
||||
/* Call to write for an event fd must be of 8 bytes */
|
||||
write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
|
||||
AssertFatal (write_ret == sizeof(sem_counter), "Failed to write to dump event FD (%d/%d)!\n", (int) write_ret, (int) sem_counter);
|
||||
}
|
||||
} else {
|
||||
itti_dump_socket_exit();
|
||||
}
|
||||
} else {
|
||||
ITTI_DUMP_DEBUG(0x1, " Write element to file\n");
|
||||
}
|
||||
} else
|
||||
if (i == itti_listen_socket) {
|
||||
do {
|
||||
client_socket = accept(itti_listen_socket, NULL, NULL);
|
||||
|
||||
if (client_socket < 0) {
|
||||
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||
/* No more new connection */
|
||||
ITTI_DUMP_DEBUG(0x2, " No more new connection\n");
|
||||
continue;
|
||||
} else {
|
||||
ITTI_DUMP_ERROR(" accept failed (%d:%s)\n", errno, strerror(errno));
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (itti_dump_handle_new_connection(client_socket, message_definition_xml,
|
||||
message_definition_xml_length) == 0) {
|
||||
/* The socket has been accepted.
|
||||
* We have to update the set to include this new sd.
|
||||
*/
|
||||
FD_SET(client_socket, &read_set);
|
||||
|
||||
if (client_socket > max_sd)
|
||||
max_sd = client_socket;
|
||||
}
|
||||
} while(client_socket != -1);
|
||||
} else {
|
||||
/* For now the MME itti dumper should not receive data
|
||||
* other than connection oriented (CLOSE).
|
||||
*/
|
||||
uint8_t j;
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, " Socket %d disconnected\n", i);
|
||||
|
||||
/* Close the socket and update info related to this connection */
|
||||
close(i);
|
||||
|
||||
for (j = 0; j < ITTI_DUMP_MAX_CON; j++) {
|
||||
if (itti_dump_queue.itti_clients[j].sd == i)
|
||||
break;
|
||||
}
|
||||
|
||||
/* In case we don't find the matching sd in list of known
|
||||
* connections -> assert.
|
||||
*/
|
||||
AssertFatal (j < ITTI_DUMP_MAX_CON, "Connection index not found (%d/%d) for socked %d!\n", j, ITTI_DUMP_MAX_CON, i);
|
||||
|
||||
/* Re-initialize the socket to -1 so we can accept new
|
||||
* incoming connections.
|
||||
*/
|
||||
itti_dump_queue.itti_clients[j].sd = -1;
|
||||
itti_dump_queue.itti_clients[j].last_message_number = 0;
|
||||
itti_dump_queue.nb_connected--;
|
||||
|
||||
/* Remove the socket from the FD set and update the max sd */
|
||||
FD_CLR(i, &read_set);
|
||||
|
||||
if (i == max_sd) {
|
||||
if (itti_dump_queue.nb_connected == 0) {
|
||||
/* No more new connection max_sd = itti_listen_socket */
|
||||
max_sd = itti_listen_socket;
|
||||
} else {
|
||||
while (FD_ISSET(max_sd, &read_set) == 0) {
|
||||
max_sd -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
int itti_dump_queue_message(task_id_t sender_task,
|
||||
message_number_t message_number,
|
||||
MessageDef *message_p,
|
||||
const char *message_name,
|
||||
const uint32_t message_size)
|
||||
{
|
||||
if (itti_dump_running) {
|
||||
itti_dump_queue_item_t *new;
|
||||
|
||||
AssertFatal (message_name != NULL, "Message name is NULL!\n");
|
||||
AssertFatal (message_p != NULL, "Message is NULL!\n");
|
||||
|
||||
new = itti_malloc(sender_task, TASK_MAX, sizeof(itti_dump_queue_item_t));
|
||||
|
||||
new->data = itti_malloc(sender_task, TASK_MAX, message_size);
|
||||
|
||||
memcpy(new->data, message_p, message_size);
|
||||
new->data_size = message_size;
|
||||
new->message_number = message_number;
|
||||
|
||||
itti_dump_enqueue_message(new, message_size, ITTI_DUMP_MESSAGE_TYPE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function should be called by each thread that will use the ring buffer */
|
||||
void itti_dump_thread_use_ring_buffer(void)
|
||||
{
|
||||
lfds611_ringbuffer_use(itti_dump_queue.itti_message_queue);
|
||||
}
|
||||
|
||||
int itti_dump_init(const char * const messages_definition_xml, const char * const dump_file_name)
|
||||
{
|
||||
int i, ret;
|
||||
struct sched_param scheduler_param;
|
||||
|
||||
scheduler_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
|
||||
|
||||
if (dump_file_name != NULL) {
|
||||
dump_file = fopen(dump_file_name, "wb");
|
||||
|
||||
if (dump_file == NULL) {
|
||||
ITTI_DUMP_ERROR(" can not open dump file \"%s\" (%d:%s)\n", dump_file_name, errno, strerror(errno));
|
||||
} else {
|
||||
/* Output the XML to file */
|
||||
uint32_t message_size = strlen(messages_definition_xml) + 1;
|
||||
itti_socket_header_t header;
|
||||
|
||||
header.message_size = sizeof(itti_socket_header_t) + message_size + sizeof(itti_message_types_t);
|
||||
header.message_type = ITTI_DUMP_XML_DEFINITION;
|
||||
|
||||
fwrite (&header, sizeof(itti_socket_header_t), 1, dump_file);
|
||||
fwrite (messages_definition_xml, message_size, 1, dump_file);
|
||||
fwrite (&itti_dump_xml_definition_end, sizeof(itti_message_types_t), 1, dump_file);
|
||||
fflush (dump_file);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&itti_dump_queue, 0, sizeof(itti_desc_t));
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, " Creating new ring buffer for itti dump of %u elements\n",
|
||||
ITTI_QUEUE_MAX_ELEMENTS);
|
||||
|
||||
if (lfds611_ringbuffer_new(&itti_dump_queue.itti_message_queue,
|
||||
ITTI_QUEUE_MAX_ELEMENTS,
|
||||
NULL,
|
||||
NULL) != 1) {
|
||||
/* Always assert on this condition */
|
||||
AssertFatal (0, " Failed to create ring buffer!\n");
|
||||
}
|
||||
|
||||
itti_dump_queue.event_fd = eventfd(0, EFD_SEMAPHORE);
|
||||
|
||||
if (itti_dump_queue.event_fd == -1) {
|
||||
/* Always assert on this condition */
|
||||
AssertFatal (0, "eventfd failed: %s!\n", strerror(errno));
|
||||
}
|
||||
|
||||
itti_dump_queue.nb_connected = 0;
|
||||
|
||||
for(i = 0; i < ITTI_DUMP_MAX_CON; i++) {
|
||||
itti_dump_queue.itti_clients[i].sd = -1;
|
||||
itti_dump_queue.itti_clients[i].last_message_number = 0;
|
||||
}
|
||||
|
||||
/* initialized with default attributes */
|
||||
ret = pthread_attr_init(&itti_dump_queue.attr);
|
||||
|
||||
if (ret < 0) {
|
||||
AssertFatal (0, "pthread_attr_init failed (%d:%s)!\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
ret = pthread_attr_setschedpolicy(&itti_dump_queue.attr, SCHED_FIFO);
|
||||
|
||||
if (ret < 0) {
|
||||
AssertFatal (0, "pthread_attr_setschedpolicy (SCHED_IDLE) failed (%d:%s)!\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
ret = pthread_attr_setschedparam(&itti_dump_queue.attr, &scheduler_param);
|
||||
|
||||
if (ret < 0) {
|
||||
AssertFatal (0, "pthread_attr_setschedparam failed (%d:%s)!\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
ret = pthread_create(&itti_dump_queue.itti_acceptor_thread, &itti_dump_queue.attr,
|
||||
&itti_dump_socket, (void *)messages_definition_xml);
|
||||
|
||||
if (ret < 0) {
|
||||
AssertFatal (0, "pthread_create failed (%d:%s)!\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
pthread_setname_np( itti_dump_queue.itti_acceptor_thread, "ITTI acceptor" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void itti_dump_exit(void)
|
||||
{
|
||||
void *arg;
|
||||
itti_dump_queue_item_t *new;
|
||||
|
||||
new = itti_malloc(TASK_UNKNOWN, TASK_UNKNOWN, sizeof(itti_dump_queue_item_t));
|
||||
memset(new, 0, sizeof(itti_dump_queue_item_t));
|
||||
|
||||
/* Set a flag to stop recording message */
|
||||
itti_dump_running = 0;
|
||||
|
||||
/* Send the exit signal to other thread */
|
||||
itti_dump_enqueue_message(new, 0, ITTI_DUMP_EXIT_SIGNAL);
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, " waiting for dumper thread to finish\n");
|
||||
|
||||
/* wait for the thread to terminate */
|
||||
pthread_join(itti_dump_queue.itti_acceptor_thread, &arg);
|
||||
|
||||
ITTI_DUMP_DEBUG(0x2, " dumper thread correctly exited\n");
|
||||
|
||||
if (dump_file != NULL) {
|
||||
/* Synchronise file and then close it */
|
||||
fclose(dump_file);
|
||||
dump_file = NULL;
|
||||
}
|
||||
|
||||
if (itti_dump_queue.itti_message_queue) {
|
||||
lfds611_ringbuffer_delete(itti_dump_queue.itti_message_queue,
|
||||
itti_dump_user_data_delete_function, NULL);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#ifndef INTERTASK_INTERFACE_DUMP_H_
|
||||
#define INTERTASK_INTERFACE_DUMP_H_
|
||||
|
||||
int itti_dump_queue_message(task_id_t sender_task, message_number_t message_number, MessageDef *message_p, const char *message_name,
|
||||
const uint32_t message_size);
|
||||
|
||||
int itti_dump_init(const char * const messages_definition_xml, const char * const dump_file_name);
|
||||
|
||||
void itti_dump_exit(void);
|
||||
|
||||
void itti_dump_thread_use_ring_buffer(void);
|
||||
|
||||
#endif /* INTERTASK_INTERFACE_DUMP_H_ */
|
||||
@@ -41,10 +41,6 @@
|
||||
|
||||
#ifndef CHECK_PROTOTYPE_ONLY
|
||||
|
||||
const char * const messages_definition_xml = {
|
||||
#include "messages_xml.h"
|
||||
};
|
||||
|
||||
/* Map task id to printable name. */
|
||||
const task_info_t tasks_info[] = {
|
||||
{0, TASK_UNKNOWN, 0, 0, "TASK_UNKNOWN"},
|
||||
@@ -71,8 +67,7 @@ const message_info_t messages_info[] = {
|
||||
* \param messages_info Pointer on messages information as created by this include file
|
||||
**/
|
||||
int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_id_max, const task_info_t *tasks_info,
|
||||
const message_info_t *messages_info, const char * const messages_definition_xml,
|
||||
const char * const dump_file_name);
|
||||
const message_info_t *messages_info);
|
||||
|
||||
#endif /* INTERTASK_INTERFACE_INIT_H_ */
|
||||
/* @} */
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "log.h"
|
||||
|
||||
#if defined (LOG_D) && defined (LOG_E)
|
||||
# define SIG_DEBUG(x, args...) LOG_D(EMU, x, ##args)
|
||||
# define SIG_ERROR(x, args...) LOG_E(EMU, x, ##args)
|
||||
# define SIG_DEBUG(x, args...) LOG_D(RRC, x, ##args)
|
||||
# define SIG_ERROR(x, args...) LOG_E(RRC, x, ##args)
|
||||
#endif
|
||||
|
||||
#ifndef SIG_DEBUG
|
||||
@@ -117,16 +117,19 @@ int signal_handle(int *end)
|
||||
case SIGUSR1:
|
||||
SIG_DEBUG("Received SIGUSR1\n");
|
||||
*end = 1;
|
||||
output_log_mem();
|
||||
break;
|
||||
|
||||
case SIGSEGV: /* Fall through */
|
||||
case SIGABRT:
|
||||
SIG_DEBUG("Received SIGABORT\n");
|
||||
output_log_mem();
|
||||
backtrace_handle_signal(&info);
|
||||
break;
|
||||
|
||||
case SIGINT:
|
||||
printf("Received SIGINT\n");
|
||||
output_log_mem();
|
||||
itti_send_terminate_message(TASK_UNKNOWN);
|
||||
*end = 1;
|
||||
break;
|
||||
|
||||
@@ -740,25 +740,6 @@ int xml_parse_buffer(char *xml_buffer, const int size) {
|
||||
return xml_parse_doc(doc);
|
||||
}
|
||||
|
||||
#if 0 /* Not used anymore */
|
||||
int xml_parse_file(const char *filename) {
|
||||
xmlDocPtr doc; /* the resulting document tree */
|
||||
|
||||
if (filename == NULL) {
|
||||
return RC_NULL_POINTER;
|
||||
}
|
||||
|
||||
doc = xmlReadFile (filename, NULL, 0);
|
||||
|
||||
if (doc == NULL) {
|
||||
ui_notification_dialog(GTK_MESSAGE_ERROR, FALSE, "parse messages format definition", "Failed to parse file \"%s\"", filename);
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
return xml_parse_doc(doc);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int update_filters() {
|
||||
types_t *types;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
|
||||
#include "openair1/PHY/extern.h"
|
||||
#include "openair1/PHY/phy_extern.h"
|
||||
|
||||
|
||||
#define TELNETVAR_PHYCC0 0
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#include "log.h"
|
||||
#include "log_extern.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "openair1/PHY/extern.h"
|
||||
#include "openair1/PHY/phy_extern.h"
|
||||
#include "telnetsrv_proccmd.h"
|
||||
|
||||
void decode_procstat(char *record, int debug, telnet_printfunc_t prnt)
|
||||
@@ -193,7 +193,6 @@ struct dirent *entry;
|
||||
|
||||
int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
extern log_t *g_log;
|
||||
|
||||
if (debug > 0)
|
||||
prnt(" proccmd_show received %s\n",buf);
|
||||
@@ -203,10 +202,12 @@ extern log_t *g_log;
|
||||
if (strcasestr(buf,"loglvl") != NULL) {
|
||||
prnt("component verbosity level enabled\n");
|
||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
prnt("%02i %17.17s:%10.10s%10.10s %s\n",i ,g_log->log_component[i].name,
|
||||
map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
|
||||
map_int_to_str(log_level_names,g_log->log_component[i].level),
|
||||
((g_log->log_component[i].interval>0)?"Y":"N") );
|
||||
if (g_log->log_component[i].name != NULL) {
|
||||
prnt("%02i %17.17s:%10.10s%10.10s %s\n",i ,g_log->log_component[i].name,
|
||||
map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
|
||||
map_int_to_str(log_level_names,g_log->log_component[i].level),
|
||||
((g_log->log_component[i].interval>0)?"Y":"N") );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strcasestr(buf,"config") != NULL) {
|
||||
@@ -368,6 +369,15 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
|
||||
if (logparam != NULL) free(logparam);
|
||||
if (tmpstr != NULL) free(tmpstr);
|
||||
for (int i=idx1; i<=idx2 ; i++) {
|
||||
if (level < 0) {
|
||||
level=g_log->log_component[i].level;
|
||||
}
|
||||
if (verbosity < 0) {
|
||||
verbosity=g_log->log_component[i].flag;
|
||||
}
|
||||
if (interval < 0) {
|
||||
interval=g_log->log_component[i].interval;
|
||||
}
|
||||
set_comp_log(i, level, verbosity, interval);
|
||||
prnt("log level/verbosity comp %i %s set to %s / %s (%s)\n",
|
||||
i,((g_log->log_component[i].name==NULL)?"":g_log->log_component[i].name),
|
||||
|
||||
@@ -516,7 +516,7 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
|
||||
uint8_t num_tlv = 0;
|
||||
//struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
|
||||
// Panos: In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim
|
||||
// In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim
|
||||
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
|
||||
LTE_DL_FRAME_PARMS *fp;
|
||||
if (nfapi_mode!=3) {
|
||||
@@ -527,18 +527,6 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
|
||||
fp = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
//DJP
|
||||
auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
|
||||
{ return item.id == req->header.phy_id; });
|
||||
|
||||
if(found != pnf->phys.end())
|
||||
{
|
||||
phy_info& phy_info = (*found);
|
||||
}
|
||||
#endif
|
||||
//DJP
|
||||
phy_info* phy_info = pnf->phys;
|
||||
|
||||
if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG) {
|
||||
@@ -871,7 +859,11 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
|
||||
AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
LTE_eNB_DLSCH_t *dlsch0 = eNB->dlsch[UE_id][0];
|
||||
//LTE_eNB_DLSCH_t *dlsch1 = eNB->dlsch[UE_id][1];
|
||||
int harq_pid = dlsch0->harq_ids[sf];
|
||||
int harq_pid = dlsch0->harq_ids[sfn%2][sf];
|
||||
if(harq_pid >= dlsch0->Mdlharq) {
|
||||
LOG_E(PHY,"pnf_phy_dl_config_req illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
uint8_t *dlsch_sdu = tx_pdus[UE_id][harq_pid];
|
||||
|
||||
memcpy(dlsch_sdu, tx_pdu->segments[0].segment_data, tx_pdu->segments[0].segment_length);
|
||||
@@ -1113,7 +1105,6 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
|
||||
}
|
||||
|
||||
if(phy_info->timing_info_mode & 0x2) {
|
||||
//printf("Panos-D: start_request () Enabling timing_info_mode_aperiodic \n");
|
||||
p7_config->timing_info_mode_aperiodic = 1;
|
||||
}
|
||||
|
||||
@@ -1181,9 +1172,6 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
|
||||
p7_config_g = p7_config;
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Panos-D: start_request, BUFFER SIZE: %d", p7_config_g->subframe_buffer_size);
|
||||
//printf("Panos-D: start_request, bUFFER SIZE: %d", p7_config_g->subframe_buffer_size);
|
||||
|
||||
// Need to wait for main thread to create RU structures
|
||||
while(config_sync_var<0)
|
||||
{
|
||||
@@ -1197,13 +1185,7 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
|
||||
|
||||
printf("[PNF] About to call init_eNB_afterRU()\n");
|
||||
|
||||
// Panos: Instead
|
||||
/*if (nfapi_mode == 3) {
|
||||
init_UE_stub(1,0,uecap_xer_in);
|
||||
}*/
|
||||
//else{
|
||||
if (nfapi_mode != 3) {
|
||||
// Panos
|
||||
init_eNB_afterRU();
|
||||
}
|
||||
|
||||
|
||||
@@ -357,18 +357,6 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
|
||||
wait.tv_sec=0;
|
||||
wait.tv_nsec=5000000L;
|
||||
|
||||
#if 0
|
||||
/* accept some delay in processing - up to 5ms */
|
||||
for (i = 0; i < 10 && proc_rxtx->instance_cnt_rxtx == 0; i++) {
|
||||
LOG_W( PHY,"[eNB] sfn/sf:%d:%d proc_rxtx[%d]:TXsfn:%d/%d eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", sfn, sf, sf&1, proc_rxtx->frame_tx, proc_rxtx->subframe_tx, proc_rxtx->instance_cnt_rxtx);
|
||||
usleep(500);
|
||||
}
|
||||
if (proc_rxtx->instance_cnt_rxtx == 0) {
|
||||
exit_fun( "TX thread busy" );
|
||||
return(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
// wake up TX for subframe n+sf_ahead
|
||||
// lock the TX mutex and make sure the thread is ready
|
||||
if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) {
|
||||
|
||||
@@ -1308,7 +1308,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint16_t transmission_power;
|
||||
} nfapi_dl_config_bch_pdu_rel8_t;
|
||||
#define NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG 0x2004
|
||||
@@ -1320,7 +1320,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint16_t rnti;
|
||||
uint8_t resource_allocation_type;
|
||||
uint32_t resource_block_coding;
|
||||
@@ -1344,7 +1344,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint16_t rnti;
|
||||
uint8_t resource_allocation_type;
|
||||
uint8_t virtual_resource_block_assignment_flag;
|
||||
@@ -1429,7 +1429,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint16_t p_rnti;
|
||||
uint8_t resource_allocation_type;
|
||||
uint8_t virtual_resource_block_assignment_flag;
|
||||
@@ -1595,7 +1595,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint16_t transmission_power;
|
||||
uint16_t hyper_sfn_2_lsbs;
|
||||
} nfapi_dl_config_nbch_pdu_rel13_t;
|
||||
@@ -1609,7 +1609,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint8_t ncce_index;
|
||||
uint8_t aggregation_level;
|
||||
uint8_t start_symbol;
|
||||
@@ -1642,7 +1642,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint8_t start_symbol;
|
||||
uint8_t rnti_type;
|
||||
uint16_t rnti;
|
||||
@@ -2218,6 +2218,7 @@ typedef struct {
|
||||
uint8_t dl_assignment_index;
|
||||
uint32_t tpc_bitmap;
|
||||
uint16_t transmission_power;
|
||||
uint8_t harq_pid;
|
||||
} nfapi_hi_dci0_dci_pdu_rel8_t;
|
||||
#define NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG 0x2020
|
||||
|
||||
@@ -2361,7 +2362,7 @@ typedef struct {
|
||||
#define NFAPI_TX_MAX_SEGMENTS 32
|
||||
typedef struct {
|
||||
uint16_t pdu_length;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
uint8_t num_segments;
|
||||
struct {
|
||||
uint32_t segment_length;
|
||||
@@ -2902,7 +2903,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint8_t sub_error_code;
|
||||
uint16_t pdu_index;
|
||||
int16_t pdu_index;
|
||||
} nfapi_error_indication_msg_tx_err;
|
||||
|
||||
//
|
||||
|
||||
@@ -2924,7 +2924,7 @@ static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPa
|
||||
nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
|
||||
|
||||
return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) &&
|
||||
pull16(ppReadPackedMsg, &bch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end));
|
||||
}
|
||||
|
||||
@@ -2933,7 +2933,7 @@ static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPa
|
||||
nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
|
||||
|
||||
return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) &&
|
||||
pull16(ppReadPackedMsg, &mch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) &&
|
||||
pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) &&
|
||||
pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) &&
|
||||
@@ -2947,7 +2947,7 @@ static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppRead
|
||||
nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
|
||||
|
||||
if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) &&
|
||||
pull16(ppReadPackedMsg, &dlsch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) &&
|
||||
pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) &&
|
||||
pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
|
||||
@@ -3033,7 +3033,7 @@ static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPa
|
||||
nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
|
||||
|
||||
return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) &&
|
||||
pull16(ppReadPackedMsg, &pch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) &&
|
||||
pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) &&
|
||||
pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
|
||||
@@ -3179,7 +3179,7 @@ static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppRead
|
||||
nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
|
||||
|
||||
return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) &&
|
||||
pull16(ppReadPackedMsg, &nbch_params_rel13->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) &&
|
||||
pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end));
|
||||
}
|
||||
@@ -3189,7 +3189,7 @@ static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppRe
|
||||
nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
|
||||
|
||||
return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) &&
|
||||
pull16(ppReadPackedMsg, &npdcch_params_rel13->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) &&
|
||||
pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) &&
|
||||
pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) &&
|
||||
pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) &&
|
||||
@@ -3218,7 +3218,7 @@ static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppRe
|
||||
nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
|
||||
|
||||
return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) &&
|
||||
pull16(ppReadPackedMsg, &ndlsch_params_rel13->pdu_index, end) &&
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) &&
|
||||
pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) &&
|
||||
pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) &&
|
||||
pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) &&
|
||||
@@ -3602,7 +3602,7 @@ static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPa
|
||||
nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
|
||||
|
||||
return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) &&
|
||||
pull16(ppReadPackedMsg, &ue_info_rel8->rnti, end));
|
||||
pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end));
|
||||
}
|
||||
static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
{
|
||||
|
||||
@@ -1624,10 +1624,6 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
|
||||
|
||||
// need to update the time as we would only use the value from the
|
||||
// select
|
||||
#if 0
|
||||
// DJP - why do this here and not on return from recv???
|
||||
now_hr_time = pnf_get_current_time_hr();
|
||||
#endif
|
||||
}
|
||||
while(recvfrom_result > 0);
|
||||
}
|
||||
|
||||
@@ -1248,12 +1248,12 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
|
||||
|
||||
// Panos: Careful here!!!
|
||||
// Panos: Careful here!!! Modification of the original nfapi-code
|
||||
//if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
|
||||
if (vnf_pnf_sfnsf_delta>0 || vnf_pnf_sfnsf_delta < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf));
|
||||
// Panos: Careful here!!!
|
||||
// Panos: Careful here!!! Modification of the original nfapi-code
|
||||
vnf_p7->p7_connections[0].sfn_sf = ind.last_sfn_sf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,13 +200,6 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
// still time before the end of the subframe wait
|
||||
pselect_timeout = timespec_sub(sf_start, pselect_start);
|
||||
|
||||
#if 0
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sf_start:%d.%ld pselect_start:%d.%ld pseclect_timeout:%d.%ld\n",
|
||||
__FUNCTION__,
|
||||
sf_start.tv_sec, sf_start.tv_nsec,
|
||||
pselect_start.tv_sec, pselect_start.tv_nsec,
|
||||
pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
|
||||
#endif
|
||||
}
|
||||
|
||||
//original_pselect_timeout = pselect_timeout;
|
||||
@@ -266,13 +259,6 @@ if (selectRetval==-1 && errno == 22)
|
||||
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||
sf_duration.tv_sec, sf_duration.tv_nsec);
|
||||
}
|
||||
#if 0
|
||||
if (selectRetval != 0 || phy->insync_minor_adjustment_duration != 0)
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "pselect()=%d maxSock:%d vnf_p7->socket:%d pselect_timeout:%u.%u original_pselect_timeout:%u.%u\n",
|
||||
selectRetval, maxSock, vnf_p7->socket, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||
original_pselect_timeout.tv_sec, original_pselect_timeout.tv_nsec);
|
||||
#endif
|
||||
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
// calculate the start of the next subframe
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
|
||||
//#define DEBUG_TURBO_ENCODER 1
|
||||
|
||||
@@ -110,9 +109,7 @@ uint32_t bit_byte_lut[2048];
|
||||
void threegpplte_turbo_encoder(uint8_t *input,
|
||||
uint16_t input_length_bytes,
|
||||
uint8_t *output,
|
||||
uint8_t F,
|
||||
uint16_t interleaver_f1,
|
||||
uint16_t interleaver_f2)
|
||||
uint8_t F)
|
||||
{
|
||||
|
||||
int i,k=0;
|
||||
@@ -256,6 +253,217 @@ inline short threegpp_interleaver_parameters(uint16_t bytes_per_codeword)
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
const interleaver_TS_36_212_t f1f2[188] = {
|
||||
{ 40, 3, 10 },
|
||||
{ 48, 7, 12 },
|
||||
{ 56, 19, 42 },
|
||||
{ 64, 7, 16 },
|
||||
{ 72, 7, 18 },
|
||||
{ 80, 11, 20 },
|
||||
{ 88, 5, 22 },
|
||||
{ 96, 11, 24 },
|
||||
{ 104, 7, 26 },
|
||||
{ 112, 41, 84 },
|
||||
{ 120, 103, 90 },
|
||||
{ 128, 15, 32 },
|
||||
{ 136, 9, 34 },
|
||||
{ 144, 17, 108 },
|
||||
{ 152, 9, 38 },
|
||||
{ 160, 21, 120 },
|
||||
{ 168, 101, 84 },
|
||||
{ 176, 21, 44 },
|
||||
{ 184, 57, 46 },
|
||||
{ 192, 23, 48 },
|
||||
{ 200, 13, 50 },
|
||||
{ 208, 27, 52 },
|
||||
{ 216, 11, 36 },
|
||||
{ 224, 27, 56 },
|
||||
{ 232, 85, 58 },
|
||||
{ 240, 29, 60 },
|
||||
{ 248, 33, 62 },
|
||||
{ 256, 15, 32 },
|
||||
{ 264, 17, 198 },
|
||||
{ 272, 33, 68 },
|
||||
{ 280, 103, 210 },
|
||||
{ 288, 19, 36 },
|
||||
{ 296, 19, 74 },
|
||||
{ 304, 37, 76 },
|
||||
{ 312, 19, 78 },
|
||||
{ 320, 21, 120 },
|
||||
{ 328, 21, 82 },
|
||||
{ 336, 115, 84 },
|
||||
{ 344, 193, 86 },
|
||||
{ 352, 21, 44 },
|
||||
{ 360, 133, 90 },
|
||||
{ 368, 81, 46 },
|
||||
{ 376, 45, 94 },
|
||||
{ 384, 23, 48 },
|
||||
{ 392, 243, 98 },
|
||||
{ 400, 151, 40 },
|
||||
{ 408, 155, 102 },
|
||||
{ 416, 25, 52 },
|
||||
{ 424, 51, 106 },
|
||||
{ 432, 47, 72 },
|
||||
{ 440, 91, 110 },
|
||||
{ 448, 29, 168 },
|
||||
{ 456, 29, 114 },
|
||||
{ 464, 247, 58 },
|
||||
{ 472, 29, 118 },
|
||||
{ 480, 89, 180 },
|
||||
{ 488, 91, 122 },
|
||||
{ 496, 157, 62 },
|
||||
{ 504, 55, 84 },
|
||||
{ 512, 31, 64 },
|
||||
{ 528, 17, 66 },
|
||||
{ 544, 35, 68 },
|
||||
{ 560, 227, 420 },
|
||||
{ 576, 65, 96 },
|
||||
{ 592, 19, 74 },
|
||||
{ 608, 37, 76 },
|
||||
{ 624, 41, 234 },
|
||||
{ 640, 39, 80 },
|
||||
{ 656, 185, 82 },
|
||||
{ 672, 43, 252 },
|
||||
{ 688, 21, 86 },
|
||||
{ 704, 155, 44 },
|
||||
{ 720, 79, 120 },
|
||||
{ 736, 139, 92 },
|
||||
{ 752, 23, 94 },
|
||||
{ 768, 217, 48 },
|
||||
{ 784, 25, 98 },
|
||||
{ 800, 17, 80 },
|
||||
{ 816, 127, 102 },
|
||||
{ 832, 25, 52 },
|
||||
{ 848, 239, 106 },
|
||||
{ 864, 17, 48 },
|
||||
{ 880, 137, 110 },
|
||||
{ 896, 215, 112 },
|
||||
{ 912, 29, 114 },
|
||||
{ 928, 15, 58 },
|
||||
{ 944, 147, 118 },
|
||||
{ 960, 29, 60 },
|
||||
{ 976, 59, 122 },
|
||||
{ 992, 65, 124 },
|
||||
{ 1008, 55, 84 },
|
||||
{ 1024, 31, 64 },
|
||||
{ 1056, 17, 66 },
|
||||
{ 1088, 171, 204 },
|
||||
{ 1120, 67, 140 },
|
||||
{ 1152, 35, 72 },
|
||||
{ 1184, 19, 74 },
|
||||
{ 1216, 39, 76 },
|
||||
{ 1248, 19, 78 },
|
||||
{ 1280, 199, 240 },
|
||||
{ 1312, 21, 82 },
|
||||
{ 1344, 211, 252 },
|
||||
{ 1376, 21, 86 },
|
||||
{ 1408, 43, 88 },
|
||||
{ 1440, 149, 60 },
|
||||
{ 1472, 45, 92 },
|
||||
{ 1504, 49, 846 },
|
||||
{ 1536, 71, 48 },
|
||||
{ 1568, 13, 28 },
|
||||
{ 1600, 17, 80 },
|
||||
{ 1632, 25, 102 },
|
||||
{ 1664, 183, 104 },
|
||||
{ 1696, 55, 954 },
|
||||
{ 1728, 127, 96 },
|
||||
{ 1760, 27, 110 },
|
||||
{ 1792, 29, 112 },
|
||||
{ 1824, 29, 114 },
|
||||
{ 1856, 57, 116 },
|
||||
{ 1888, 45, 354 },
|
||||
{ 1920, 31, 120 },
|
||||
{ 1952, 59, 610 },
|
||||
{ 1984, 185, 124 },
|
||||
{ 2016, 113, 420 },
|
||||
{ 2048, 31, 64 },
|
||||
{ 2112, 17, 66 },
|
||||
{ 2176, 171, 136 },
|
||||
{ 2240, 209, 420 },
|
||||
{ 2304, 253, 216 },
|
||||
{ 2368, 367, 444 },
|
||||
{ 2432, 265, 456 },
|
||||
{ 2496, 181, 468 },
|
||||
{ 2560, 39, 80 },
|
||||
{ 2624, 27, 164 },
|
||||
{ 2688, 127, 504 },
|
||||
{ 2752, 143, 172 },
|
||||
{ 2816, 43, 88 },
|
||||
{ 2880, 29, 300 },
|
||||
{ 2944, 45, 92 },
|
||||
{ 3008, 157, 188 },
|
||||
{ 3072, 47, 96 },
|
||||
{ 3136, 13, 28 },
|
||||
{ 3200, 111, 240 },
|
||||
{ 3264, 443, 204 },
|
||||
{ 3328, 51, 104 },
|
||||
{ 3392, 51, 212 },
|
||||
{ 3456, 451, 192 },
|
||||
{ 3520, 257, 220 },
|
||||
{ 3584, 57, 336 },
|
||||
{ 3648, 313, 228 },
|
||||
{ 3712, 271, 232 },
|
||||
{ 3776, 179, 236 },
|
||||
{ 3840, 331, 120 },
|
||||
{ 3904, 363, 244 },
|
||||
{ 3968, 375, 248 },
|
||||
{ 4032, 127, 168 },
|
||||
{ 4096, 31, 64 },
|
||||
{ 4160, 33, 130 },
|
||||
{ 4224, 43, 264 },
|
||||
{ 4288, 33, 134 },
|
||||
{ 4352, 477, 408 },
|
||||
{ 4416, 35, 138 },
|
||||
{ 4480, 233, 280 },
|
||||
{ 4544, 357, 142 },
|
||||
{ 4608, 337, 480 },
|
||||
{ 4672, 37, 146 },
|
||||
{ 4736, 71, 444 },
|
||||
{ 4800, 71, 120 },
|
||||
{ 4864, 37, 152 },
|
||||
{ 4928, 39, 462 },
|
||||
{ 4992, 127, 234 },
|
||||
{ 5056, 39, 158 },
|
||||
{ 5120, 39, 80 },
|
||||
{ 5184, 31, 96 },
|
||||
{ 5248, 113, 902 },
|
||||
{ 5312, 41, 166 },
|
||||
{ 5376, 251, 336 },
|
||||
{ 5440, 43, 170 },
|
||||
{ 5504, 21, 86 },
|
||||
{ 5568, 43, 174 },
|
||||
{ 5632, 45, 176 },
|
||||
{ 5696, 45, 178 },
|
||||
{ 5760, 161, 120 },
|
||||
{ 5824, 89, 182 },
|
||||
{ 5888, 323, 184 },
|
||||
{ 5952, 47, 186 },
|
||||
{ 6016, 23, 94 },
|
||||
{ 6080, 47, 190 },
|
||||
{ 6144, 263, 480 },
|
||||
};
|
||||
|
||||
|
||||
t_interleaver_codebook *f1f2mat;
|
||||
short *il_tb;
|
||||
__attribute__((constructor)) static void init_interleaver(void) {
|
||||
int totSize=0;
|
||||
f1f2mat=(t_interleaver_codebook*) malloc(sizeof(*f1f2mat) * sizeof(f1f2) / sizeof(*f1f2));
|
||||
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++) {
|
||||
f1f2mat[i].nb_bits=f1f2[i].nb_bits;
|
||||
f1f2mat[i].f1=f1f2[i].f1;
|
||||
f1f2mat[i].f2=f1f2[i].f2;
|
||||
f1f2mat[i].beg_index=totSize;
|
||||
totSize+=f1f2mat[i].nb_bits;
|
||||
}
|
||||
il_tb=(short*)malloc(sizeof(*il_tb)*totSize);
|
||||
int idx=0;
|
||||
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++)
|
||||
for (uint64_t j=0; j<f1f2[i].nb_bits; j++)
|
||||
il_tb[idx++]=(j*f1f2[i].f1+j*j*f1f2[i].f2)%f1f2[i].nb_bits;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MAIN
|
||||
@@ -296,9 +504,7 @@ int main(int argc,char **argv)
|
||||
|
||||
threegpplte_turbo_encoder(&input[0],
|
||||
5,
|
||||
&output[0],
|
||||
F1,
|
||||
F2);
|
||||
&output[0]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
*/
|
||||
#ifndef TC_MAIN
|
||||
#include "coding_defs.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
#include "coding_vars.h"
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
@@ -539,9 +537,7 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
||||
void threegpplte_turbo_encoder_sse(unsigned char *input,
|
||||
unsigned short input_length_bytes,
|
||||
unsigned char *output,
|
||||
unsigned char F,
|
||||
unsigned short interleaver_f1,
|
||||
unsigned short interleaver_f2)
|
||||
unsigned char F)
|
||||
{
|
||||
|
||||
int i;
|
||||
@@ -699,9 +695,7 @@ int main(int argc,char **argv)
|
||||
threegpplte_turbo_encoder_sse(&input[0],
|
||||
INPUT_LENGTH,
|
||||
&output[0],
|
||||
0,
|
||||
F1,
|
||||
F2);
|
||||
0);
|
||||
|
||||
|
||||
for (i=0;i<12+(INPUT_LENGTH*24);i++)
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -893,8 +892,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint16_t f1,
|
||||
uint16_t f2,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
@@ -989,134 +986,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
yp1 = yparity1;
|
||||
yp2 = yparity2;
|
||||
|
||||
|
||||
#if 0
|
||||
__m128i *yp128,*yp128_cw2;
|
||||
__m128i tmpe,tmpe_cw2;
|
||||
yp128 = (__m128i*)y;
|
||||
yp128_cw2 = (__m128i*)y2;
|
||||
|
||||
|
||||
|
||||
for (i=0; i<n; i+=8) {
|
||||
pi2_p = &pi2tab16avx2[iind][i];
|
||||
|
||||
j=pi2_p[0];
|
||||
|
||||
|
||||
tmpe = _mm_load_si128(yp128);
|
||||
tmpe_cw2 = _mm_load_si128(yp128_cw2);
|
||||
// fprintf(fdavx2,"yp128 %p\n",yp128);
|
||||
// print_shorts("tmpe",(int16_t*)&tmpe);
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,0);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,1);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,2);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,0);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,1);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,2);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init0: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init0: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
|
||||
j=pi2_p[1];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,3);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,4);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,5);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,3);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,4);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,5);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init1: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init1: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[2];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,6);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,7);
|
||||
tmpe = _mm_load_si128(&yp128[1]);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,0);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,6);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,7);
|
||||
tmpe_cw2 = _mm_load_si128(&yp128_cw2[1]);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,0);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init2: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init2: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[3];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,1);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,2);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,3);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,1);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,2);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,3);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init3: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init3: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[4];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,4);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,5);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,6);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,4);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,5);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,6);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init4: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init4: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[5];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,7);
|
||||
tmpe = _mm_load_si128(&yp128[2]);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,0);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,1);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,7);
|
||||
tmpe_cw2 = _mm_load_si128(&yp128_cw2[2]);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,0);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,1);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init5: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init5: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[6];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,2);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,3);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,4);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,2);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,3);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,4);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init6: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init6: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[7];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,5);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,6);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,7);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,5);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,6);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,7);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init7: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init7: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
yp128+=3;
|
||||
yp128_cw2+=3;
|
||||
|
||||
}
|
||||
yp=(llr_t*)yp128;
|
||||
yp_cw2=(llr_t*)yp128_cw2;
|
||||
#else
|
||||
|
||||
pi2_p = &pi2tab16avx2[iind][0];
|
||||
for (i=0,j=0; i<n; i++) {
|
||||
s[*pi2_p] = y[j];
|
||||
@@ -1128,8 +997,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
}
|
||||
yp=(llr_t*)&y[j];
|
||||
yp_cw2=(llr_t*)&y2[j];
|
||||
#endif
|
||||
|
||||
|
||||
// Termination
|
||||
for (i=0; i<3; i++) {
|
||||
@@ -1417,8 +1284,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint16_t f1,
|
||||
uint16_t f2,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -1983,8 +1982,6 @@ void init_td()
|
||||
unsigned char phy_threegpplte_turbo_decoder(short *y,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
@@ -2620,8 +2617,6 @@ int test_logmap8()
|
||||
test[3] = 0x92;
|
||||
test[4] = 0xfe;
|
||||
|
||||
crcTableInit();
|
||||
|
||||
crc = crc24a(test,
|
||||
40)>>8;
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -233,9 +232,6 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
alpha128 = (__m128i *)alpha;
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
alpha256 = (__m256i *)alpha;
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
alpha128 = (int16x8_t *)alpha;
|
||||
#endif
|
||||
@@ -317,10 +313,6 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
|
||||
alpha_ptr = &alpha128[0];
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
alpha_ptr256 = &alpha256[0];
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
m11p = (__m128i*)m_11;
|
||||
m10p = (__m128i*)m_10;
|
||||
@@ -450,9 +442,6 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
|
||||
alpha_ptr+=8;
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
alpha_ptr256+=4;
|
||||
#endif
|
||||
m11p++;
|
||||
m10p++;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -1172,24 +1161,21 @@ void init_td16(void)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
short *y2,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned char *decoded_bytes2,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
{
|
||||
uint8_t phy_threegpplte_turbo_decoder16(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats) {
|
||||
|
||||
/* y is a pointer to the input
|
||||
decoded_bytes is a pointer to the decoded output
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -427,67 +426,6 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho
|
||||
|
||||
llr_t beta2,beta3,beta4,beta5,beta6,beta7;
|
||||
|
||||
|
||||
#if 0
|
||||
int16_t m11,m10;
|
||||
int16_t beta0_16,beta1_16,beta2_16,beta3_16,beta4_16,beta5_16,beta6_16,beta7_16,beta0_2,beta1_2,beta2_2,beta3_2,beta_m;
|
||||
__m128i beta_16;
|
||||
// termination for beta initialization
|
||||
|
||||
m11=(int16_t)m_11[2+frame_length];
|
||||
m10=(int16_t)m_10[2+frame_length];
|
||||
|
||||
beta0 = -m11;//M0T_TERM;
|
||||
beta1 = m11;//M1T_TERM;
|
||||
m11=(int16_t)m_11[1+frame_length];
|
||||
m10=(int16_t)m_10[1+frame_length];
|
||||
|
||||
beta0_2 = beta0-m11;//+M0T_TERM;
|
||||
beta1_2 = beta0+m11;//+M1T_TERM;
|
||||
beta2_2 = beta1+m10;//M2T_TERM;
|
||||
beta3_2 = beta1-m10;//+M3T_TERM;
|
||||
m11=(int16_t)m_11[frame_length];
|
||||
m10=(int16_t)m_10[frame_length];
|
||||
|
||||
beta0_16 = beta0_2-m11;//+M0T_TERM;
|
||||
beta1_16 = beta0_2+m11;//+M1T_TERM;
|
||||
beta2_16 = beta1_2+m10;//+M2T_TERM;
|
||||
beta3_16 = beta1_2-m10;//+M3T_TERM;
|
||||
beta4_16 = beta2_2-m10;//+M4T_TERM;
|
||||
beta5_16 = beta2_2+m10;//+M5T_TERM;
|
||||
beta6_16 = beta3_2+m11;//+M6T_TERM;
|
||||
beta7_16 = beta3_2-m11;//+M7T_TERM;
|
||||
|
||||
beta_m = (beta0_16>beta1_16) ? beta0_16 : beta1_16;
|
||||
beta_m = (beta_m>beta2_16) ? beta_m : beta2_16;
|
||||
beta_m = (beta_m>beta3_16) ? beta_m : beta3_16;
|
||||
beta_m = (beta_m>beta4_16) ? beta_m : beta4_16;
|
||||
beta_m = (beta_m>beta5_16) ? beta_m : beta5_16;
|
||||
beta_m = (beta_m>beta6_16) ? beta_m : beta6_16;
|
||||
beta_m = (beta_m>beta7_16) ? beta_m : beta7_16;
|
||||
|
||||
beta0_16=beta0_16-beta_m;
|
||||
beta1_16=beta1_16-beta_m;
|
||||
beta2_16=beta2_16-beta_m;
|
||||
beta3_16=beta3_16-beta_m;
|
||||
beta4_16=beta4_16-beta_m;
|
||||
beta5_16=beta5_16-beta_m;
|
||||
beta6_16=beta6_16-beta_m;
|
||||
beta7_16=beta7_16-beta_m;
|
||||
|
||||
beta_16 = _mm_set_epi16(beta7_16,beta6_16,beta5_16,beta4_16,beta3_16,beta2_16,beta1_16,beta0_16);
|
||||
beta_16 = _mm_packs_epi16(beta_16,beta_16);
|
||||
beta0 = _mm_extract_epi8(beta_16,0);
|
||||
beta1 = _mm_extract_epi8(beta_16,1);
|
||||
beta2 = _mm_extract_epi8(beta_16,2);
|
||||
beta3 = _mm_extract_epi8(beta_16,3);
|
||||
beta4 = _mm_extract_epi8(beta_16,4);
|
||||
beta5 = _mm_extract_epi8(beta_16,5);
|
||||
beta6 = _mm_extract_epi8(beta_16,6);
|
||||
beta7 = _mm_extract_epi8(beta_16,7);
|
||||
|
||||
#endif
|
||||
|
||||
if (frame_length > 6144) {
|
||||
LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length);
|
||||
return;
|
||||
@@ -897,25 +835,21 @@ void init_td8(void)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char phy_threegpplte_turbo_decoder8(short *y,
|
||||
short y2,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned char *decoded_bytes2,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
{
|
||||
|
||||
uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats) {
|
||||
/* y is a pointer to the input
|
||||
decoded_bytes is a pointer to the decoded output
|
||||
n is the size in bits of the coded block, with the tail */
|
||||
@@ -1085,209 +1019,6 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
|
||||
yp2[k]=*yp++;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
for (i=0; i<n2; i+=16) {
|
||||
pi2_p = &pi2tab8[iind][i];
|
||||
|
||||
j=pi2_p[0];
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
s[j] = _mm_extract_epi8(yp128[0],0);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],1);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],2);
|
||||
|
||||
|
||||
j=pi2_p[1];
|
||||
s[j] = _mm_extract_epi8(yp128[0],3);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],4);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],5);
|
||||
|
||||
|
||||
j=pi2_p[2];
|
||||
s[j] = _mm_extract_epi8(yp128[0],6);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],7);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],8);
|
||||
|
||||
|
||||
j=pi2_p[3];
|
||||
s[j] = _mm_extract_epi8(yp128[0],9);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],10);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],11);
|
||||
|
||||
|
||||
j=pi2_p[4];
|
||||
s[j] = _mm_extract_epi8(yp128[0],12);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],13);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],14);
|
||||
|
||||
|
||||
j=pi2_p[5];
|
||||
s[j] = _mm_extract_epi8(yp128[0],15);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],0);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],1);
|
||||
|
||||
|
||||
j=pi2_p[6];
|
||||
s[j] = _mm_extract_epi8(yp128[1],2);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],3);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],4);
|
||||
|
||||
|
||||
j=pi2_p[7];
|
||||
s[j] = _mm_extract_epi8(yp128[1],5);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],6);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],7);
|
||||
|
||||
|
||||
j=pi2_p[8];
|
||||
s[j] = _mm_extract_epi8(yp128[1],8);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],9);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],10);
|
||||
|
||||
|
||||
j=pi2_p[9];
|
||||
s[j] = _mm_extract_epi8(yp128[1],11);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],12);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],13);
|
||||
|
||||
|
||||
j=pi2_p[10];
|
||||
s[j] = _mm_extract_epi8(yp128[1],14);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],15);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],0);
|
||||
|
||||
|
||||
j=pi2_p[11];
|
||||
s[j] = _mm_extract_epi8(yp128[2],1);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],2);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],3);
|
||||
|
||||
|
||||
j=pi2_p[12];
|
||||
s[j] = _mm_extract_epi8(yp128[2],4);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],5);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],6);
|
||||
|
||||
|
||||
j=pi2_p[13];
|
||||
s[j] = _mm_extract_epi8(yp128[2],7);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],8);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],9);
|
||||
|
||||
|
||||
j=pi2_p[14];
|
||||
s[j] = _mm_extract_epi8(yp128[2],10);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],11);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],12);
|
||||
|
||||
|
||||
j=pi2_p[15];
|
||||
s[j] = _mm_extract_epi8(yp128[2],13);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],14);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],15);
|
||||
|
||||
|
||||
#elif defined(__arm__)
|
||||
s[j] = vgetq_lane_s8(yp128[0],0);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],1);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],2);
|
||||
|
||||
|
||||
j=pi2_p[1];
|
||||
s[j] = vgetq_lane_s8(yp128[0],3);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],4);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],5);
|
||||
|
||||
|
||||
j=pi2_p[2];
|
||||
s[j] = vgetq_lane_s8(yp128[0],6);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],7);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],8);
|
||||
|
||||
|
||||
j=pi2_p[3];
|
||||
s[j] = vgetq_lane_s8(yp128[0],9);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],10);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],11);
|
||||
|
||||
|
||||
j=pi2_p[4];
|
||||
s[j] = vgetq_lane_s8(yp128[0],12);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],13);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],14);
|
||||
|
||||
|
||||
j=pi2_p[5];
|
||||
s[j] = vgetq_lane_s8(yp128[0],15);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],0);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],1);
|
||||
|
||||
|
||||
j=pi2_p[6];
|
||||
s[j] = vgetq_lane_s8(yp128[1],2);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],3);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],4);
|
||||
|
||||
|
||||
j=pi2_p[7];
|
||||
s[j] = vgetq_lane_s8(yp128[1],5);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],6);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],7);
|
||||
|
||||
|
||||
j=pi2_p[8];
|
||||
s[j] = vgetq_lane_s8(yp128[1],8);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],9);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],10);
|
||||
|
||||
|
||||
j=pi2_p[9];
|
||||
s[j] = vgetq_lane_s8(yp128[1],11);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],12);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],13);
|
||||
|
||||
|
||||
j=pi2_p[10];
|
||||
s[j] = vgetq_lane_s8(yp128[1],14);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],15);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],0);
|
||||
|
||||
|
||||
j=pi2_p[11];
|
||||
s[j] = vgetq_lane_s8(yp128[2],1);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],2);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],3);
|
||||
|
||||
|
||||
j=pi2_p[12];
|
||||
s[j] = vgetq_lane_s8(yp128[2],4);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],5);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],6);
|
||||
|
||||
|
||||
j=pi2_p[13];
|
||||
s[j] = vgetq_lane_s8(yp128[2],7);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],8);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],9);
|
||||
|
||||
|
||||
j=pi2_p[14];
|
||||
s[j] = vgetq_lane_s8(yp128[2],10);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],11);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],12);
|
||||
|
||||
|
||||
j=pi2_p[15];
|
||||
s[j] = vgetq_lane_s8(yp128[2],13);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],14);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],15);
|
||||
|
||||
#endif
|
||||
yp128+=3;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
yp=(llr_t*)yp128;
|
||||
@@ -1337,9 +1068,8 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
|
||||
if (init_stats) stop_meas(init_stats);
|
||||
|
||||
// do log_map from first parity bit
|
||||
|
||||
|
||||
log_map8(systematic0,yparity1,m11,m10,alpha,beta,ext,n2,0,F,offset8_flag,alpha_stats,beta_stats,gamma_stats,ext_stats);
|
||||
|
||||
while (iteration_cnt++ < max_iterations) {
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
//#include "PHY/CODING/lte_interleaver.h"
|
||||
//#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "ARCH/CBMIMO1/DEVICE_DRIVER/vars.h"
|
||||
#include "MAC_INTERFACE/vars.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
//#include "PHY/CODING/lte_interleaver.h"
|
||||
//#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
|
||||
|
||||
@@ -52,8 +51,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx)
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
crcTableInit();
|
||||
|
||||
lte_frame_parms = &(PHY_config->lte_frame_parms); //openair1/PHY/impl_defs_lte.h
|
||||
lte_ue_common_vars = &(PHY_vars->lte_ue_common_vars);
|
||||
lte_ue_dlsch_vars = &(PHY_vars->lte_ue_dlsch_vars);
|
||||
@@ -249,7 +246,6 @@ int main(int argc, char *argv[])
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
crcTableInit();
|
||||
ccodelte_init();
|
||||
ccodelte_init_inv();
|
||||
|
||||
|
||||
@@ -218,8 +218,6 @@ int main(int argc, char *argv[])
|
||||
randominit();
|
||||
set_taus_seed();
|
||||
|
||||
crcTableInit();
|
||||
|
||||
printf("EbN0, sigma, BER, FER\n");
|
||||
|
||||
for (SNR=0; SNR<10; SNR++) {
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#define __CODING_DEFS__H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "PHY/defs_common.h"
|
||||
#include <PHY/defs_common.h>
|
||||
|
||||
#define CRC24_A 0
|
||||
#define CRC24_B 1
|
||||
@@ -39,7 +38,24 @@
|
||||
#define MAX_TURBO_ITERATIONS_MBSFN 8
|
||||
#define MAX_TURBO_ITERATIONS max_turbo_iterations
|
||||
|
||||
typedef struct {
|
||||
unsigned short nb_bits;
|
||||
unsigned short f1;
|
||||
unsigned short f2;
|
||||
} interleaver_TS_36_212_t;
|
||||
|
||||
extern const interleaver_TS_36_212_t f1f2[188];
|
||||
|
||||
#define LTE_NULL 2
|
||||
typedef struct interleaver_codebook {
|
||||
unsigned long nb_bits;
|
||||
unsigned short f1;
|
||||
unsigned short f2;
|
||||
unsigned int beg_index;
|
||||
} t_interleaver_codebook;
|
||||
extern t_interleaver_codebook *f1f2mat;
|
||||
extern short *il_tb;
|
||||
|
||||
|
||||
/** @addtogroup _PHY_CODING_BLOCKS_
|
||||
* @{
|
||||
@@ -321,7 +337,7 @@ void ccodedab_init_inv(void);
|
||||
|
||||
/*!\fn void crcTableInit(void)
|
||||
\brief This function initializes the different crc tables.*/
|
||||
void crcTableInit (void);
|
||||
//void crcTableInit (void);
|
||||
|
||||
|
||||
|
||||
@@ -331,7 +347,7 @@ based on 3GPP UMTS/LTE specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits
|
||||
*/
|
||||
uint32_t crc24a (uint8_t *inPtr, int32_t bitlen);
|
||||
uint32_t crc24a (uint8_t * inptr, uint32_t bitlen);
|
||||
|
||||
/*!\fn uint32_t crc24b(uint8_t *inPtr, int32_t bitlen)
|
||||
\brief This computes a 24-bit crc ('b' variant for transport-block segments)
|
||||
@@ -339,26 +355,26 @@ based on 3GPP UMTS/LTE specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits
|
||||
*/
|
||||
uint32_t crc24b (uint8_t *inPtr, int32_t bitlen);
|
||||
|
||||
uint32_t crc24b (uint8_t * inptr, uint32_t bitlen);
|
||||
|
||||
/*!\fn uint32_t crc16(uint8_t *inPtr, int32_t bitlen)
|
||||
\brief This computes a 16-bit crc based on 3GPP UMTS specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits*/
|
||||
uint32_t crc16 (uint8_t *inPtr, int32_t bitlen);
|
||||
uint32_t crc16 (uint8_t * inptr, uint32_t bitlen);
|
||||
|
||||
/*!\fn uint32_t crc12(uint8_t *inPtr, int32_t bitlen)
|
||||
\brief This computes a 12-bit crc based on 3GPP UMTS specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits*/
|
||||
uint32_t crc12 (uint8_t *inPtr, int32_t bitlen);
|
||||
uint32_t crc12 (uint8_t * inptr, uint32_t bitlen);
|
||||
|
||||
/*!\fn uint32_t crc8(uint8_t *inPtr, int32_t bitlen)
|
||||
\brief This computes a 8-bit crc based on 3GPP UMTS specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits*/
|
||||
uint32_t crc8 (uint8_t *inPtr, int32_t bitlen);
|
||||
|
||||
uint32_t crc8 (uint8_t * inptr, uint32_t bitlen);
|
||||
|
||||
/*!\fn void phy_viterbi_dot11_sse2(int8_t *y, uint8_t *decoded_bytes, uint16_t n,int offset,int traceback)
|
||||
\brief This routine performs a SIMD optmized Viterbi decoder for the 802.11 64-state convolutional code. It can be
|
||||
run in segments with final trace back after last segment.
|
||||
@@ -422,4 +438,8 @@ uint32_t crcbit (uint8_t * ,
|
||||
int16_t reverseBits(int32_t ,int32_t);
|
||||
void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t);
|
||||
|
||||
decoder_if_t phy_threegpplte_turbo_decoder;
|
||||
decoder_if_t phy_threegpplte_turbo_decoder8;
|
||||
decoder_if_t phy_threegpplte_turbo_decoder16;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
extern unsigned short f1f2mat_old[2*188];
|
||||
extern double cpuf;
|
||||
extern decoder_if_t decoder16;
|
||||
extern decoder_if_t decoder8;
|
||||
extern encoder_if_t encoder;
|
||||
extern decoder_if_t *decoder16;
|
||||
extern decoder_if_t *decoder8;
|
||||
extern encoder_if_t *encoder;
|
||||
extern int load_codinglib(void);
|
||||
extern int free_codinglib(void);
|
||||
extern void free_codinglib(void);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/telnetsrv/telnetsrv.h"
|
||||
|
||||
@@ -55,28 +56,26 @@ loader_shlibfunc_t shlib_fdesc[DECODE_NUM_FPTR];
|
||||
|
||||
/* encoding decoding functions pointers, filled here and used when encoding/decoding */
|
||||
/*defined as extern in PHY?CODING/extern.h */
|
||||
decoder_if_t decoder16;
|
||||
decoder_if_t decoder8;
|
||||
encoder_if_t encoder;
|
||||
decoder_if_t *decoder16;
|
||||
decoder_if_t *decoder8;
|
||||
encoder_if_t *encoder;
|
||||
|
||||
extern int _may_i_use_cpu_feature(unsigned __int64);
|
||||
uint8_t nodecod(short *y,
|
||||
short *y2,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned char *decoded_bytes2,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
uint8_t nodecod(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
{
|
||||
return max_iterations+1;
|
||||
};
|
||||
@@ -86,24 +85,24 @@ void decoding_setmode (int mode) {
|
||||
case MODE_DECODE_NONE:
|
||||
decoder8=nodecod;
|
||||
decoder16=nodecod;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
break;
|
||||
case MODE_DECODE_C:
|
||||
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
break;
|
||||
case MODE_DECODE_AVX2:
|
||||
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
break;
|
||||
default:
|
||||
mode=MODE_DECODE_SSE;
|
||||
case MODE_DECODE_SSE:
|
||||
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
break;
|
||||
}
|
||||
curmode=mode;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "lte_interleaver.h"
|
||||
#include "lte_interleaver2.h"
|
||||
+138
-127
@@ -30,185 +30,196 @@
|
||||
Modified in June, 2001, to include the length non multiple of 8
|
||||
*/
|
||||
|
||||
#include "PHY/types.h"
|
||||
|
||||
#include "coding_defs.h"
|
||||
// For initialization && verification purposes, bit by bit implementation with any polynomial
|
||||
// The first bit is in the MSB of each byte
|
||||
|
||||
// Reference 38.212 V15.1.1 Section 5.1 (36-212 v8.6.0 , pp 8-9)
|
||||
// The highest degree is set by default
|
||||
/** 1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 */
|
||||
static const uint32_t poly24a = 0x864cfb00;
|
||||
/** 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1 */
|
||||
static const uint32_t poly24b = 0x80006300;
|
||||
/** 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 */
|
||||
static const uint32_t poly16 = 0x10210000;
|
||||
/** 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 */
|
||||
static const uint32_t poly12 = 0x80F00000;
|
||||
/** 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 */
|
||||
static const uint32_t poly8 = 0x9B000000;
|
||||
|
||||
// The following arrays are generated with the function 'crcTableInit'
|
||||
/** Encoding table for CRC 24A */
|
||||
static const uint32_t crc24aTable[256] = {0x0, 0x864cfb00, 0x8ad50d00, 0xc99f600, 0x93e6e100, 0x15aa1a00, 0x1933ec00, 0x9f7f1700, 0xa1813900, 0x27cdc200, 0x2b543400, 0xad18cf00, 0x3267d800, 0xb42b2300, 0xb8b2d500, 0x3efe2e00, 0xc54e8900, 0x43027200, 0x4f9b8400, 0xc9d77f00, 0x56a86800, 0xd0e49300, 0xdc7d6500, 0x5a319e00, 0x64cfb000, 0xe2834b00, 0xee1abd00, 0x68564600, 0xf7295100, 0x7165aa00, 0x7dfc5c00, 0xfbb0a700, 0xcd1e900, 0x8a9d1200, 0x8604e400, 0x481f00, 0x9f370800, 0x197bf300, 0x15e20500, 0x93aefe00, 0xad50d000, 0x2b1c2b00, 0x2785dd00, 0xa1c92600, 0x3eb63100, 0xb8faca00, 0xb4633c00, 0x322fc700, 0xc99f6000, 0x4fd39b00, 0x434a6d00, 0xc5069600, 0x5a798100, 0xdc357a00, 0xd0ac8c00, 0x56e07700, 0x681e5900, 0xee52a200, 0xe2cb5400, 0x6487af00, 0xfbf8b800, 0x7db44300, 0x712db500, 0xf7614e00, 0x19a3d200, 0x9fef2900, 0x9376df00, 0x153a2400, 0x8a453300, 0xc09c800, 0x903e00, 0x86dcc500, 0xb822eb00, 0x3e6e1000, 0x32f7e600, 0xb4bb1d00, 0x2bc40a00, 0xad88f100, 0xa1110700, 0x275dfc00, 0xdced5b00, 0x5aa1a000, 0x56385600, 0xd074ad00, 0x4f0bba00, 0xc9474100, 0xc5deb700, 0x43924c00, 0x7d6c6200, 0xfb209900, 0xf7b96f00, 0x71f59400, 0xee8a8300, 0x68c67800, 0x645f8e00, 0xe2137500, 0x15723b00, 0x933ec000, 0x9fa73600, 0x19ebcd00, 0x8694da00, 0xd82100, 0xc41d700, 0x8a0d2c00, 0xb4f30200, 0x32bff900, 0x3e260f00, 0xb86af400, 0x2715e300, 0xa1591800, 0xadc0ee00, 0x2b8c1500, 0xd03cb200, 0x56704900, 0x5ae9bf00, 0xdca54400, 0x43da5300, 0xc596a800, 0xc90f5e00, 0x4f43a500, 0x71bd8b00, 0xf7f17000, 0xfb688600, 0x7d247d00, 0xe25b6a00, 0x64179100, 0x688e6700, 0xeec29c00, 0x3347a400, 0xb50b5f00, 0xb992a900, 0x3fde5200, 0xa0a14500, 0x26edbe00, 0x2a744800, 0xac38b300, 0x92c69d00, 0x148a6600, 0x18139000, 0x9e5f6b00, 0x1207c00, 0x876c8700, 0x8bf57100, 0xdb98a00, 0xf6092d00, 0x7045d600, 0x7cdc2000, 0xfa90db00, 0x65efcc00, 0xe3a33700, 0xef3ac100, 0x69763a00, 0x57881400, 0xd1c4ef00, 0xdd5d1900, 0x5b11e200, 0xc46ef500, 0x42220e00, 0x4ebbf800, 0xc8f70300, 0x3f964d00, 0xb9dab600, 0xb5434000, 0x330fbb00, 0xac70ac00, 0x2a3c5700, 0x26a5a100, 0xa0e95a00, 0x9e177400, 0x185b8f00, 0x14c27900, 0x928e8200, 0xdf19500, 0x8bbd6e00, 0x87249800, 0x1686300, 0xfad8c400, 0x7c943f00, 0x700dc900, 0xf6413200, 0x693e2500, 0xef72de00, 0xe3eb2800, 0x65a7d300, 0x5b59fd00, 0xdd150600, 0xd18cf000, 0x57c00b00, 0xc8bf1c00, 0x4ef3e700, 0x426a1100, 0xc426ea00, 0x2ae47600, 0xaca88d00, 0xa0317b00, 0x267d8000, 0xb9029700, 0x3f4e6c00, 0x33d79a00, 0xb59b6100, 0x8b654f00, 0xd29b400, 0x1b04200, 0x87fcb900, 0x1883ae00, 0x9ecf5500, 0x9256a300, 0x141a5800, 0xefaaff00, 0x69e60400, 0x657ff200, 0xe3330900, 0x7c4c1e00, 0xfa00e500, 0xf6991300, 0x70d5e800, 0x4e2bc600, 0xc8673d00, 0xc4fecb00, 0x42b23000, 0xddcd2700, 0x5b81dc00, 0x57182a00, 0xd154d100, 0x26359f00, 0xa0796400, 0xace09200, 0x2aac6900, 0xb5d37e00, 0x339f8500, 0x3f067300, 0xb94a8800, 0x87b4a600, 0x1f85d00, 0xd61ab00, 0x8b2d5000, 0x14524700, 0x921ebc00, 0x9e874a00, 0x18cbb100, 0xe37b1600, 0x6537ed00, 0x69ae1b00, 0xefe2e000, 0x709df700, 0xf6d10c00, 0xfa48fa00, 0x7c040100, 0x42fa2f00, 0xc4b6d400, 0xc82f2200, 0x4e63d900, 0xd11cce00, 0x57503500, 0x5bc9c300, 0xdd853800};
|
||||
|
||||
/** Encoding table for CRC 24B */
|
||||
static const uint32_t crc24bTable[256] = {0x0, 0x80006300, 0x8000a500, 0xc600, 0x80012900, 0x14a00, 0x18c00, 0x8001ef00, 0x80023100, 0x25200, 0x29400, 0x8002f700, 0x31800, 0x80037b00, 0x8003bd00, 0x3de00, 0x80040100, 0x46200, 0x4a400, 0x8004c700, 0x52800, 0x80054b00, 0x80058d00, 0x5ee00, 0x63000, 0x80065300, 0x80069500, 0x6f600, 0x80071900, 0x77a00, 0x7bc00, 0x8007df00, 0x80086100, 0x80200, 0x8c400, 0x8008a700, 0x94800, 0x80092b00, 0x8009ed00, 0x98e00, 0xa5000, 0x800a3300, 0x800af500, 0xa9600, 0x800b7900, 0xb1a00, 0xbdc00, 0x800bbf00, 0xc6000, 0x800c0300, 0x800cc500, 0xca600, 0x800d4900, 0xd2a00, 0xdec00, 0x800d8f00, 0x800e5100, 0xe3200, 0xef400, 0x800e9700, 0xf7800, 0x800f1b00, 0x800fdd00, 0xfbe00, 0x8010a100, 0x10c200, 0x100400, 0x80106700, 0x118800, 0x8011eb00, 0x80112d00, 0x114e00, 0x129000, 0x8012f300, 0x80123500, 0x125600, 0x8013b900, 0x13da00, 0x131c00, 0x80137f00, 0x14a000, 0x8014c300, 0x80140500, 0x146600, 0x80158900, 0x15ea00, 0x152c00, 0x80154f00, 0x80169100, 0x16f200, 0x163400, 0x80165700, 0x17b800, 0x8017db00, 0x80171d00, 0x177e00, 0x18c000, 0x8018a300, 0x80186500, 0x180600, 0x8019e900, 0x198a00, 0x194c00, 0x80192f00, 0x801af100, 0x1a9200, 0x1a5400, 0x801a3700, 0x1bd800, 0x801bbb00, 0x801b7d00, 0x1b1e00, 0x801cc100, 0x1ca200, 0x1c6400, 0x801c0700, 0x1de800, 0x801d8b00, 0x801d4d00, 0x1d2e00, 0x1ef000, 0x801e9300, 0x801e5500, 0x1e3600, 0x801fd900, 0x1fba00, 0x1f7c00, 0x801f1f00, 0x80212100, 0x214200, 0x218400, 0x8021e700, 0x200800, 0x80206b00, 0x8020ad00, 0x20ce00, 0x231000, 0x80237300, 0x8023b500, 0x23d600, 0x80223900, 0x225a00, 0x229c00, 0x8022ff00, 0x252000, 0x80254300, 0x80258500, 0x25e600, 0x80240900, 0x246a00, 0x24ac00, 0x8024cf00, 0x80271100, 0x277200, 0x27b400, 0x8027d700, 0x263800, 0x80265b00, 0x80269d00, 0x26fe00, 0x294000, 0x80292300, 0x8029e500, 0x298600, 0x80286900, 0x280a00, 0x28cc00, 0x8028af00, 0x802b7100, 0x2b1200, 0x2bd400, 0x802bb700, 0x2a5800, 0x802a3b00, 0x802afd00, 0x2a9e00, 0x802d4100, 0x2d2200, 0x2de400, 0x802d8700, 0x2c6800, 0x802c0b00, 0x802ccd00, 0x2cae00, 0x2f7000, 0x802f1300, 0x802fd500, 0x2fb600, 0x802e5900, 0x2e3a00, 0x2efc00, 0x802e9f00, 0x318000, 0x8031e300, 0x80312500, 0x314600, 0x8030a900, 0x30ca00, 0x300c00, 0x80306f00, 0x8033b100, 0x33d200, 0x331400, 0x80337700, 0x329800, 0x8032fb00, 0x80323d00, 0x325e00, 0x80358100, 0x35e200, 0x352400, 0x80354700, 0x34a800, 0x8034cb00, 0x80340d00, 0x346e00, 0x37b000, 0x8037d300, 0x80371500, 0x377600, 0x80369900, 0x36fa00, 0x363c00, 0x80365f00, 0x8039e100, 0x398200, 0x394400, 0x80392700, 0x38c800, 0x8038ab00, 0x80386d00, 0x380e00, 0x3bd000, 0x803bb300, 0x803b7500, 0x3b1600, 0x803af900, 0x3a9a00, 0x3a5c00, 0x803a3f00, 0x3de000, 0x803d8300, 0x803d4500, 0x3d2600, 0x803cc900, 0x3caa00, 0x3c6c00, 0x803c0f00, 0x803fd100, 0x3fb200, 0x3f7400, 0x803f1700, 0x3ef800, 0x803e9b00, 0x803e5d00, 0x3e3e00};
|
||||
|
||||
/** Encoding table for CRC 16 */
|
||||
static const uint16_t crc16Table[256] = {0x0, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0xa50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0xc60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0xe70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0xa1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x2b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x8e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0xaf1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0xcc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0xed1, 0x1ef0};
|
||||
|
||||
/** Encoding table for CRC 12 */
|
||||
static const uint16_t crc12Table[256] = {0x0, 0x80f0, 0x8110, 0x1e0, 0x82d0, 0x220, 0x3c0, 0x8330, 0x8550, 0x5a0, 0x440, 0x84b0, 0x780, 0x8770, 0x8690, 0x660, 0x8a50, 0xaa0, 0xb40, 0x8bb0, 0x880, 0x8870, 0x8990, 0x960, 0xf00, 0x8ff0, 0x8e10, 0xee0, 0x8dd0, 0xd20, 0xcc0, 0x8c30, 0x9450, 0x14a0, 0x1540, 0x95b0, 0x1680, 0x9670, 0x9790, 0x1760, 0x1100, 0x91f0, 0x9010, 0x10e0, 0x93d0, 0x1320, 0x12c0, 0x9230, 0x1e00, 0x9ef0, 0x9f10, 0x1fe0, 0x9cd0, 0x1c20, 0x1dc0, 0x9d30, 0x9b50, 0x1ba0, 0x1a40, 0x9ab0, 0x1980, 0x9970, 0x9890, 0x1860, 0xa850, 0x28a0, 0x2940, 0xa9b0, 0x2a80, 0xaa70, 0xab90, 0x2b60, 0x2d00, 0xadf0, 0xac10, 0x2ce0, 0xafd0, 0x2f20, 0x2ec0, 0xae30, 0x2200, 0xa2f0, 0xa310, 0x23e0, 0xa0d0, 0x2020, 0x21c0, 0xa130, 0xa750, 0x27a0, 0x2640, 0xa6b0, 0x2580, 0xa570, 0xa490, 0x2460, 0x3c00, 0xbcf0, 0xbd10, 0x3de0, 0xbed0, 0x3e20, 0x3fc0, 0xbf30, 0xb950, 0x39a0, 0x3840, 0xb8b0, 0x3b80, 0xbb70, 0xba90, 0x3a60, 0xb650, 0x36a0, 0x3740, 0xb7b0, 0x3480, 0xb470, 0xb590, 0x3560, 0x3300, 0xb3f0, 0xb210, 0x32e0, 0xb1d0, 0x3120, 0x30c0, 0xb030, 0xd050, 0x50a0, 0x5140, 0xd1b0, 0x5280, 0xd270, 0xd390, 0x5360, 0x5500, 0xd5f0, 0xd410, 0x54e0, 0xd7d0, 0x5720, 0x56c0, 0xd630, 0x5a00, 0xdaf0, 0xdb10, 0x5be0, 0xd8d0, 0x5820, 0x59c0, 0xd930, 0xdf50, 0x5fa0, 0x5e40, 0xdeb0, 0x5d80, 0xdd70, 0xdc90, 0x5c60, 0x4400, 0xc4f0, 0xc510, 0x45e0, 0xc6d0, 0x4620, 0x47c0, 0xc730, 0xc150, 0x41a0, 0x4040, 0xc0b0, 0x4380, 0xc370, 0xc290, 0x4260, 0xce50, 0x4ea0, 0x4f40, 0xcfb0, 0x4c80, 0xcc70, 0xcd90, 0x4d60, 0x4b00, 0xcbf0, 0xca10, 0x4ae0, 0xc9d0, 0x4920, 0x48c0, 0xc830, 0x7800, 0xf8f0, 0xf910, 0x79e0, 0xfad0, 0x7a20, 0x7bc0, 0xfb30, 0xfd50, 0x7da0, 0x7c40, 0xfcb0, 0x7f80, 0xff70, 0xfe90, 0x7e60, 0xf250, 0x72a0, 0x7340, 0xf3b0, 0x7080, 0xf070, 0xf190, 0x7160, 0x7700, 0xf7f0, 0xf610, 0x76e0, 0xf5d0, 0x7520, 0x74c0, 0xf430, 0xec50, 0x6ca0, 0x6d40, 0xedb0, 0x6e80, 0xee70, 0xef90, 0x6f60, 0x6900, 0xe9f0, 0xe810, 0x68e0, 0xebd0, 0x6b20, 0x6ac0, 0xea30, 0x6600, 0xe6f0, 0xe710, 0x67e0, 0xe4d0, 0x6420, 0x65c0, 0xe530, 0xe350, 0x63a0, 0x6240, 0xe2b0, 0x6180, 0xe170, 0xe090, 0x6060};
|
||||
|
||||
/** Encoding table for CRC 8 */
|
||||
static const uint8_t crc8Table[256] = {0x0, 0x9b, 0xad, 0x36, 0xc1, 0x5a, 0x6c, 0xf7, 0x19, 0x82, 0xb4, 0x2f, 0xd8, 0x43, 0x75, 0xee, 0x32, 0xa9, 0x9f, 0x4, 0xf3, 0x68, 0x5e, 0xc5, 0x2b, 0xb0, 0x86, 0x1d, 0xea, 0x71, 0x47, 0xdc, 0x64, 0xff, 0xc9, 0x52, 0xa5, 0x3e, 0x8, 0x93, 0x7d, 0xe6, 0xd0, 0x4b, 0xbc, 0x27, 0x11, 0x8a, 0x56, 0xcd, 0xfb, 0x60, 0x97, 0xc, 0x3a, 0xa1, 0x4f, 0xd4, 0xe2, 0x79, 0x8e, 0x15, 0x23, 0xb8, 0xc8, 0x53, 0x65, 0xfe, 0x9, 0x92, 0xa4, 0x3f, 0xd1, 0x4a, 0x7c, 0xe7, 0x10, 0x8b, 0xbd, 0x26, 0xfa, 0x61, 0x57, 0xcc, 0x3b, 0xa0, 0x96, 0xd, 0xe3, 0x78, 0x4e, 0xd5, 0x22, 0xb9, 0x8f, 0x14, 0xac, 0x37, 0x1, 0x9a, 0x6d, 0xf6, 0xc0, 0x5b, 0xb5, 0x2e, 0x18, 0x83, 0x74, 0xef, 0xd9, 0x42, 0x9e, 0x5, 0x33, 0xa8, 0x5f, 0xc4, 0xf2, 0x69, 0x87, 0x1c, 0x2a, 0xb1, 0x46, 0xdd, 0xeb, 0x70, 0xb, 0x90, 0xa6, 0x3d, 0xca, 0x51, 0x67, 0xfc, 0x12, 0x89, 0xbf, 0x24, 0xd3, 0x48, 0x7e, 0xe5, 0x39, 0xa2, 0x94, 0xf, 0xf8, 0x63, 0x55, 0xce, 0x20, 0xbb, 0x8d, 0x16, 0xe1, 0x7a, 0x4c, 0xd7, 0x6f, 0xf4, 0xc2, 0x59, 0xae, 0x35, 0x3, 0x98, 0x76, 0xed, 0xdb, 0x40, 0xb7, 0x2c, 0x1a, 0x81, 0x5d, 0xc6, 0xf0, 0x6b, 0x9c, 0x7, 0x31, 0xaa, 0x44, 0xdf, 0xe9, 0x72, 0x85, 0x1e, 0x28, 0xb3, 0xc3, 0x58, 0x6e, 0xf5, 0x2, 0x99, 0xaf, 0x34, 0xda, 0x41, 0x77, 0xec, 0x1b, 0x80, 0xb6, 0x2d, 0xf1, 0x6a, 0x5c, 0xc7, 0x30, 0xab, 0x9d, 0x6, 0xe8, 0x73, 0x45, 0xde, 0x29, 0xb2, 0x84, 0x1f, 0xa7, 0x3c, 0xa, 0x91, 0x66, 0xfd, 0xcb, 0x50, 0xbe, 0x25, 0x13, 0x88, 0x7f, 0xe4, 0xd2, 0x49, 0x95, 0xe, 0x38, 0xa3, 0x54, 0xcf, 0xf9, 0x62, 0x8c, 0x17, 0x21, 0xba, 0x4d, 0xd6, 0xe0, 0x7b};
|
||||
|
||||
|
||||
/*ref 36-212 v8.6.0 , pp 8-9 */
|
||||
/* the highest degree is set by default */
|
||||
unsigned int poly24a = 0x864cfb00; //1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1
|
||||
unsigned int poly24b = 0x80006300; // 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1
|
||||
unsigned int poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
|
||||
unsigned int poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
|
||||
unsigned int poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
|
||||
/*********************************************************
|
||||
|
||||
For initialization && verification purposes,
|
||||
bit by bit implementation with any polynomial
|
||||
|
||||
The first bit is in the MSB of each byte
|
||||
|
||||
*********************************************************/
|
||||
unsigned int
|
||||
crcbit (unsigned char * inputptr, int octetlen, unsigned int poly)
|
||||
uint32_t crcbit (uint8_t * inputptr, int32_t octetlen, uint32_t poly)
|
||||
{
|
||||
unsigned int i, crc = 0, c;
|
||||
uint32_t i;
|
||||
uint32_t crc = 0;
|
||||
uint32_t c;
|
||||
|
||||
while (octetlen-- > 0) {
|
||||
c = (*inputptr++) << 24;
|
||||
while (octetlen-- > 0)
|
||||
{
|
||||
c = (*inputptr++) << 24;
|
||||
|
||||
for (i = 8; i != 0; i--) {
|
||||
if ((1 << 31) & (c ^ crc))
|
||||
crc = (crc << 1) ^ poly;
|
||||
else
|
||||
crc <<= 1;
|
||||
for (i = 8; i != 0; i--)
|
||||
{
|
||||
if ( (1 << 31) & (c ^ crc) )
|
||||
{
|
||||
crc = (crc << 1) ^ poly;
|
||||
}
|
||||
else
|
||||
{
|
||||
crc <<= 1;
|
||||
}
|
||||
|
||||
c <<= 1;
|
||||
c <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return crc;
|
||||
return crc;
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
|
||||
crc table initialization
|
||||
|
||||
*********************************************************/
|
||||
static unsigned int crc24aTable[256];
|
||||
static unsigned int crc24bTable[256];
|
||||
static unsigned short crc16Table[256];
|
||||
static unsigned short crc12Table[256];
|
||||
static unsigned char crc8Table[256];
|
||||
// CRC table initialization
|
||||
|
||||
/*
|
||||
void crcTableInit (void)
|
||||
{
|
||||
unsigned char c = 0;
|
||||
uint8_t c = 0;
|
||||
|
||||
do {
|
||||
crc24aTable[c] = crcbit (&c, 1, poly24a);
|
||||
crc24bTable[c] = crcbit (&c, 1, poly24b);
|
||||
crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16);
|
||||
crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16);
|
||||
crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24);
|
||||
} while (++c);
|
||||
do
|
||||
{
|
||||
crc24aTable[c] = crcbit (&c, 1, poly24a);
|
||||
crc24bTable[c] = crcbit (&c, 1, poly24b);
|
||||
crc16Table [c] = (uint16_t) (crcbit (&c, 1, poly16) >> 16);
|
||||
crc12Table [c] = (uint16_t) (crcbit (&c, 1, poly12) >> 16);
|
||||
crc8Table [c] = (uint8_t) (crcbit (&c, 1, poly8 ) >> 24);
|
||||
}
|
||||
while (++c);
|
||||
}
|
||||
/*********************************************************
|
||||
*/
|
||||
|
||||
Byte by byte implementations,
|
||||
assuming initial byte is 0 padded (in MSB) if necessary
|
||||
|
||||
*********************************************************/
|
||||
unsigned int
|
||||
crc24a (unsigned char * inptr, int bitlen)
|
||||
// Byte by byte implementations, assuming initial byte is 0 padded (in MSB) if necessary
|
||||
uint32_t crc24a (uint8_t * inptr, uint32_t bitlen)
|
||||
{
|
||||
int32_t octetlen = bitlen / 8;
|
||||
int32_t resbit = (bitlen % 8);
|
||||
uint32_t crc = 0;
|
||||
|
||||
int octetlen, resbit;
|
||||
unsigned int crc = 0;
|
||||
octetlen = bitlen / 8; /* Change in octets */
|
||||
resbit = (bitlen % 8);
|
||||
while (octetlen-- > 0)
|
||||
{
|
||||
crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)];
|
||||
}
|
||||
|
||||
while (octetlen-- > 0) {
|
||||
// printf("crc24a: in %x => crc %x\n",crc,*inptr);
|
||||
crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)];
|
||||
}
|
||||
if (resbit > 0)
|
||||
{
|
||||
crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
|
||||
}
|
||||
|
||||
if (resbit > 0)
|
||||
crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
|
||||
|
||||
return crc;
|
||||
return crc;
|
||||
}
|
||||
|
||||
unsigned int crc24b (unsigned char * inptr, int bitlen)
|
||||
uint32_t crc24b (uint8_t * inptr, uint32_t bitlen)
|
||||
{
|
||||
int32_t octetlen = bitlen / 8;
|
||||
int32_t resbit = (bitlen % 8);
|
||||
uint32_t crc = 0;
|
||||
|
||||
int octetlen, resbit;
|
||||
unsigned int crc = 0;
|
||||
octetlen = bitlen / 8; /* Change in octets */
|
||||
resbit = (bitlen % 8);
|
||||
while (octetlen-- > 0)
|
||||
{
|
||||
crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)];
|
||||
}
|
||||
|
||||
while (octetlen-- > 0) {
|
||||
// printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]);
|
||||
crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)];
|
||||
}
|
||||
if (resbit > 0)
|
||||
{
|
||||
crc = (crc << resbit) ^ crc24bTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
|
||||
}
|
||||
|
||||
if (resbit > 0)
|
||||
crc = (crc << resbit) ^ crc24bTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
|
||||
|
||||
return crc;
|
||||
return crc;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
crc16 (unsigned char * inptr, int bitlen)
|
||||
uint32_t crc16 (uint8_t * inptr, uint32_t bitlen)
|
||||
{
|
||||
int octetlen, resbit;
|
||||
unsigned int crc = 0;
|
||||
octetlen = bitlen / 8; /* Change in octets */
|
||||
resbit = (bitlen % 8);
|
||||
int32_t octetlen = bitlen / 8;
|
||||
int32_t resbit = (bitlen % 8);
|
||||
uint32_t crc = 0;
|
||||
|
||||
while (octetlen-- > 0) {
|
||||
while (octetlen-- > 0)
|
||||
{
|
||||
crc = (crc << 8) ^ (crc16Table[(*inptr++) ^ (crc >> 24)] << 16);
|
||||
}
|
||||
|
||||
crc = (crc << 8) ^ (crc16Table[(*inptr++) ^ (crc >> 24)] << 16);
|
||||
}
|
||||
if (resbit > 0)
|
||||
{
|
||||
crc = (crc << resbit) ^ (crc16Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
|
||||
}
|
||||
|
||||
if (resbit > 0)
|
||||
crc = (crc << resbit) ^ (crc16Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
|
||||
|
||||
return crc;
|
||||
return crc;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
crc12 (unsigned char * inptr, int bitlen)
|
||||
uint32_t crc12 (uint8_t * inptr, uint32_t bitlen)
|
||||
{
|
||||
int octetlen, resbit;
|
||||
unsigned int crc = 0;
|
||||
octetlen = bitlen / 8; /* Change in octets */
|
||||
resbit = (bitlen % 8);
|
||||
int32_t octetlen = bitlen / 8;
|
||||
int32_t resbit = (bitlen % 8);
|
||||
uint32_t crc = 0;
|
||||
|
||||
while (octetlen-- > 0) {
|
||||
crc = (crc << 8) ^ (crc12Table[(*inptr++) ^ (crc >> 24)] << 16);
|
||||
}
|
||||
while (octetlen-- > 0)
|
||||
{
|
||||
crc = (crc << 8) ^ (crc12Table[(*inptr++) ^ (crc >> 24)] << 16);
|
||||
}
|
||||
|
||||
if (resbit > 0)
|
||||
crc = (crc << resbit) ^ (crc12Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
|
||||
if (resbit > 0)
|
||||
{
|
||||
crc = (crc << resbit) ^ (crc12Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
|
||||
}
|
||||
|
||||
return crc;
|
||||
return crc;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
crc8 (unsigned char * inptr, int bitlen)
|
||||
uint32_t crc8 (uint8_t * inptr, uint32_t bitlen)
|
||||
{
|
||||
int octetlen, resbit;
|
||||
unsigned int crc = 0;
|
||||
octetlen = bitlen / 8; /* Change in octets */
|
||||
resbit = (bitlen % 8);
|
||||
int32_t octetlen = bitlen / 8;
|
||||
int32_t resbit = (bitlen % 8);
|
||||
uint32_t crc = 0;
|
||||
|
||||
while (octetlen-- > 0) {
|
||||
crc = crc8Table[(*inptr++) ^ (crc >> 24)] << 24;
|
||||
}
|
||||
while (octetlen-- > 0)
|
||||
{
|
||||
crc = crc8Table[(*inptr++) ^ (crc >> 24)] << 24;
|
||||
}
|
||||
|
||||
if (resbit > 0)
|
||||
crc = (crc << resbit) ^ (crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24);
|
||||
if (resbit > 0)
|
||||
{
|
||||
crc = (crc << resbit) ^ (crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24);
|
||||
}
|
||||
|
||||
return crc;
|
||||
return crc;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CRC
|
||||
/*******************************************************************/
|
||||
/**
|
||||
Test code
|
||||
********************************************************************/
|
||||
// Test code
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
unsigned char test[] = "Thebigredfox";
|
||||
crcTableInit();
|
||||
printf("%x\n", crcbit(test, sizeof(test) - 1, poly24));
|
||||
printf("%x\n", crc24(test, (sizeof(test) - 1)*8));
|
||||
printf("%x\n", crcbit(test, sizeof(test) - 1, poly8));
|
||||
printf("%x\n", crc8(test, (sizeof(test) - 1)*8));
|
||||
unsigned char test[] = "Thebigredfox";
|
||||
crcTableInit();
|
||||
printf("%x\n", crcbit(test, sizeof(test) - 1, poly24));
|
||||
printf("%x\n", crc24 (test, (sizeof(test) - 1)*8));
|
||||
printf("%x\n", crcbit(test, sizeof(test) - 1, poly8));
|
||||
printf("%x\n", crc8 (test, (sizeof(test) - 1)*8));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
typedef struct interleaver_codebook {
|
||||
unsigned long nb_bits;
|
||||
unsigned short f1;
|
||||
unsigned short f2;
|
||||
unsigned int beg_index;
|
||||
} t_interleaver_codebook;
|
||||
#ifndef INCL_INTERLEAVE
|
||||
extern t_interleaver_codebook f1f2mat[];
|
||||
extern short il_tb[];
|
||||
extern short reverse_il_tl[];
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
unsigned short f1f2mat_old[2*188] = {3, 10,
|
||||
7, 12,
|
||||
19, 42,
|
||||
7, 16,
|
||||
7, 18,
|
||||
11, 20,
|
||||
5, 22,
|
||||
11, 24,
|
||||
7, 26,
|
||||
41, 84,
|
||||
103, 90,
|
||||
15, 32,
|
||||
9, 34,
|
||||
17, 108,
|
||||
9, 38,
|
||||
21, 120,
|
||||
101, 84,
|
||||
21, 44,
|
||||
57, 46,
|
||||
23, 48,
|
||||
13, 50,
|
||||
27, 52,
|
||||
11, 36,
|
||||
27, 56,
|
||||
85, 58,
|
||||
29, 60,
|
||||
33, 62,
|
||||
15, 32,
|
||||
17, 198,
|
||||
33, 68,
|
||||
103, 210,
|
||||
19, 36,
|
||||
19, 74,
|
||||
37, 76,
|
||||
19, 78,
|
||||
21, 120,
|
||||
21, 82,
|
||||
115, 84,
|
||||
193, 86,
|
||||
21, 44,
|
||||
133, 90,
|
||||
81, 46,
|
||||
45, 94,
|
||||
23, 48,
|
||||
243, 98,
|
||||
151, 40,
|
||||
155, 102,
|
||||
25, 52,
|
||||
51, 106,
|
||||
47, 72,
|
||||
91, 110,
|
||||
29, 168,
|
||||
29, 114,
|
||||
247, 58,
|
||||
29, 118,
|
||||
89, 180,
|
||||
91, 122,
|
||||
157, 62,
|
||||
55, 84,
|
||||
31, 64,
|
||||
17, 66,
|
||||
35, 68,
|
||||
227, 420,
|
||||
65, 96,
|
||||
19, 74,
|
||||
37, 76,
|
||||
41, 234,
|
||||
39, 80,
|
||||
185, 82,
|
||||
43, 252,
|
||||
21, 86,
|
||||
155, 44,
|
||||
79, 120,
|
||||
139, 92,
|
||||
23, 94,
|
||||
217, 48,
|
||||
25, 98,
|
||||
17, 80,
|
||||
127, 102,
|
||||
25, 52,
|
||||
239, 106,
|
||||
17, 48,
|
||||
137, 110,
|
||||
215, 112,
|
||||
29, 114,
|
||||
15, 58,
|
||||
147, 118,
|
||||
29, 60,
|
||||
59, 122,
|
||||
65, 124,
|
||||
55, 84,
|
||||
31, 64,
|
||||
17, 66,
|
||||
171, 204,
|
||||
67, 140,
|
||||
35, 72,
|
||||
19, 74,
|
||||
39, 76,
|
||||
19, 78,
|
||||
199, 240,
|
||||
21, 82,
|
||||
211, 252,
|
||||
21, 86,
|
||||
43, 88,
|
||||
149, 60,
|
||||
45, 92,
|
||||
49, 846,
|
||||
71, 48,
|
||||
13, 28,
|
||||
17, 80,
|
||||
25, 102,
|
||||
183, 104,
|
||||
55, 954,
|
||||
127, 96,
|
||||
27, 110,
|
||||
29, 112,
|
||||
29, 114,
|
||||
57, 116,
|
||||
45, 354,
|
||||
31, 120,
|
||||
59, 610,
|
||||
185, 124,
|
||||
113, 420,
|
||||
31, 64,
|
||||
17, 66,
|
||||
171, 136,
|
||||
209, 420,
|
||||
253, 216,
|
||||
367, 444,
|
||||
265, 456,
|
||||
181, 468,
|
||||
39, 80,
|
||||
27, 164,
|
||||
127, 504,
|
||||
143, 172,
|
||||
43, 88,
|
||||
29, 300,
|
||||
45, 92,
|
||||
157, 188,
|
||||
47, 96,
|
||||
13, 28,
|
||||
111, 240,
|
||||
443, 204,
|
||||
51, 104,
|
||||
51, 212,
|
||||
451, 192,
|
||||
257, 220,
|
||||
57, 336,
|
||||
313, 228,
|
||||
271, 232,
|
||||
179, 236,
|
||||
331, 120,
|
||||
363, 244,
|
||||
375, 248,
|
||||
127, 168,
|
||||
31, 64,
|
||||
33, 130,
|
||||
43, 264,
|
||||
33, 134,
|
||||
477, 408,
|
||||
35, 138,
|
||||
233, 280,
|
||||
357, 142,
|
||||
337, 480,
|
||||
37, 146,
|
||||
71, 444,
|
||||
71, 120,
|
||||
37, 152,
|
||||
39, 462,
|
||||
127, 234,
|
||||
39, 158,
|
||||
39, 80,
|
||||
31, 96,
|
||||
113, 902,
|
||||
41, 166,
|
||||
251, 336,
|
||||
43, 170,
|
||||
21, 86,
|
||||
43, 174,
|
||||
45, 176,
|
||||
45, 178,
|
||||
161, 120,
|
||||
89, 182,
|
||||
323, 184,
|
||||
47, 186,
|
||||
23, 94,
|
||||
47, 190,
|
||||
263, 480
|
||||
};
|
||||
@@ -67,8 +67,6 @@ void generate_qpsk_table(void)
|
||||
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
crcTableInit();
|
||||
|
||||
ccodedot11_init();
|
||||
ccodedot11_init_inv();
|
||||
|
||||
|
||||
@@ -255,12 +255,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
|
||||
"prach_starting_subframe_periodicity[0] %d < prach_numPetitionPerPreambleAttempt[0] %d\n",
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0],
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]);
|
||||
#if 0
|
||||
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0,
|
||||
"prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n");
|
||||
#else
|
||||
LOG_E(PHY,"***DJP*** removed assert on preamble fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]:%d expecting >0 %s:%d\n\n\n", fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0], __FILE__, __LINE__);
|
||||
#endif
|
||||
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0] = cfg->emtc_config.prach_ce_level_0_configuration_index.value;
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0] = cfg->emtc_config.prach_ce_level_0_frequency_offset.value;
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[0] = cfg->emtc_config.prach_ce_level_0_hopping_enable.value;
|
||||
@@ -471,7 +466,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
|
||||
}
|
||||
*/
|
||||
|
||||
void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
long mbsfn_AreaId_r9)
|
||||
{
|
||||
|
||||
@@ -491,8 +486,7 @@ void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
|
||||
void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
|
||||
{
|
||||
|
||||
uint8_t UE_id;
|
||||
uint16_t UE_id;
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated;
|
||||
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ int phy_init_RU(RU_t *ru) {
|
||||
AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
|
||||
RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
|
||||
|
||||
LOG_E(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
|
||||
LOG_D(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
|
||||
|
||||
for (i=0; i<RC.nb_L1_inst; i++) {
|
||||
for (p=0;p<15;p++) {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
|
||||
void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
TDD_Config_t *tdd_Config,
|
||||
uint8_t SIwindowsize,
|
||||
@@ -55,7 +55,7 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
|
||||
fp->SIPeriod = SIperiod;
|
||||
}
|
||||
|
||||
void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
|
||||
void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
@@ -179,7 +179,7 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
|
||||
|
||||
}
|
||||
|
||||
void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
|
||||
void phy_config_sib13_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
|
||||
long mbsfn_AreaId_r9)
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_
|
||||
/*
|
||||
* 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)
|
||||
void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
||||
{
|
||||
|
||||
if(mobilityControlInfo!=NULL) {
|
||||
@@ -324,7 +324,7 @@ void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, Mobility
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
void phy_config_meas_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
|
||||
{
|
||||
|
||||
PHY_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->measurements;
|
||||
@@ -353,7 +353,7 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
#endif
|
||||
|
||||
|
||||
void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
uint16_t max_harq_tx )
|
||||
{
|
||||
|
||||
@@ -363,7 +363,7 @@ void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
|
||||
extern uint16_t beta_cqi[16];
|
||||
|
||||
void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated )
|
||||
{
|
||||
|
||||
@@ -709,6 +709,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
|
||||
LOG_I(PHY,"common_vars->rxdata[%d] %p\n",i,common_vars->rxdata[i]);
|
||||
common_vars->common_vars_rx_data_per_thread[0].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
common_vars->common_vars_rx_data_per_thread[1].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->first_carrier_offset = 1536-600;
|
||||
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
|
||||
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
|
||||
|
||||
}
|
||||
else {
|
||||
frame_parms->ofdm_symbol_size = 2048;
|
||||
@@ -148,7 +149,6 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->N_RBGS = 2;
|
||||
frame_parms->N_RBG = 13;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 15:
|
||||
@@ -159,6 +159,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->nb_prefix_samples0>>=(3-log2_osf);
|
||||
frame_parms->N_RBGS = 2;
|
||||
frame_parms->N_RBG = 8;
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
@@ -169,6 +170,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->nb_prefix_samples0>>=(4-log2_osf);
|
||||
frame_parms->N_RBGS = 1;
|
||||
frame_parms->N_RBG = 6;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_VARS_UE *ue,
|
||||
unsigned char eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t subframe,
|
||||
unsigned char clear,
|
||||
short coef)
|
||||
|
||||
@@ -79,7 +79,7 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#ifdef DEBUG_PHY
|
||||
sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa);
|
||||
sprintf(vname,"srs_time_%d%d",ind,aa);
|
||||
write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1);
|
||||
LOG_M(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
|
||||
int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
|
||||
int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,module_id_t UE_id)
|
||||
{
|
||||
int temp, i, aa, max_pos=0, max_val=0;
|
||||
short Re,Im;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_VARS_UE *ue,
|
||||
unsigned char eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t subframe,
|
||||
unsigned char clear,
|
||||
short coef)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//#define DEBUG_BF_CH
|
||||
|
||||
int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
uint8_t eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t eNB_offset,
|
||||
unsigned char Ns,
|
||||
unsigned char p,
|
||||
@@ -81,7 +81,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
//generate ue specific pilots
|
||||
lprime = symbol/3-1;
|
||||
lte_dl_ue_spec_rx(phy_vars_ue,uespec_pilot,Ns,5,lprime,0,dlsch0_harq->nb_rb);
|
||||
//write_output("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1);
|
||||
//LOG_M("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1);
|
||||
|
||||
if (frame_parms->Ncp==0){
|
||||
if (symbol==3 || symbol==6 || symbol==9 || symbol==12)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
|
||||
int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
||||
uint8_t eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t eNB_offset,
|
||||
unsigned char Ns,
|
||||
unsigned char p,
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
//#define DEBUG_CH
|
||||
int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue,
|
||||
uint8_t eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t eNB_offset,
|
||||
int subframe,
|
||||
unsigned char l)
|
||||
|
||||
@@ -34,7 +34,7 @@ int32_t rx_power_avg_eNB[3];
|
||||
|
||||
void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
|
||||
int subframe,
|
||||
unsigned char eNB_id,
|
||||
module_id_t eNB_id,
|
||||
unsigned char clear)
|
||||
{
|
||||
|
||||
@@ -115,8 +115,8 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
|
||||
unsigned char eNB_id,
|
||||
unsigned char UE_id,
|
||||
module_id_t eNB_id,
|
||||
module_id_t UE_id,
|
||||
unsigned char init_averaging)
|
||||
{
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
|
||||
@@ -275,9 +275,9 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
|
||||
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
write_output("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
write_output("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
write_output("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
@@ -466,10 +466,10 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
if (debug_cnt == 0) {
|
||||
write_output("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
|
||||
write_output("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
|
||||
write_output("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
|
||||
write_output("rxdata0.m","rxd0",rxdata[0],length<<1,1,1);
|
||||
LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
|
||||
LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
|
||||
LOG_M("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
|
||||
LOG_M("rxdata0.m","rxd0",rxdata[0],length<<1,1,1);
|
||||
// exit(-1);
|
||||
} else {
|
||||
debug_cnt++;
|
||||
|
||||
@@ -67,7 +67,7 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
|
||||
|
||||
for (i=0; i<38400*4; i+=3072) { // steps of 200 us with 100 us overlap, 0 to 5s
|
||||
// write_output("rxsig0.m","rxs0",ue->lte_ue_common_vars.rxdata[0],30720,1,1);
|
||||
// LOG_M("rxsig0.m","rxs0",ue->lte_ue_common_vars.rxdata[0],30720,1,1);
|
||||
|
||||
//for (i = 15360-3072*2; i<15360+3072+1; i+=3072) {
|
||||
|
||||
@@ -87,9 +87,9 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
/*
|
||||
printf("i %d: sp %p\n",i,sp);
|
||||
if (i==12288) {
|
||||
write_output("scan6144F.m","s6144F",sp,6144,1,1);
|
||||
write_output("scan6144.m","s6144",rxp,6144,1,1);
|
||||
write_output("pss0_6144.m","pss0",pss6144_0_0,256,1,1);
|
||||
LOG_M("scan6144F.m","s6144F",sp,6144,1,1);
|
||||
LOG_M("scan6144.m","s6144",rxp,6144,1,1);
|
||||
LOG_M("pss0_6144.m","pss0",pss6144_0_0,256,1,1);
|
||||
}*/
|
||||
|
||||
for (f = -2000; f<2000; f++) { // this is -10MHz to 10 MHz in 5 kHz steps
|
||||
@@ -272,10 +272,10 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
if (i==12288) {
|
||||
sprintf(fname,"corr256F_%d.m",abs(f));
|
||||
sprintf(vname,"c256F_%d",abs(f));
|
||||
write_output(fname,vname,autocorr0,256,1,1);
|
||||
LOG_M(fname,vname,autocorr0,256,1,1);
|
||||
sprintf(fname,"corr256_%d.m",abs(f));
|
||||
sprintf(vname,"c256_%d",abs(f));
|
||||
write_output(fname,vname,tmp_t,256,1,1);
|
||||
LOG_M(fname,vname,tmp_t,256,1,1);
|
||||
}*/
|
||||
|
||||
memset((void*)autocorr0_t,0,256*4);
|
||||
|
||||
@@ -55,7 +55,7 @@ void print_ints(char *s,int *x)
|
||||
|
||||
}
|
||||
|
||||
int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -81,7 +81,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
}
|
||||
|
||||
|
||||
uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id)
|
||||
uint8_t get_n_adj_cells (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -92,7 +92,7 @@ uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t get_rx_total_gain_dB (uint8_t Mod_id,uint8_t CC_id)
|
||||
uint32_t get_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -102,7 +102,7 @@ uint32_t get_rx_total_gain_dB (uint8_t Mod_id,uint8_t CC_id)
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
uint32_t get_RSSI (uint8_t Mod_id,uint8_t CC_id)
|
||||
uint32_t get_RSSI (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -112,7 +112,7 @@ uint32_t get_RSSI (uint8_t Mod_id,uint8_t CC_id)
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
double get_RSRP(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
double get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
{
|
||||
|
||||
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is null\n");
|
||||
@@ -128,7 +128,7 @@ double get_RSRP(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
return -140.0;
|
||||
}
|
||||
|
||||
uint32_t get_RSRQ(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
uint32_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -139,7 +139,7 @@ uint32_t get_RSRQ(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp)
|
||||
int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -153,7 +153,7 @@ int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rs
|
||||
return -1;
|
||||
}
|
||||
|
||||
int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrq)
|
||||
int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrq)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
|
||||
@@ -37,7 +37,7 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32
|
||||
|
||||
int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
|
||||
eNB_rxtx_proc_t *proc,
|
||||
uint8_t UE_id,
|
||||
module_id_t UE_id,
|
||||
unsigned char l,
|
||||
unsigned char Ns) {
|
||||
|
||||
@@ -105,9 +105,9 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
#ifdef DEBUG_CH
|
||||
|
||||
if (Ns==0)
|
||||
write_output("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
else
|
||||
write_output("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
LOG_M("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -228,7 +228,7 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
if((cyclic_shift != 0)) {
|
||||
// Compensating for the phase shift introduced at the transmitte
|
||||
#ifdef DEBUG_CH
|
||||
write_output("drs_est_pre.m","drsest_pre",ul_ch_estimates[0],300*12,1,1);
|
||||
LOG_M("drs_est_pre.m","drsest_pre",ul_ch_estimates[0],300*12,1,1);
|
||||
#endif
|
||||
|
||||
for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) {
|
||||
@@ -251,7 +251,7 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
write_output("drs_est_post.m","drsest_post",ul_ch_estimates[0],300*12,1,1);
|
||||
LOG_M("drs_est_post.m","drsest_post",ul_ch_estimates[0],300*12,1,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -294,11 +294,11 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
|
||||
if (aa==1) {
|
||||
if (Ns == 0) {
|
||||
write_output("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1);
|
||||
write_output("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1);
|
||||
write_output("drs_est0.m","drs0",ul_ch_estimates_time[aa],512,1,1);
|
||||
LOG_M("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1);
|
||||
LOG_M("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1);
|
||||
LOG_M("drs_est0.m","drs0",ul_ch_estimates_time[aa],512,1,1);
|
||||
} else
|
||||
write_output("drs_est1.m","drs1",ul_ch_estimates_time[aa],512,1,1);
|
||||
LOG_M("drs_est1.m","drs1",ul_ch_estimates_time[aa],512,1,1);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -454,7 +454,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
&srs_vars->srs[eNB_id],
|
||||
0x7FFF,
|
||||
subframe)==-1) {
|
||||
LOG_E(PHY,"lte_srs_channel_estimation: Error in generate_srs_rx\n");
|
||||
LOG_E(PHY,"lte_srs_channel_estimation: Error in generate_srs\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -466,8 +466,8 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
srs_vars->srs_ch_estimates[aa]);
|
||||
#endif
|
||||
|
||||
//write_output("eNB_rxF.m","rxF",&common_vars->rxdataF[0][aa][2*frame_parms->ofdm_symbol_size*symbol],2*(frame_parms->ofdm_symbol_size),2,1);
|
||||
//write_output("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1);
|
||||
//LOG_M("eNB_rxF.m","rxF",&common_vars->rxdataF[0][aa][2*frame_parms->ofdm_symbol_size*symbol],2*(frame_parms->ofdm_symbol_size),2,1);
|
||||
//LOG_M("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1);
|
||||
|
||||
|
||||
mult_cpx_conj_vector((int16_t*) &common_vars->rxdataF[aa][2*frame_parms->ofdm_symbol_size*symbol],
|
||||
@@ -480,7 +480,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#ifdef DEBUG_SRS
|
||||
sprintf(fname,"srs_ch_est%d.m",aa);
|
||||
sprintf(vname,"srs_est%d",aa);
|
||||
write_output(fname,vname,srs_vars->srs_ch_estimates[aa],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M(fname,vname,srs_vars->srs_ch_estimates[aa],frame_parms->ofdm_symbol_size,1,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -256,9 +256,9 @@ int lte_dl_cell_spec_rx(PHY_VARS_UE *ue,
|
||||
|
||||
|
||||
|
||||
//extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
//extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
// flag change eren
|
||||
extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
main()
|
||||
{
|
||||
|
||||
@@ -317,10 +317,10 @@ main()
|
||||
0);
|
||||
|
||||
|
||||
write_output("dl_cell_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
write_output("dl_cell_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
write_output("dl_cell_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
write_output("dl_cell_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
LOG_M("dl_cell_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
LOG_M("dl_cell_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
LOG_M("dl_cell_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
LOG_M("dl_cell_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -317,9 +317,9 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *ue,
|
||||
|
||||
|
||||
|
||||
//extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
//extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
// flag change eren
|
||||
extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
main()
|
||||
{
|
||||
|
||||
@@ -378,10 +378,10 @@ main()
|
||||
0);
|
||||
|
||||
|
||||
write_output("dl_ue_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
write_output("dl_ue_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
write_output("dl_ue_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
write_output("dl_ue_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
LOG_M("dl_ue_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
LOG_M("dl_ue_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
LOG_M("dl_ue_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
LOG_M("dl_ue_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ N_{ID}^{cell = 0..503
|
||||
|
||||
void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell)
|
||||
{
|
||||
|
||||
unsigned char ns,l,Ncp=1-frame_parms->Ncp;
|
||||
unsigned int n,x1,x2;//,x1tmp,x2tmp;
|
||||
|
||||
@@ -54,7 +53,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
|
||||
x2 = Ncp +
|
||||
(Nid_cell<<1) +
|
||||
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
|
||||
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
|
||||
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
|
||||
//n = 0
|
||||
x1 = 1+ (1<<31);
|
||||
@@ -81,7 +80,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
}
|
||||
}
|
||||
|
||||
void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS)
|
||||
void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS)
|
||||
{
|
||||
|
||||
unsigned char ns,l;
|
||||
@@ -169,41 +168,6 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief gold sequenquence generator
|
||||
\param x1
|
||||
\param x2 this should be set to c_init if reset=1
|
||||
\param reset resets the generator
|
||||
\return 32 bits of the gold sequence
|
||||
*/
|
||||
unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char reset)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (reset) {
|
||||
*x1 = 1+ (1<<31);
|
||||
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
// printf("n=0 : x1 %x, x2 %x\n",x1,x2);
|
||||
for (n=1; n<50; n++) {
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
}
|
||||
}
|
||||
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
return(*x1^*x2);
|
||||
// printf("n=%d : c %x\n",n,x1^x2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef LTE_GOLD_MAIN
|
||||
main()
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
\param reset resets the generator
|
||||
\return 32 bits of the gold sequence
|
||||
*/
|
||||
unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char reset);
|
||||
uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
|
||||
|
||||
|
||||
/*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL reference signals.
|
||||
@@ -45,8 +45,7 @@ unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char
|
||||
@param Nid_cell Cell Id (to compute sequences for local and adjacent cells) */
|
||||
|
||||
void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell);
|
||||
|
||||
void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS);
|
||||
void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS);
|
||||
|
||||
void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti);
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
|
||||
|
||||
|
||||
static uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||
static uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||
//static uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||
//static uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||
|
||||
void dci_encoding(uint8_t *a,
|
||||
uint8_t A,
|
||||
@@ -70,6 +70,8 @@ void dci_encoding(uint8_t *a,
|
||||
|
||||
uint8_t D = (A + 16);
|
||||
uint32_t RCC;
|
||||
uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||
uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
int32_t i;
|
||||
@@ -169,7 +171,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
||||
return(e+coded_bits);
|
||||
}
|
||||
|
||||
uint32_t Y;
|
||||
//uint32_t Y;
|
||||
|
||||
|
||||
|
||||
@@ -368,16 +370,12 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
|
||||
if (dci_alloc[i].L == (uint8_t)L) {
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
if (dci_alloc[i].rnti==0x1234)
|
||||
LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
|
||||
LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",
|
||||
i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
|
||||
*(unsigned int*)dci_alloc[i].dci_pdu,
|
||||
dci_alloc[i].rnti);
|
||||
dump_dci(frame_parms,&dci_alloc[i]);
|
||||
#endif
|
||||
|
||||
if (dci_alloc[i].firstCCE>=0) {
|
||||
//printf("generate DCI .%d rnti %d length %d\n", subframe, dci_alloc[i].rnti, dci_alloc[i].dci_length);
|
||||
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
|
||||
e+(72*dci_alloc[i].firstCCE),
|
||||
dci_alloc[i].dci_length,
|
||||
|
||||
@@ -48,10 +48,10 @@
|
||||
#include "dci_tools_common_extern.h"
|
||||
#include "transport_proto.h"
|
||||
|
||||
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
{
|
||||
uint8_t i;
|
||||
int8_t first_free_index=-1;
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(eNB!=NULL,"eNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
@@ -68,10 +68,10 @@ int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
return first_free_index;
|
||||
}
|
||||
|
||||
int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
{
|
||||
uint8_t i;
|
||||
int8_t first_free_index=-1;
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(eNB!=NULL,"eNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
@@ -265,8 +265,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
if ((rel8->rnti_type == 2 ) && (rel8->rnti != SI_RNTI) && (rel8->rnti != P_RNTI)) dci_alloc->ra_flag = 1;
|
||||
|
||||
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){
|
||||
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id);
|
||||
return;
|
||||
}
|
||||
//AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
//AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
dlsch0 = eNB->dlsch[UE_id][0];
|
||||
dlsch1 = eNB->dlsch[UE_id][1];
|
||||
|
||||
@@ -298,7 +302,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
}
|
||||
dlsch0_harq->ndi = rel8->new_data_indicator_1;
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
if (rel8->rnti_type == 2)
|
||||
dlsch0_harq->round = 0;
|
||||
|
||||
@@ -475,10 +483,14 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
dlsch0_harq->mcs = rel8->mcs_1;
|
||||
dlsch0_harq->Qm = 2;
|
||||
dlsch0_harq->TBS = TBStable[I_mcs][NPRB-1];
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
dlsch0->rnti = rel8->rnti;
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
//dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
if (dlsch0_harq->round == 0)
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
|
||||
@@ -490,7 +502,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
case NFAPI_DL_DCI_FORMAT_1:
|
||||
|
||||
dci_alloc->format = format1;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
|
||||
LOG_D(PHY,"SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: Programming DLSCH for Format 1 DCI, harq_pid %d\n",frame,subframe,proc->frame_tx,subframe,rel8->harq_process);
|
||||
|
||||
@@ -635,7 +651,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
|
||||
dlsch0_harq->dl_power_off = 1;
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -651,7 +671,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
}
|
||||
|
||||
LOG_D(PHY,"DCI: Set harq_ids[%d] to %d (%p)\n",subframe,rel8->harq_process,dlsch0);
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
|
||||
@@ -818,8 +838,8 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
|
||||
dlsch0->subframe_tx[subframe] = 1;
|
||||
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch1->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
// printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe);
|
||||
|
||||
|
||||
@@ -846,19 +866,32 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
// assume both TBs are active
|
||||
dlsch0_harq->Nl = 1;
|
||||
dlsch1_harq->Nl = 1;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
|
||||
// check if either TB is disabled (see 36-213 V11.3 Section )
|
||||
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 0;
|
||||
#else
|
||||
dlsch0->active = 0;
|
||||
#endif
|
||||
dlsch0->harq_mask &= ~(1<<rel8->harq_process);
|
||||
}
|
||||
|
||||
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch1->active[subframe]= 0;
|
||||
#else
|
||||
dlsch1->active = 0;
|
||||
#endif
|
||||
dlsch1->harq_mask &= ~(1<<rel8->harq_process);
|
||||
}
|
||||
|
||||
@@ -870,8 +903,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
|
||||
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1];
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
|
||||
#else
|
||||
if ((dlsch0->active==1) && (dlsch1->active==1)) {
|
||||
|
||||
#endif
|
||||
dlsch0_harq->mimo_mode = LARGE_CDD;
|
||||
dlsch1_harq->mimo_mode = LARGE_CDD;
|
||||
dlsch0_harq->dl_power_off = 1;
|
||||
@@ -881,7 +917,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
dlsch1_harq->mimo_mode = ALAMOUTI;
|
||||
}
|
||||
} else if (fp->nb_antenna_ports_eNB == 4) { // 4 antenna case
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
|
||||
#else
|
||||
if ((dlsch0->active==1) && (dlsch1->active==1)) {
|
||||
#endif
|
||||
switch (rel8->precoding_information) {
|
||||
case 0: // one layer per transport block
|
||||
dlsch0_harq->mimo_mode = LARGE_CDD;
|
||||
@@ -921,7 +961,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
LOG_E(PHY,"Illegal value (3) for TPMI in Format 2A DCI\n");
|
||||
break;
|
||||
}
|
||||
#ifdef PHY_TX_THREAD
|
||||
} else if (dlsch0->active[subframe] == 1) {
|
||||
#else
|
||||
} else if (dlsch0->active == 1) {
|
||||
#endif
|
||||
switch (rel8->precoding_information) {
|
||||
case 0: // one layer per transport block
|
||||
dlsch0_harq->mimo_mode = ALAMOUTI;
|
||||
@@ -941,7 +985,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",rel8->precoding_information);
|
||||
break;
|
||||
}
|
||||
#ifdef PHY_TX_THREAD
|
||||
} else if (dlsch1->active[subframe] == 1) {
|
||||
#else
|
||||
} else if (dlsch1->active == 1) {
|
||||
#endif
|
||||
switch (rel8->precoding_information) {
|
||||
case 0: // one layer per transport block
|
||||
dlsch0_harq->mimo_mode = ALAMOUTI;
|
||||
@@ -967,10 +1015,18 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
}
|
||||
|
||||
// reset HARQ process if this is the first transmission
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch0->active[subframe]==1) && (dlsch0_harq->round == 0))
|
||||
#else
|
||||
if ((dlsch0->active==1) && (dlsch0_harq->round == 0))
|
||||
#endif
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch1->active[subframe]==1) && (dlsch1_harq->round == 0))
|
||||
#else
|
||||
if ((dlsch1->active==1) && (dlsch1_harq->round == 0))
|
||||
#endif
|
||||
dlsch1_harq->status = ACTIVE;
|
||||
|
||||
dlsch0->rnti = rel8->rnti;
|
||||
@@ -1144,8 +1200,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
printf("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rel8->redundancy_version_1, rel8->redundancy_version_2, rel8->mcs_1, rel8->mcs_2);
|
||||
#endif
|
||||
if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==0) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch0_harq = dlsch0->harq_processes[rel8->harq_process];
|
||||
@@ -1167,8 +1228,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
else if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==1) {
|
||||
dlsch0 = eNB->dlsch[UE_id][1];
|
||||
dlsch1 = eNB->dlsch[UE_id][0];
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
@@ -1186,7 +1252,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
dlsch1_harq->codeword=0;
|
||||
}
|
||||
else if (TB0_active && (TB1_active==0)) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch0_harq = dlsch0->harq_processes[rel8->harq_process];
|
||||
dlsch0_harq->mcs = rel8->mcs_1;
|
||||
@@ -1201,7 +1271,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
#endif
|
||||
}
|
||||
else if ((TB0_active==0) && TB1_active) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1_harq = dlsch1->harq_processes[rel8->harq_process];
|
||||
dlsch1_harq->mcs = rel8->mcs_2;
|
||||
@@ -1219,11 +1293,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
|
||||
if (dlsch0 != NULL){
|
||||
dlsch0->subframe_tx[subframe] = 1;
|
||||
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
}
|
||||
|
||||
if (dlsch1_harq != NULL){
|
||||
dlsch1->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
}
|
||||
|
||||
|
||||
@@ -1434,6 +1508,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL;
|
||||
int UE_id;
|
||||
int subframe = proc->subframe_tx;
|
||||
int frame = proc->frame_tx;
|
||||
|
||||
dci_alloc->firstCCE = rel13->ecce_index;
|
||||
dci_alloc->L = rel13->aggregation_level;
|
||||
@@ -1452,8 +1527,12 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
if (rel13->rnti_type == 2 ) dci_alloc->ra_flag = 1;
|
||||
|
||||
UE_id = find_dlsch(rel13->rnti,eNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){
|
||||
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel13->rnti,UE_id);
|
||||
return;
|
||||
}
|
||||
//AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
//AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
dlsch0 = eNB->dlsch[UE_id][0];
|
||||
dlsch0_harq = dlsch0->harq_processes[rel13->harq_process];
|
||||
|
||||
@@ -1465,7 +1544,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
|
||||
case 10: // Format 6-1A
|
||||
dci_alloc->format = format6_1A;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
switch (fp->N_RB_DL) {
|
||||
|
||||
case 25:
|
||||
@@ -1521,7 +1604,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
break;
|
||||
case 11: // Format 6-1B
|
||||
dci_alloc->format = format6_1B;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
switch (fp->N_RB_DL) {
|
||||
|
||||
case 25:
|
||||
@@ -1564,7 +1651,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
}
|
||||
case 12: // Format 6-2
|
||||
dci_alloc->format = format6_2;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
switch (fp->N_RB_DL) {
|
||||
case 25:
|
||||
dci_alloc->dci_length = sizeof_DCI6_2_5MHz_t;
|
||||
@@ -1647,8 +1738,12 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
//LOG_E(PHY,"Invalid beamforming mode %dL\n", beamforming_mode);
|
||||
|
||||
dlsch0_harq->dl_power_off = 1;
|
||||
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel13->harq_process);
|
||||
|
||||
|
||||
@@ -1661,7 +1756,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
|
||||
}
|
||||
|
||||
dlsch0->harq_ids[subframe] = rel13->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel13->harq_process;
|
||||
|
||||
|
||||
|
||||
@@ -1692,6 +1787,8 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
|
||||
|
||||
uint32_t ndi = pdu->dci_pdu_rel8.new_data_indication_1;
|
||||
|
||||
uint16_t UE_id = -1;
|
||||
|
||||
#ifdef T_TRACER
|
||||
T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
|
||||
T_INT(pdu->dci_pdu_rel8.rnti), T_INT(((frame*10+subframe+4) % 8) /* TODO: correct harq pid */),
|
||||
@@ -1837,16 +1934,23 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
|
||||
DevParam (frame_parms->N_RB_DL, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if(frame_parms->frame_type == TDD){
|
||||
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE);
|
||||
if(UE_id != -1){
|
||||
eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe)
|
||||
void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe)
|
||||
{
|
||||
uint8_t harq_pid;
|
||||
uint8_t UE_id;
|
||||
//uint8_t UE_id;
|
||||
boolean_t new_ulsch = (find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST)==-1) ? TRUE : FALSE;
|
||||
|
||||
AssertFatal((UE_id=find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
|
||||
"No existing/free UE ULSCH for rnti %x\n",ulsch_pdu->ulsch_pdu_rel8.rnti);
|
||||
//AssertFatal((UE_id=find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
|
||||
// "No existing/free UE ULSCH for rnti %x\n",ulsch_pdu->ulsch_pdu_rel8.rnti);
|
||||
|
||||
LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id];
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
@@ -1864,7 +1968,10 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
|
||||
ulsch->harq_processes[harq_pid]->first_rb = ulsch_pdu->ulsch_pdu_rel8.resource_block_start;
|
||||
ulsch->harq_processes[harq_pid]->nb_rb = ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
|
||||
|
||||
AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n");
|
||||
//AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n");
|
||||
if(ulsch->harq_processes[harq_pid]->nb_rb == 0){
|
||||
LOG_E(PHY, "fill_ulsch UE_id %d nb_rb = 0\n", UE_id);
|
||||
}
|
||||
|
||||
ulsch->harq_processes[harq_pid]->dci_alloc = 1;
|
||||
ulsch->harq_processes[harq_pid]->rar_alloc = 0;
|
||||
@@ -1891,14 +1998,16 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
|
||||
else if(ulsch->harq_processes[harq_pid]->n_DMRS == 7)
|
||||
ulsch->harq_processes[harq_pid]->n_DMRS2 = 9;
|
||||
|
||||
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d\n",
|
||||
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d ulsch_pdu->ulsch_pdu_rel8.size %d\n",
|
||||
eNB->Mod_id,harq_pid,frame,subframe,
|
||||
ulsch->harq_processes[harq_pid]->n_DMRS2,
|
||||
ulsch->harq_processes[harq_pid]->n_DMRS,
|
||||
ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status,
|
||||
ulsch_pdu->ulsch_pdu_rel8.redundancy_version);
|
||||
ulsch_pdu->ulsch_pdu_rel8.redundancy_version,
|
||||
ulsch_pdu->ulsch_pdu_rel8.size);
|
||||
|
||||
ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version;
|
||||
if(ulsch_pdu->ulsch_pdu_rel8.modulation_type!=0)
|
||||
ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type;
|
||||
// Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be
|
||||
ulsch->harq_processes[harq_pid]->O_ACK = 0;
|
||||
@@ -1919,9 +2028,12 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
|
||||
// will be set if MAC has activated ULSCH_CQI_RI_PDU or ULSCH_CQI_HARQ_RI_PDU
|
||||
ulsch->harq_processes[harq_pid]->Or1 = 0;
|
||||
ulsch->harq_processes[harq_pid]->Or2 = 0;
|
||||
}
|
||||
else ulsch->harq_processes[harq_pid]->round++;
|
||||
|
||||
}
|
||||
else {
|
||||
ulsch->harq_processes[harq_pid]->round++;
|
||||
ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3;
|
||||
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
|
||||
}
|
||||
ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
|
||||
LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
|
||||
ulsch->rnti,
|
||||
|
||||
@@ -165,49 +165,6 @@ int8_t delta_PUSCH_acc[4] = {-1,0,1,3};
|
||||
|
||||
int8_t *delta_PUCCH_lut = delta_PUSCH_acc;
|
||||
|
||||
uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
|
||||
{
|
||||
/*
|
||||
MIMO_mode_t mode = dlsch_harq->mimo_mode;
|
||||
uint32_t pmi_alloc = dlsch_harq->pmi_alloc;
|
||||
*/
|
||||
|
||||
switch (N_RB_DL) {
|
||||
case 6: // 1 PRB per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>(rb<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>rb)&1);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
case 25: // 4 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>2)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>2))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 50: // 6 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb/6)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb/6))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 100: // 8 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>3)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>3))&1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t lprime,uint8_t mi)
|
||||
{
|
||||
|
||||
@@ -330,7 +287,7 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
|
||||
uint32_t N_RB_DL,
|
||||
uint32_t *rb_alloc) {
|
||||
|
||||
|
||||
|
||||
int narrowband = resource_block_coding>>5;
|
||||
int RIV = resource_block_coding&31;
|
||||
int N_NB_DL = N_RB_DL/6;
|
||||
@@ -346,7 +303,7 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
|
||||
rb_alloc[2] = 0;
|
||||
rb_alloc[3] = 0;
|
||||
rb_alloc[ind] = alloc<<ind_mod;
|
||||
if (ind_mod > 26) rb_alloc[ind+1] = alloc>>(6-(ind_mod-26));
|
||||
if (ind_mod > 26) rb_alloc[ind+1] = alloc>>(6-(ind_mod-26));
|
||||
}
|
||||
|
||||
void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2)
|
||||
@@ -410,7 +367,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
|
||||
// bit mask across
|
||||
if ((rb_alloc2[0]>>31)==1)
|
||||
rb_alloc2[1] |= 1;
|
||||
|
||||
|
||||
if ((rb_alloc&1) != 0)
|
||||
rb_alloc2[1] |= (3<<16);
|
||||
break;
|
||||
@@ -420,7 +377,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
|
||||
for (i=0; i<25; i++) {
|
||||
if ((rb_alloc&(1<<(24-i))) != 0)
|
||||
rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32));
|
||||
|
||||
|
||||
// printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i));
|
||||
}
|
||||
|
||||
@@ -979,28 +936,23 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
|
||||
} else {
|
||||
|
||||
switch (frame_parms->tdd_config) {
|
||||
|
||||
case 1:
|
||||
if ((subframe==2) ||
|
||||
(subframe==3) ||
|
||||
(subframe==7) ||
|
||||
(subframe==8))
|
||||
switch (subframe) {
|
||||
case 2:
|
||||
case 3:
|
||||
ret = (subframe-2);
|
||||
break;
|
||||
switch (subframe) {
|
||||
case 2:
|
||||
case 3:
|
||||
ret = (subframe-2);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
ret = (subframe-5);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
ret = (subframe-5);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
|
||||
ret = (255);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
|
||||
ret = (255);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -1052,10 +1004,13 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
uint8_t ul_subframe = 255;
|
||||
|
||||
if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1) &&
|
||||
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5
|
||||
ul_subframe = ((n+6)%10);
|
||||
else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1)) {
|
||||
if ((n==1)||(n==6)) { // tdd_config 0,1 SF 1,5
|
||||
ul_subframe = ((n+6)%10);
|
||||
} else if ((n==4)||(n==9)) {
|
||||
ul_subframe = ((n+4)%10);
|
||||
}
|
||||
} else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
((n==0)||(n==1)||(n==5)||(n==6)))
|
||||
ul_subframe = ((n+7)%10);
|
||||
@@ -1063,10 +1018,10 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
(n==9)) // tdd_config 6 SF 9
|
||||
ul_subframe = ((n+5)%10);
|
||||
else
|
||||
else
|
||||
ul_subframe = ((n+4)%10);
|
||||
|
||||
AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n);
|
||||
if ( (subframe_select(frame_parms,ul_subframe) != SF_UL) && (frame_parms->frame_type == TDD)) return(255);
|
||||
|
||||
LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe);
|
||||
return ul_subframe;
|
||||
@@ -1075,10 +1030,13 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
{
|
||||
if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1) &&
|
||||
((n==7)||(n==2))) // tdd_config 0,1 SF 1,5
|
||||
return((n==7)? 1 : 6);
|
||||
else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1)) {
|
||||
if ((n==7)||(n==2)) { // tdd_config 0,1 SF 1,5
|
||||
return((n==7)? 1 : 6);
|
||||
} else if ((n==3)||(n==8)) {
|
||||
return((n==3)? 9 : 4);
|
||||
}
|
||||
} else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
((n==7)||(n==8)||(n==2)||(n==3)))
|
||||
return((n+3)%10);
|
||||
@@ -1088,6 +1046,9 @@ uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t
|
||||
return(9);
|
||||
else
|
||||
return((n+6)%10);
|
||||
|
||||
LOG_E(PHY, "%s %s:%i pdcch allocation error\n",__FUNCTION__,__FILE__,__LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n)
|
||||
@@ -1096,9 +1057,9 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
|
||||
|
||||
if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1) &&
|
||||
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5
|
||||
ul_frame = (frame + (n==1 ? 0 : 1));
|
||||
else if ((frame_parms->frame_type == TDD) &&
|
||||
((n==1)||(n==6)||(n==4)||(n==9))) { // tdd_config 0,1 SF 1,5
|
||||
ul_frame = (frame + (n < 5 ? 0 : 1));
|
||||
} else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
((n==0)||(n==1)||(n==5)||(n==6)))
|
||||
ul_frame = (frame + (n>=5 ? 1 : 0));
|
||||
|
||||
@@ -148,8 +148,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
||||
|
||||
}*/
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->harq_ids[i] = Mdlharq;
|
||||
for (i=0; i<20; i++)
|
||||
dlsch->harq_ids[i/10][i%10] = Mdlharq;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
|
||||
@@ -227,11 +227,16 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
||||
if (dlsch) {
|
||||
Mdlharq = dlsch->Mdlharq;
|
||||
dlsch->rnti = 0;
|
||||
#ifdef PHY_TX_THREAD
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->active[i] = 0;
|
||||
#else
|
||||
dlsch->active = 0;
|
||||
#endif
|
||||
dlsch->harq_mask = 0;
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->harq_ids[i] = Mdlharq;
|
||||
for (i=0; i<20; i++)
|
||||
dlsch->harq_ids[i/10][i%10] = Mdlharq;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
if (dlsch->harq_processes[i]) {
|
||||
@@ -260,8 +265,6 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
||||
unsigned int total_worker = tep->total_worker;
|
||||
unsigned int current_worker = tep->current_worker;
|
||||
|
||||
unsigned short iind;
|
||||
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||
@@ -280,28 +283,10 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
dlsch->harq_processes[harq_pid]->RTC[r] =
|
||||
sub_block_interleaving_turbo(4+(Kr_bytes*8),
|
||||
@@ -411,9 +396,12 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
eNB_proc_t *proc = &eNB->proc;
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
unsigned short iind;
|
||||
|
||||
unsigned char harq_pid = dlsch->harq_ids[subframe];
|
||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||
if(harq_pid >= dlsch->Mdlharq) {
|
||||
LOG_E(PHY,"dlsch_encoding_2threads illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int A;
|
||||
unsigned char mod_order;
|
||||
@@ -496,28 +484,11 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
|
||||
@@ -628,7 +599,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
|
||||
{
|
||||
int encoding_return = 0;
|
||||
unsigned int L,C,B;
|
||||
B = dlsch->harq_processes[dlsch->harq_ids[subframe]]->B;
|
||||
B = dlsch->harq_processes[dlsch->harq_ids[frame%2][subframe]]->B;
|
||||
if(B<=6144)
|
||||
{
|
||||
L=0;
|
||||
@@ -643,7 +614,6 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
|
||||
C = C+1;
|
||||
}
|
||||
}
|
||||
//LOG_I(PHY,"segmentation number C = %d\n", C);////////////********added
|
||||
|
||||
if(C >= 8 && get_nprocs()>=16 && codingw)//one main three worker
|
||||
{
|
||||
@@ -729,10 +699,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
unsigned short iind;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
unsigned char harq_pid = dlsch->harq_ids[subframe];
|
||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||
if(harq_pid >= dlsch->Mdlharq) {
|
||||
LOG_E(PHY,"dlsch_encoding illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int A;
|
||||
unsigned char mod_order;
|
||||
@@ -800,21 +773,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
||||
// generate codewords
|
||||
@@ -826,22 +784,17 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
|
||||
#endif
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==0)
|
||||
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
LOG_M("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
|
||||
#endif
|
||||
start_meas(i_stats);
|
||||
@@ -888,7 +841,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==dlsch->harq_processes[harq_pid]->C-1)
|
||||
write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
|
||||
LOG_M("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user