Merge branch 'bugfix-48-L1L2signaling' of https://gitlab.eurecom.fr/oai/openairinterface5g into bugfix-48-L1L2signaling
This commit is contained in:
+3
-2
@@ -8,6 +8,7 @@ job1:
|
||||
- echo $EXTERNAL_SHARE_DIR
|
||||
- echo $SHELL
|
||||
- git rev-parse --abbrev-ref HEAD
|
||||
- git_repo=`git config --get remote.origin.url`
|
||||
- git_head=`git rev-parse HEAD`
|
||||
- echo $git_head
|
||||
- tmp=`git show-ref --head | grep $git_head`
|
||||
@@ -23,8 +24,8 @@ job1:
|
||||
- echo $NRUNS_LTE_SOFTMODEM
|
||||
- echo $TIMEOUT_CMD
|
||||
- mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
|
||||
- python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -c -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS $OAI_EXTRA_ARGS -g "$OAI_TEST_CASE_GROUP">& $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log
|
||||
- python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -r -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS `echo $OAI_EXTRA_ARGS` -g "$OAI_TEST_CASE_GROUP" --nrun_lte_softmodem $NRUNS_LTE_SOFTMODEM --timeout_cmd $TIMEOUT_CMD >& $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log
|
||||
- python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -c -5GRepo $git_repo -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS $OAI_EXTRA_ARGS -g "$OAI_TEST_CASE_GROUP">& $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log
|
||||
- python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -r -5GRepo $git_repo -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS `echo $OAI_EXTRA_ARGS` -g "$OAI_TEST_CASE_GROUP" --nrun_lte_softmodem $NRUNS_LTE_SOFTMODEM --timeout_cmd $TIMEOUT_CMD >& $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log
|
||||
- mv $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest.log
|
||||
- mv $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest_cleanup.log
|
||||
- sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $NFS_TEST_RESULTS_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$NFS_TEST_RESULTS_DIR
|
||||
|
||||
@@ -174,44 +174,67 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${OPENAIR_
|
||||
# these changes are related to hardcoded path to include .h files
|
||||
add_definitions(-DCMAKER)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O3")
|
||||
|
||||
|
||||
set(GIT_BRANCH "UNKNOWN")
|
||||
set(GIT_COMMIT_HASH "UNKNOWN")
|
||||
set(GIT_COMMIT_DATE "UNKNOWN")
|
||||
|
||||
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
message("git found: ${GIT_EXECUTABLE}")
|
||||
# Get the current working branch
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Get the latest abbreviated commit hash of the working branch
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%h
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Get the latest commit date of the working branch
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%cd
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
Message("RF_BOARD is ${RF_BOARD}")
|
||||
# Below has been put in comment because does not work with
|
||||
# SVN authentication.
|
||||
#
|
||||
#find_package(Subversion)
|
||||
#if(SUBVERSION_FOUND)
|
||||
# Subversion_WC_INFO(${OPENAIR_DIR} openair)
|
||||
# set (FIRMWARE_VERSION "${openair_WC_REVISION} - ${openair_WC_LAST_CHANGED_DATE}")
|
||||
# Subversion_WC_LOG(${OPENAIR_DIR} Project)
|
||||
#else()
|
||||
# set (FIRMWARE_VERSION "No svn information")
|
||||
#endif()
|
||||
#add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
|
||||
|
||||
# Below is a hard-coded info
|
||||
set (FIRMWARE_VERSION "No svn information")
|
||||
add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
|
||||
add_definitions("-DPACKAGE_VERSION=\"${FIRMWARE_VERSION}\"")
|
||||
add_definitions("-DPACKAGE_BUGREPORT=\"OpenAirInterface web site\"")
|
||||
add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"")
|
||||
add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
|
||||
|
||||
|
||||
|
||||
# Debug related options
|
||||
#########################################
|
||||
add_boolean_option(MSG_PRINT False "print debug messages")
|
||||
add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
|
||||
add_boolean_option(XER_PRINT False "print XER Format")
|
||||
add_boolean_option(RRC_MSG_PRINT False "print RRC messages")
|
||||
add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages to /tmp/pdcp.log")
|
||||
add_boolean_option(DEBUG_PDCP_PAYLOAD False "print PDCP PDU to stdout") # if true, make sure that global and PDCP log levels are trace
|
||||
add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug")
|
||||
add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug")
|
||||
add_boolean_option(MSG_PRINT False "print debug messages")
|
||||
add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
|
||||
add_boolean_option(XER_PRINT False "print XER Format")
|
||||
add_boolean_option(RRC_MSG_PRINT False "print RRC messages")
|
||||
add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages to /tmp/pdcp.log")
|
||||
add_boolean_option(DEBUG_PDCP_PAYLOAD False "print PDCP PDU to stdout") # if true, make sure that global and PDCP log levels are trace
|
||||
add_boolean_option(DEBUG_MAC_INTERFACE False "print MAC-RLC PDU exchange to stdout") # if true, make sure that global and PDCP log levels are trace
|
||||
add_boolean_option(TRACE_RLC_PAYLOAD False "print RLC PDU to stdout") # if true, make sure that global and PDCP log levels are trace
|
||||
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(TRACE_RLC_PAYLOAD False "print RLC PDU to stdout") # if true, make sure that global and PDCP log levels are trace
|
||||
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(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
|
||||
|
||||
@@ -322,6 +345,7 @@ 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)
|
||||
@@ -925,6 +949,7 @@ set(PHY_SRC
|
||||
${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/rate_matching.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/viterbi.c
|
||||
@@ -1086,7 +1111,6 @@ add_library(CN_UTILS
|
||||
${OPENAIR3_DIR}/UTILS/conversions.c
|
||||
${OPENAIR3_DIR}/UTILS/enum_string.c
|
||||
${OPENAIR3_DIR}/UTILS/log.c
|
||||
${OPENAIR3_DIR}/UTILS/mme_config.c
|
||||
${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c
|
||||
)
|
||||
|
||||
@@ -1427,6 +1451,9 @@ include(FindPkgConfig)
|
||||
pkg_search_module(LIBXML2 libxml-2.0 REQUIRED)
|
||||
include_directories(${LIBXML2_INCLUDE_DIRS})
|
||||
|
||||
pkg_search_module(LIBXSLT libxslt REQUIRED)
|
||||
include_directories(${LIBXSLT_INCLUDE_DIRS})
|
||||
|
||||
pkg_search_module(OPENSSL openssl REQUIRED)
|
||||
include_directories(${OPENSSL_INCLUDE_DIRS})
|
||||
|
||||
@@ -1718,6 +1745,7 @@ endforeach(myExe)
|
||||
|
||||
add_executable(test_epc_generate_scenario
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.h
|
||||
${OPENAIR2_DIR}/ENB_APP/enb_config.h
|
||||
${OPENAIR2_DIR}/COMMON/commonDef.h
|
||||
${OPENAIR2_DIR}/COMMON/messages_def.h
|
||||
@@ -1726,7 +1754,28 @@ add_executable(test_epc_generate_scenario
|
||||
${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 ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
|
||||
-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}
|
||||
)
|
||||
|
||||
add_executable(test_epc_play_scenario
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_decode.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_display.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_fsm.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_parse.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_sctp.c
|
||||
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h
|
||||
${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
|
||||
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -171,6 +171,41 @@ Obj.# Case# Test# Description
|
||||
01 65 04 Band 7 FDD 10MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 65 05 Band 7 FDD 20MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
|
||||
|
||||
01 70 00 lte-softmodem tests with SoDeRa RF as eNB and ALU EPC w/ Bandrich COTS UE for TX/1RX
|
||||
01 70 00 Band 7 FDD 5MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 70 01 Band 7 FDD 10MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 70 02 Band 7 FDD 20MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 70 03 Band 7 FDD 5MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 70 04 Band 7 FDD 10MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 70 05 Band 7 FDD 20MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
|
||||
|
||||
01 75 00 lte-softmodem + RRH tests with B210 RF as eNB and ALU EPC w/ Bandrich COTS UE for TX/1RX
|
||||
01 75 00 Band 7 FDD 5MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 75 01 Band 7 FDD 10MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 75 02 Band 7 FDD 20MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 75 03 Band 7 FDD 5MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 75 04 Band 7 FDD 10MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 75 05 Band 7 FDD 20MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
|
||||
01 80 00 lte-softmodem + RRH tests with BladeRF RF as eNB and ALU EPC w/ Bandrich COTS UE for TX/1RX
|
||||
01 80 00 Band 7 FDD 5MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 80 01 Band 7 FDD 10MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 80 02 Band 7 FDD 20MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 80 03 Band 7 FDD 5MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 80 04 Band 7 FDD 10MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 80 05 Band 7 FDD 20MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
|
||||
01 85 00 lte-softmodem + RRH tests with USRP X310 RF as eNB and ALU EPC w/ Bandrich COTS UE for TX/1RX
|
||||
01 85 00 Band 7 FDD 5MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 85 01 Band 7 FDD 10MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 85 02 Band 7 FDD 20MHz UL Throughput for 300 sec for 1TX/1RX
|
||||
01 85 03 Band 7 FDD 5MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 85 04 Band 7 FDD 10MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
01 85 05 Band 7 FDD 20MHz DL Throughput for 300 sec for 1TX/1RX
|
||||
|
||||
|
||||
01 64 lte-softmodem-noS1 tests
|
||||
|
||||
02 Functional test case
|
||||
|
||||
@@ -12,7 +12,7 @@ trap handle_ctrl_c INT
|
||||
source $OPENAIR_DIR/cmake_targets/tools/test_helper
|
||||
|
||||
|
||||
#SUDO="sudo -E "
|
||||
SUDO="sudo -E -S"
|
||||
tdir=$OPENAIR_DIR/cmake_targets/autotests
|
||||
rm -fr $tdir/bin
|
||||
mkdir -p $tdir/bin
|
||||
@@ -404,14 +404,12 @@ until [ -z "$1" ]
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$SET_PASSWORD" == "1" ]; then
|
||||
mypassword=$passwd
|
||||
else
|
||||
read -s -p "Enter Password: " mypassword
|
||||
if [ "$SET_PASSWORD" != "1" ]; then
|
||||
read -s -p "Enter Password: " passwd
|
||||
fi
|
||||
|
||||
tmpfile=`mktemp`
|
||||
echo \'$passwd\' | $SUDO echo $HOME >& $tmpfile
|
||||
echo $passwd | $SUDO echo $HOME > $tmpfile
|
||||
tstsudo=`cat $tmpfile`
|
||||
if [ "$tstsudo" != "$HOME" ]; then
|
||||
echo "$USER might not have sudo privileges. Exiting"
|
||||
@@ -509,7 +507,7 @@ for search_expr in "${test_case_array[@]}"
|
||||
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"
|
||||
elif [ "$class" == "execution" ]; then
|
||||
$SUDO killall -q oaisim_nos1
|
||||
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"
|
||||
else
|
||||
echo "Unexpected class of test case...Skipping the test case $name ...."
|
||||
|
||||
@@ -216,7 +216,7 @@ def sftp_module (username, password, hostname, ports, paramList,logfile):
|
||||
# \brief bash script stub put at the end of scripts to terminate it
|
||||
# \param timeout_cmd terminate script after timeout_cmd seconds
|
||||
# \param terminate_missing_procs if True terminate all the processes launched by script if one of them terminates prematurely (due to error)
|
||||
def finalize_deploy_script (timeout_cmd, terminate_missing_procs='True'):
|
||||
def finalize_deploy_script (timeout_cmd, terminate_missing_procs='False'):
|
||||
cmd = 'declare -i timeout_cmd='+str(timeout_cmd) + '\n'
|
||||
if terminate_missing_procs == 'True':
|
||||
cmd = cmd + """
|
||||
@@ -571,6 +571,17 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
nruns = nruns_lte_softmodem
|
||||
nruns = int(float(nruns))
|
||||
tags = testcase.findtext('tags',default='')
|
||||
|
||||
RRHMachine = testcase.findtext('RRH',default='')
|
||||
RRH_compile_prog = testcase.findtext('RRH_compile_prog',default='')
|
||||
RRH_compile_prog_args = testcase.findtext('RRH_compile_prog_args',default='')
|
||||
RRH_pre_exec = testcase.findtext('RRH_pre_exec',default='')
|
||||
RRH_pre_exec_args = testcase.findtext('RRH_pre_exec_args',default='')
|
||||
RRH_main_exec = testcase.findtext('RRH_main_exec',default='')
|
||||
RRH_main_exec_args = testcase.findtext('RRH_main_exec_args',default='')
|
||||
RRH_terminate_missing_procs = testcase.findtext('RRH_terminate_missing_procs',default='True')
|
||||
|
||||
|
||||
eNBMachine = testcase.findtext('eNB',default='')
|
||||
eNB_config_file = testcase.findtext('eNB_config_file',default='')
|
||||
eNB_compile_prog = testcase.findtext('eNB_compile_prog',default='')
|
||||
@@ -635,13 +646,15 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
oai_EPC = openair('localdomain', EPCMachine)
|
||||
oai_EPC.connect(user, password)
|
||||
res = oai_eNB.send_recv(cmd)
|
||||
|
||||
if RRHMachine != '':
|
||||
cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep OPENAIR'
|
||||
index_RRHMachine = MachineList.index(RRHMachine)
|
||||
oai_RRH = openair('localdomain', RRHMachine)
|
||||
oai_RRH.connect(user, password)
|
||||
res= oai_RRH.send_recv(cmd)
|
||||
#cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
#cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
#cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename
|
||||
logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename
|
||||
logdir_EPC = logdirOpenaircnRepo+'/TEST/autotests/log/'+ testcasename
|
||||
logdir_local = os.environ.get('OPENAIR_DIR')
|
||||
if logdir_local is None:
|
||||
print "Environment variable OPENAIR_DIR not set correctly"
|
||||
@@ -667,10 +680,14 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
run_result=1
|
||||
run_result_string=''
|
||||
logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run)
|
||||
logdir_RRH = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run)
|
||||
logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run)
|
||||
logdir_EPC = logdirOpenaircnRepo+'/TEST/autotests/log/'+ testcasename + '/run_' + str(run)
|
||||
logdir_local_testcase = logdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run)
|
||||
#Make the log directory of test case
|
||||
if RRHMachine != '':
|
||||
cmd = 'rm -fr ' + logdir_RRH + ' ; mkdir -p ' + logdir_RRH
|
||||
result = oai_RRH.send_recv(cmd)
|
||||
cmd = 'rm -fr ' + logdir_eNB + ' ; mkdir -p ' + logdir_eNB
|
||||
result = oai_eNB.send_recv(cmd)
|
||||
cmd = 'rm -fr ' + logdir_UE + ' ; mkdir -p ' + logdir_UE
|
||||
@@ -679,6 +696,39 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
result = oai_EPC.send_recv(cmd)
|
||||
cmd = ' rm -fr ' + logdir_local_testcase + ' ; mkdir -p ' + logdir_local_testcase
|
||||
result = os.system(cmd)
|
||||
|
||||
if RRHMachine != '':
|
||||
logfile_compile_RRH = logdir_RRH + '/RRH_compile' + '_' + str(run) + '_.log'
|
||||
logfile_exec_RRH = logdir_RRH + '/RRH_exec' + '_' + str(run) + '_.log'
|
||||
logfile_pre_exec_RRH = logdir_RRH + '/RRH_pre_exec' + '_' + str(run) + '_.log'
|
||||
logfile_task_RRH_compile_out = logdir_RRH + '/RRH_task_compile_out' + '_' + str(run) + '_.log'
|
||||
logfile_task_RRH_compile = logdir_local_testcase + '/RRH_task_compile' + '_' + str(run) + '_.log'
|
||||
logfile_task_RRH_out = logdir_RRH + '/RRH_task_out' + '_' + str(run) + '_.log'
|
||||
logfile_task_RRH = logdir_local_testcase + '/RRH_task' + '_' + str(run) + '_.log'
|
||||
task_RRH_compile = ' ( uname -a ; date \n'
|
||||
task_RRH_compile = task_RRH_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n'
|
||||
task_RRH_compile = task_RRH_compile + 'env |grep OPENAIR \n'
|
||||
if RRH_compile_prog != "":
|
||||
task_RRH_compile = task_RRH_compile + ' ( ' + RRH_compile_prog + ' '+ RRH_compile_prog_args + ' ) > ' + logfile_compile_RRH + ' 2>&1 \n'
|
||||
task_RRH_compile = task_RRH_compile + ' date ) > ' + logfile_task_RRH_compile_out + ' 2>&1 '
|
||||
write_file(logfile_task_RRH_compile, task_RRH_compile, mode="w")
|
||||
|
||||
task_RRH = ' ( uname -a ; date \n'
|
||||
task_RRH = task_RRH + ' export OPENAIR_TESTDIR=' + logdir_RRH + '\n'
|
||||
task_RRH = task_RRH + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n'
|
||||
task_RRH = task_RRH + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n'
|
||||
|
||||
if RRH_pre_exec != "":
|
||||
task_RRH = task_RRH + ' ( date; ' + RRH_pre_exec + ' '+ RRH_pre_exec_args + ' ) > ' + logfile_pre_exec_RRH + ' 2>&1 \n'
|
||||
if RRH_main_exec != "":
|
||||
task_RRH = task_RRH + ' ( date; ' + addsudo(RRH_main_exec + ' ' + RRH_main_exec_args, mypassword) + ' ) > ' + logfile_exec_RRH + ' 2>&1 & \n'
|
||||
task_RRH = task_RRH + 'array_exec_pid+=($!) \n'
|
||||
task_RRH = task_RRH + 'echo eNB_main_exec PID = $! \n'
|
||||
#terminate the eNB test case after timeout_cmd seconds
|
||||
task_RRH = task_RRH + finalize_deploy_script (timeout_cmd, RRH_terminate_missing_procs) + ' \n'
|
||||
task_RRH = task_RRH + 'handle_ctrl_c' + '\n'
|
||||
task_RRH = task_RRH + ' ) > ' + logfile_task_RRH_out + ' 2>&1 '
|
||||
write_file(logfile_task_RRH, task_RRH, mode="w")
|
||||
|
||||
logfile_compile_eNB = logdir_eNB + '/eNB_compile' + '_' + str(run) + '_.log'
|
||||
logfile_exec_eNB = logdir_eNB + '/eNB_exec' + '_' + str(run) + '_.log'
|
||||
@@ -704,6 +754,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w")
|
||||
|
||||
task_eNB = ' ( uname -a ; date \n'
|
||||
task_eNB = task_eNB + ' export OPENAIR_TESTDIR=' + logdir_eNB + '\n'
|
||||
task_eNB = task_eNB + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n'
|
||||
task_eNB = task_eNB + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n'
|
||||
|
||||
@@ -806,6 +857,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
write_file(logfile_task_EPC_compile, task_EPC_compile, mode="w")
|
||||
|
||||
task_EPC = ' ( uname -a ; date \n'
|
||||
task_EPC = task_EPC + ' export OPENAIRCN_TESTDIR=' + logdir_EPC + '\n'
|
||||
task_EPC = task_EPC + 'array_exec_pid=()' + '\n'
|
||||
task_EPC = task_EPC + 'cd ' + logdirOpenaircnRepo + '; source oaienv\n'
|
||||
task_EPC = task_EPC + 'source BUILD/TOOLS/build_helper \n'
|
||||
@@ -837,14 +889,20 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC_compile, False, timeout_thread)
|
||||
thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB_compile, False, timeout_thread)
|
||||
thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread)
|
||||
if RRHMachine != '':
|
||||
thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH_compile, False, timeout_thread)
|
||||
threads=[]
|
||||
threads.append(thread_eNB)
|
||||
threads.append(thread_UE)
|
||||
threads.append(thread_EPC)
|
||||
if RRHMachine != '':
|
||||
threads.append(thread_RRH)
|
||||
# Start new Threads
|
||||
thread_eNB.start()
|
||||
thread_UE.start()
|
||||
thread_EPC.start()
|
||||
if RRHMachine != '':
|
||||
thread_RRH.start()
|
||||
#Wait for all the compile threads to complete
|
||||
for t in threads:
|
||||
t.join()
|
||||
@@ -853,26 +911,29 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC, False, timeout_thread)
|
||||
thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB, False, timeout_thread)
|
||||
thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE, False, timeout_thread)
|
||||
|
||||
if RRHMachine != '':
|
||||
thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH, False, timeout_thread)
|
||||
threads=[]
|
||||
threads.append(thread_eNB)
|
||||
threads.append(thread_UE)
|
||||
threads.append(thread_EPC)
|
||||
if RRHMachine != '':
|
||||
threads.append(thread_RRH)
|
||||
# Start new Threads
|
||||
|
||||
thread_eNB.start()
|
||||
thread_UE.start()
|
||||
thread_EPC.start()
|
||||
|
||||
if RRHMachine != '':
|
||||
thread_RRH.start()
|
||||
#Wait for all the compile threads to complete
|
||||
for t in threads:
|
||||
t.join()
|
||||
#Now we get the log files from remote machines on the local machine
|
||||
cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
|
||||
#cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
#cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
#cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
if RRHMachine != '':
|
||||
cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC, oai_RRH] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
else:
|
||||
cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop)
|
||||
logfile_UE_stop_script_out = logdir_UE + '/UE_stop_script_out' + '_' + str(run) + '_.log'
|
||||
logfile_UE_stop_script = logdir_local_testcase + '/UE_stop_script' + '_' + str(run) + '_.log'
|
||||
|
||||
@@ -900,22 +961,23 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
|
||||
res= oai_EPC.send_recv(cmd)
|
||||
print "Changing permissions of logdir <" + logdir_EPC + "> in EPC machine..." + res
|
||||
|
||||
if RRHMachine != '':
|
||||
cmd = 'sudo -E chown -R ' + user + ' ' + logdir_RRH
|
||||
res= oai_RRH.send_recv(cmd)
|
||||
print "Changing permissions of logdir <" + logdir_RRH + "> in RRH machine..." + res
|
||||
|
||||
print "Copying files from EPCMachine : " + EPCMachine + "logdir_EPC = " + logdir_EPC
|
||||
#ssh = SSHSession(EPCMachine , username=user, key_file=None, password=password)
|
||||
#ssh.get_all(logdir_EPC , logdir_local + '/cmake_targets/autotests/log/'+ testcasename)
|
||||
SSHSessionWrapper(EPCMachine, user, None, password, logdir_EPC, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all")
|
||||
|
||||
print "Copying files from eNBMachine " + eNBMachine + "logdir_eNB = " + logdir_eNB
|
||||
#ssh = SSHSession(eNBMachine , username=user, key_file=None, password=password)
|
||||
#ssh.get_all(logdir_eNB, logdir_local + '/cmake_targets/autotests/log/'+ testcasename)
|
||||
SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all")
|
||||
|
||||
print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE
|
||||
#ssh = SSHSession(UEMachine , username=user, key_file=None, password=password)
|
||||
#ssh.get_all(logdir_UE , logdir_local + '/cmake_targets/autotests/log/'+ testcasename)
|
||||
SSHSessionWrapper(UEMachine, user, None, password, logdir_UE, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all")
|
||||
|
||||
if RRHMachine != '':
|
||||
print "Copying files from RRHMachine : " + RRHMachine + "logdir_RRH = " + logdir_RRH
|
||||
SSHSessionWrapper(RRHMachine, user, None, password, logdir_RRH, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all")
|
||||
|
||||
|
||||
#Currently we only perform throughput tests
|
||||
@@ -1017,8 +1079,8 @@ class oaiCleanOldProgramThread (threading.Thread):
|
||||
error = error + '\n threadID = ' + str(self.threadID) + '\n threadname = ' + self.threadname + '\n CleanUpOldProgs = ' + self.CleanUpOldProgs + '\n CleanUpAluLteBox = ' + self.CleanUpAluLteBox + '\n ExmimoRfStop = ' + self.ExmimoRfStop + '\n'
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
print "There is error in cleaning up old programs. The test case execution cannot continue...."
|
||||
sys.exit(1)
|
||||
print "There is error in cleaning up old programs....."
|
||||
#sys.exit(1)
|
||||
|
||||
# \brief Run parallel threads in all machines for clean up old execution of test cases
|
||||
# \param oai_list list of handlers that can be used to execute programs on remote machines
|
||||
@@ -1043,6 +1105,7 @@ pw =''
|
||||
i = 0
|
||||
dlsim=0
|
||||
localshell=0
|
||||
GitOAI5GRepo=''
|
||||
GitOAI5GRepoBranch=''
|
||||
GitOAI5GHeadVersion=''
|
||||
user=''
|
||||
@@ -1061,6 +1124,7 @@ flag_remove_logdir=False
|
||||
flag_start_testcase=False
|
||||
nruns_lte_softmodem=''
|
||||
flag_skip_git_head_check=False
|
||||
flag_skip_oai_install=False
|
||||
Timeout_cmd=''
|
||||
print "Number of arguments argc = " + str(len(sys.argv))
|
||||
#for index in range(1,len(sys.argv) ):
|
||||
@@ -1078,6 +1142,9 @@ while i < len (sys.argv):
|
||||
i = i +1
|
||||
elif arg == '-c':
|
||||
cleanUpRemoteMachines=True
|
||||
elif arg == '-5GRepo':
|
||||
GitOAI5GRepo = sys.argv[i+1]
|
||||
i = i +1
|
||||
elif arg == '-5GRepoBranch':
|
||||
GitOAI5GRepoBranch = sys.argv[i+1]
|
||||
i = i +1
|
||||
@@ -1120,11 +1187,14 @@ while i < len (sys.argv):
|
||||
elif arg == '--timeout_cmd':
|
||||
Timeout_cmd = sys.argv[i+1]
|
||||
i = i +1
|
||||
elif arg == '--skip-oai-install':
|
||||
flag_skip_oai_install=True
|
||||
elif arg == '-h' :
|
||||
print "-s: This flag *MUST* be set to start the test cases"
|
||||
print "-r: Remove the log directory in autotests"
|
||||
print "-g: Run test cases in a group"
|
||||
print "-c: Run cleanup scripts on remote machines and exit"
|
||||
print "-5GRepo: Repository for OAI 5G to use to run tests (overrides GitOAI5GRepo in test_case_list.xml)"
|
||||
print "-5GRepoBranch: Branch for OAI 5G Repository to run tests (overrides the branch in test_case_list.xml)"
|
||||
print "-5GRepoHeadVersion: Head commit on which to run tests (overrides the branch in test_case_list.xml)"
|
||||
print "-u: use the user name passed as argument"
|
||||
@@ -1135,6 +1205,7 @@ while i < len (sys.argv):
|
||||
print "-MachineListGeneric : overrides the MachineListGeneric parameter in test_case_list.xml"
|
||||
print "--skip-git-head-check: skip checking of GitHead remote/local branch (only for debugging)"
|
||||
print "--timeout_cmd: Override the default parameter (timeout_cmd) in test_case_list.xml. This parameter is in seconds and should be > 120"
|
||||
print "--skip-oai-install: Skips the openairinterface5g installer"
|
||||
sys.exit()
|
||||
else :
|
||||
print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options"
|
||||
@@ -1212,7 +1283,9 @@ if MachineList =='':
|
||||
MachineList = xmlRoot.findtext('MachineList',default='')
|
||||
NFSResultsShare = xmlRoot.findtext('NFSResultsShare',default='')
|
||||
GitOpenaircnRepo = xmlRoot.findtext('GitOpenair-cnRepo',default='')
|
||||
GitOAI5GRepo = xmlRoot.findtext('GitOAI5GRepo',default='')
|
||||
|
||||
if GitOAI5GRepo == '':
|
||||
GitOAI5GRepo = xmlRoot.findtext('GitOAI5GRepo',default='')
|
||||
|
||||
if GitOAI5GRepoBranch == '':
|
||||
GitOAI5GRepoBranch = xmlRoot.findtext('GitOAI5GRepoBranch',default='')
|
||||
@@ -1343,6 +1416,17 @@ for oai in oai_list:
|
||||
else:
|
||||
cmd = cmd + 'if [ \"$git_head\" != \"'+ GitOAI5GHeadVersion + '\" ]; then echo \"error: Git openairinterface5g head version does not match\" ; fi \n'
|
||||
cmd = cmd + 'source oaienv' + '\n'
|
||||
if flag_skip_oai_install == False:
|
||||
cmd = cmd + 'source $OPENAIR_DIR/cmake_targets/tools/build_helper \n'
|
||||
cmd = cmd + 'echo \"Installing core OAI dependencies...Start\" \n'
|
||||
cmd = cmd + '$OPENAIR_DIR/cmake_targets/build_oai -I --install-optional-packages \n'
|
||||
cmd = cmd + 'echo \"Installing core OAI dependencies...Finished\" \n'
|
||||
#cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Start\" \n'
|
||||
#cmd = cmd + 'check_install_bladerf_driver \n'
|
||||
#cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Finished\" \n'
|
||||
#cmd = cmd + 'echo \"Installing USRP OAI dependencies...Start\" \n'
|
||||
#cmd = cmd + 'check_install_usrp_uhd_driver \n'
|
||||
#cmd = cmd + 'echo \"Installing USRP OAI dependencies...Finished\" \n'
|
||||
cmd = cmd + 'cd ' + logdirOpenaircnRepo + '\n'
|
||||
cmd = cmd + 'git checkout ' + GitOpenaircnRepoBranch + '\n'
|
||||
cmd = cmd + 'env |grep OPENAIR' + '\n'
|
||||
@@ -1351,7 +1435,7 @@ for oai in oai_list:
|
||||
#cmd = cmd + 'echo \' ' + cmd + '\' > ' + setup_script + ' 2>&1 \n '
|
||||
#result = oai_list[index].send_recv(cmd, False, 300 )
|
||||
write_file(setup_script, cmd, mode="w")
|
||||
tempThread = oaiThread(index, 'thread_setup_'+str(index)+'_' + MachineList[index] , MachineList[index] , user, pw, cmd, False, 300)
|
||||
tempThread = oaiThread(index, 'thread_setup_'+str(index)+'_' + MachineList[index] , MachineList[index] , user, pw, cmd, False, 3000)
|
||||
threads_init_setup.append(tempThread )
|
||||
tempThread.start()
|
||||
index = index + 1
|
||||
@@ -1399,7 +1483,8 @@ status, out = commands.getstatusoutput('grep ' + ' -il \'error\' ' + locallogdi
|
||||
if (out != '') :
|
||||
print "There is error in setup of machines"
|
||||
print "status = " + str(status) + "\n Check files for error = " + out
|
||||
print sys.exit(1)
|
||||
print "Exiting now..."
|
||||
sys.exit(1)
|
||||
|
||||
cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop)
|
||||
if cleanUpRemoteMachines == True:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -131,6 +131,7 @@ def start_ue () :
|
||||
ip = IPRoute()
|
||||
idx = ip.link_lookup(ifname=iface)[0]
|
||||
os.system ('route add ' + gw + ' ppp0')
|
||||
os.system('sleep 5')
|
||||
os.system ('ping ' + gw)
|
||||
break
|
||||
except Exception, e:
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import time
|
||||
import serial
|
||||
import os
|
||||
from pyroute2 import IPRoute
|
||||
import sys
|
||||
import re
|
||||
import threading
|
||||
import signal
|
||||
import traceback
|
||||
import os
|
||||
import commands
|
||||
|
||||
# configure the serial connections (the parameters differs on the device you are connecting to)
|
||||
#First we find an open port to work with
|
||||
serial_port=''
|
||||
ser=serial.Serial()
|
||||
openair_dir = os.environ.get('OPENAIR_DIR')
|
||||
if openair_dir == None:
|
||||
print "Error getting OPENAIR_DIR environment variable"
|
||||
sys.exit(1)
|
||||
|
||||
sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/'))
|
||||
|
||||
from lib_autotest import *
|
||||
|
||||
def find_open_port():
|
||||
global serial_port, ser
|
||||
max_ports=100
|
||||
if os.path.exists(serial_port) == True:
|
||||
return serial_port
|
||||
for port in range(0,100):
|
||||
serial_port = '/dev/ttyUSB'+str(port)
|
||||
if os.path.exists(serial_port) == True:
|
||||
print 'New Serial Port : ' + serial_port
|
||||
break
|
||||
|
||||
ser = serial.Serial(port=serial_port)
|
||||
return
|
||||
|
||||
|
||||
|
||||
#serial_port = '/dev/ttyUSB2'
|
||||
bandrich_ppd_config = os.environ.get('OPENAIR_DIR') + '/cmake_targets/autotests/tools/wdial.bandrich.conf'
|
||||
|
||||
exit_flag=0
|
||||
|
||||
def signal_handler(signal, frame):
|
||||
print('You pressed Ctrl+C!')
|
||||
print('Resetting the UE to detached state')
|
||||
timeout=10
|
||||
exit_flag=1
|
||||
send_command('AT+CGATT=0' , 'OK' , timeout)
|
||||
sys.exit(0)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
|
||||
|
||||
#ser.open()
|
||||
#ser.isOpen()
|
||||
|
||||
class pppThread (threading.Thread):
|
||||
def __init__(self, threadID, name, counter):
|
||||
threading.Thread.__init__(self)
|
||||
self.threadID = threadID
|
||||
self.name = name
|
||||
self.counter = counter
|
||||
def run(self):
|
||||
print "Starting " + self.name
|
||||
#Here we keep running pppd thread in indefinite loop as this script terminates sometimes
|
||||
#while 1:
|
||||
while 1:
|
||||
time.sleep(5) #Hard coded, do not reduce this number!
|
||||
print "Starting wvdial now..."
|
||||
print 'exit_flag = ' + str(exit_flag)
|
||||
send_command('AT+CGATT=1','OK', 300)
|
||||
os.system('wvdial -C ' + bandrich_ppd_config + '' )
|
||||
if exit_flag == 1:
|
||||
print "Exit flag set to true. Exiting pppThread now"
|
||||
print "Terminating wvdial now..."
|
||||
|
||||
def send_command (cmd, response, timeout):
|
||||
count=0
|
||||
sleep_duration = 1
|
||||
print 'In function: send_command: cmd = <' + cmd + '> response: <' + response + '> \n'
|
||||
global serial_port, ser
|
||||
while count <= timeout:
|
||||
try:
|
||||
#Sometimes the port does not exist coz of reset in modem.
|
||||
#In that case, we need to search for this port again
|
||||
if os.path.exists(serial_port) == False:
|
||||
find_open_port()
|
||||
ser.write (cmd + '\r\n')
|
||||
out = ''
|
||||
time.sleep(sleep_duration)
|
||||
count = count + sleep_duration
|
||||
while ser.inWaiting() > 0:
|
||||
out += ser.read(1)
|
||||
print 'out = <' + out + '> response = <' + response + '> \n'
|
||||
if re.search(response, out):
|
||||
break
|
||||
except Exception, e:
|
||||
error = ' cmd : ' + cmd + ' response : ' + response
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
|
||||
|
||||
def start_ue () :
|
||||
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
|
||||
timeout=60 #timeout in seconds
|
||||
send_command('AT', 'OK' , timeout)
|
||||
#send_command('AT+CFUN=1' , 'OK' , timeout)
|
||||
#send_command('AT+CGATT=0' , 'OK' , timeout)
|
||||
send_command('AT+CGATT=1','OK', 300)
|
||||
#os.system('wvdial -C ' + bandrich_ppd_config + ' &' )
|
||||
|
||||
thread_ppp = pppThread(1, "ppp_thread", 1)
|
||||
thread_ppp.start()
|
||||
|
||||
iface='ppp0'
|
||||
|
||||
while 1:
|
||||
time.sleep ( 2)
|
||||
#Now we check if ppp0 interface is up and running
|
||||
try:
|
||||
if exit_flag == 1:
|
||||
break
|
||||
ip = IPRoute()
|
||||
idx = ip.link_lookup(ifname=iface)[0]
|
||||
os.system ('route add ' + gw + ' ppp0')
|
||||
os.system('sleep 5')
|
||||
os.system ('ping ' + gw)
|
||||
break
|
||||
except Exception, e:
|
||||
error = ' Interface ' + iface + 'does not exist...'
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
|
||||
thread_ppp.join()
|
||||
|
||||
def stop_ue():
|
||||
timeout=60
|
||||
os.system('killall wvdial')
|
||||
send_command('AT', 'OK' , timeout)
|
||||
send_command('AT+CGATT=0' , 'OK|ERROR' , timeout)
|
||||
#send_command('AT+CFUN=4' , 'OK' , timeout)
|
||||
|
||||
|
||||
#reset the USB BUS of Bandrich UE
|
||||
def reset_ue():
|
||||
stringIdBandrich='Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard'
|
||||
status, out = commands.getstatusoutput('lsusb | grep -i \'' + stringIdBandrich + '\'')
|
||||
if (out == '') :
|
||||
print "Bandrich 4G LTE Adapter not found. Exiting now..."
|
||||
sys.exit()
|
||||
p=re.compile('Bus\s*(\w+)\s*Device\s*(\w+):\s*ID\s*(\w+):(\w+)')
|
||||
res=p.findall(out)
|
||||
BusId=res[0][0]
|
||||
DeviceId=res[0][1]
|
||||
VendorId=res[0][2]
|
||||
ProductId=res[0][3]
|
||||
usb_dir= find_usb_path(VendorId, ProductId)
|
||||
print "Bandrich 4G LTE Adapter found in..." + usb_dir
|
||||
cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\""
|
||||
os.system(cmd + " ; sleep 15" )
|
||||
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
|
||||
os.system(cmd + " ; sleep 30" )
|
||||
|
||||
i=1
|
||||
gw='192.172.0.1'
|
||||
while i < len(sys.argv):
|
||||
arg=sys.argv[i]
|
||||
if arg == '--start-ue' :
|
||||
find_open_port()
|
||||
print 'Using Serial port : ' + serial_port
|
||||
start_ue()
|
||||
elif arg == '--stop-ue' :
|
||||
find_open_port()
|
||||
print 'Using Serial port : ' + serial_port
|
||||
stop_ue()
|
||||
elif arg == '--reset-ue' :
|
||||
reset_ue()
|
||||
elif arg == '-gw' :
|
||||
gw = sys.argv[i+1]
|
||||
i=i+1
|
||||
elif arg == '-h' :
|
||||
print "--reset-ue: Reset the UE on USB Bus. Similar to unplugging and plugging the UE"
|
||||
print "--stop-ue: Stop the UE. Send DETACH command"
|
||||
print "--start-ue: Start the UE. Send ATTACH command"
|
||||
print "-gw: Specify the default gw as sometimes the gateway/route arguments are not set properly via wvdial"
|
||||
else :
|
||||
print " Script called with wrong arguments, arg = " + arg
|
||||
sys.exit()
|
||||
i = i +1
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ if keyword == 'mme_ip_address':
|
||||
elif keyword == 'IPV4_LIST':
|
||||
replacement_text = keyword + ' = ( ' + replacement_text + ' ) ; '
|
||||
string = re.sub(r"IPV4_LIST\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
|
||||
elif keyword == 'rrh_gw_config':
|
||||
replacement_text = keyword + ' = ( { ' + replacement_text + ' } ) ; '
|
||||
string = re.sub(r"rrh_gw_config\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
|
||||
else :
|
||||
replacement_text = keyword + ' = ' + replacement_text + ' ; '
|
||||
string = re.sub(r"%s\s*=\s*([^\$]+?)\s*;" % keyword , replacement_text, string, re.M)
|
||||
|
||||
@@ -42,13 +42,13 @@ THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
source $THIS_SCRIPT_PATH/tools/build_helper
|
||||
|
||||
MSC_GEN="False"
|
||||
XFORMS="False"
|
||||
XFORMS="True"
|
||||
PRINT_STATS="False"
|
||||
VCD_TIMING="False"
|
||||
LOWLATENCY_FLAG_USER="False"
|
||||
FORCE_LOWLATENCY_FLAG_USER=""
|
||||
REL="Rel10"
|
||||
HW="EXMIMO"
|
||||
HW="None"
|
||||
TP="None"
|
||||
NOS1=0
|
||||
EPC=0
|
||||
@@ -91,7 +91,7 @@ Options
|
||||
default is Rel10,
|
||||
Rel8 limits the implementation to 3GPP Release 8 version
|
||||
-w | --hardware
|
||||
EXMIMO (Default), USRP, BLADERF, LMSSDR, None
|
||||
EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, None (Default)
|
||||
Adds this RF board support (in external packages installation and in compilation)
|
||||
-t | --transport protocol
|
||||
ETHERNET , None
|
||||
@@ -760,9 +760,9 @@ fi
|
||||
rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
|
||||
mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
|
||||
if [ "$RUN_GROUP" -eq "1" ]; then
|
||||
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
|
||||
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
|
||||
else
|
||||
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
|
||||
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
|
||||
fi
|
||||
wait
|
||||
else
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
|
||||
set ( ASN_DEBUG False)
|
||||
set ( ADDR_CONF False )
|
||||
set ( DEBUG_OMG False )
|
||||
set ( DISABLE_XER_PRINT False )
|
||||
set ( DRIVER2013 True )
|
||||
set ( EMOS False )
|
||||
set ( EMIT_ASN_DEBUG False )
|
||||
set ( ENABLE_FXP True )
|
||||
set ( ENABLE_ITTI True )
|
||||
set ( ENABLE_NAS_UE_LOGGING True )
|
||||
@@ -47,9 +49,9 @@ set ( OAI_EMU False )
|
||||
set ( OAISIM False )
|
||||
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
|
||||
set ( OAI_NW_DRIVER_USE_NETLINK True )
|
||||
set ( OPENAIR1 False )
|
||||
set ( OPENAIR2 False )
|
||||
set ( OPENAIR_LTE F )
|
||||
set ( OPENAIR1 True )
|
||||
set ( OPENAIR2 True )
|
||||
set ( OPENAIR_LTE True )
|
||||
set ( PACKAGE_NAME "epc_test" )
|
||||
set ( PBS_SIM False )
|
||||
set ( PDCP_USE_NETLINK True )
|
||||
@@ -74,4 +76,4 @@ set ( SMBV False )
|
||||
set ( TEST_OMG False )
|
||||
set ( USE_MME "R10" )
|
||||
set ( USER_MODE True )
|
||||
set ( XER_PRINT False )
|
||||
set ( XER_PRINT True )
|
||||
|
||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
|
||||
set(PACKAGE_NAME "unitary_tests_simulators")
|
||||
set(PHYSIM True)
|
||||
set(RF_BOARD None)
|
||||
set(XFORMS False)
|
||||
set(XFORMS True)
|
||||
|
||||
set(DEBUG_PHY False)
|
||||
set(MU_RECIEVER False)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
################################################################################
|
||||
# file build_helper
|
||||
# brief
|
||||
# author Laurent Thomas
|
||||
# authors Laurent Thomas, Lionel GAUTHIER
|
||||
#
|
||||
#######################################
|
||||
SUDO='sudo -E'
|
||||
@@ -269,7 +269,9 @@ check_install_oai_software() {
|
||||
pydb \
|
||||
wvdial \
|
||||
python-numpy \
|
||||
sshpass
|
||||
sshpass \
|
||||
libxslt1-dev
|
||||
|
||||
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
|
||||
if [ `lsb_release -rs` = '12.04' ] ; then
|
||||
install_nettle_from_source
|
||||
@@ -288,13 +290,15 @@ install_asn1c_from_source(){
|
||||
asn1_install_dir=$OPENAIR_DIR/cmake_targets/log/asn1c_install_log.txt
|
||||
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_dir "
|
||||
(
|
||||
rm -rf /tmp/asn1c-r1516
|
||||
$SUDO rm -rf /tmp/asn1c-r1516
|
||||
mkdir -p /tmp/asn1c-r1516
|
||||
cd /tmp/asn1c-r1516
|
||||
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0
|
||||
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0
|
||||
rm -rf /tmp/asn1c-r1516/*
|
||||
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516 > /tmp/log_compile_asn1c
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0 >> /tmp/log_compile_asn1c
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0 >> /tmp/log_compile_asn1c
|
||||
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 >> /tmp/log_compile_asn1c
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0 >> /tmp/log_compile_asn1c
|
||||
./configure
|
||||
make -j`nproc`
|
||||
$SUDO make install
|
||||
@@ -324,7 +328,6 @@ install_nas_tools() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
################################
|
||||
# set_openair_env
|
||||
###############################
|
||||
@@ -397,4 +400,4 @@ if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
fi
|
||||
|
||||
return $stat
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
# Contact Information
|
||||
# OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
# OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
# OpenAirInterface Dev : openair4g-devel@eurecom.fr
|
||||
# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
#
|
||||
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
#
|
||||
@@ -121,6 +121,7 @@ function main()
|
||||
echo "Cleaning TEST_EPC"
|
||||
fi
|
||||
rm -f $OPENAIR_DIR/targets/bin/test_epc_generate_scenario
|
||||
rm -f $OPENAIR_DIR/targets/bin/test_epc_play_scenario
|
||||
rm -Rf build 2>&1
|
||||
mkdir -m 777 -p -v build
|
||||
fi
|
||||
@@ -140,6 +141,13 @@ function main()
|
||||
compilations \
|
||||
epc_test test_epc_generate_scenario \
|
||||
test_epc_generate_scenario $dbin/test_epc_generate_scenario
|
||||
|
||||
compilations \
|
||||
epc_test test_epc_play_scenario \
|
||||
test_epc_play_scenario $dbin/test_epc_play_scenario
|
||||
|
||||
$SUDO cp -upv test_epc_generate_scenario /usr/local/bin
|
||||
$SUDO cp -upv test_epc_play_scenario /usr/local/bin
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
################################################################################
|
||||
# file run_enb_s1_usrp
|
||||
# brief run script for eNB USRP.
|
||||
# author Lionel GAUTHIER
|
||||
# author Lionel GAUTHIER and Navid Nikaein
|
||||
# company Eurecom
|
||||
# email: lionel.gauthier@eurecom.fr
|
||||
# email: lionel.gauthier@eurecom.fr and navid.nikaein@eurecom.fr
|
||||
|
||||
|
||||
################################
|
||||
@@ -56,6 +56,8 @@ function help()
|
||||
echo_error "Mandatory arguments to long options are mandatory for short options too."
|
||||
echo_error " -g, --gdb Run with GDB."
|
||||
echo_error " -h, --help Print this help."
|
||||
echo_error " -e, --ulsch-max-errors num-errs maximum allowed number of uplink errors"
|
||||
echo_error " -f, --rf-config-file filename RF specific configuration file"
|
||||
echo_error " -K, --itti-dump-file filename ITTI dump file containing all ITTI events occuring during EPC runtime.(can omit file name if last argument)"
|
||||
echo_error " -M, --target-dl-mcs mcs Downlink target MCS."
|
||||
echo_error " -m, --mscgen directory Generate mscgen output files in a directory"
|
||||
@@ -137,7 +139,27 @@ function main()
|
||||
shift;
|
||||
exit 0
|
||||
;;
|
||||
-K | --itti-dump-file)
|
||||
-e | --ulsch-max-errors)
|
||||
ulsch_max_errors=$2
|
||||
echo "setting --ulsch-max-errors to $ulsch_max_errors"
|
||||
exe_arguments="$exe_arguments --ulsch-max-errors=$ulsch_max_errors"
|
||||
shift 2;
|
||||
;;
|
||||
-f | --rf-config-file)
|
||||
rf_config_file=$2
|
||||
# can omit file name if last arg on the line
|
||||
if [ "x$rf_config_file" = "x" ]; then
|
||||
rf_config_file=null
|
||||
shift 1;
|
||||
else
|
||||
shift 2;
|
||||
fi
|
||||
if [ "$rf_config_file" != "null" ]; then
|
||||
echo "setting --rf-config-file to $rf_config_file"
|
||||
exe_arguments="$exe_arguments --rf-config-file=$rf_config_file"
|
||||
fi
|
||||
;;
|
||||
-K | --itti-dump-file)
|
||||
itti_dump_file=$2
|
||||
# can omit file name if last arg on the line
|
||||
if [ "x$itti_dump_file" = "x" ]; then
|
||||
|
||||
@@ -13,5 +13,5 @@ sudo -E $OPENAIR_DIR/cmake_targets/tools/init_exmimo2
|
||||
|
||||
#now we stop the card from transmitting anything
|
||||
cd $OPENAIR_DIR/targets/bin
|
||||
sudo -E octave $OPENAIR_DIR/cmake_targets/tools/exmimo_stop_octave.m
|
||||
sudo -E octave -H --no-gui $OPENAIR_DIR/cmake_targets/tools/exmimo_stop_octave.m
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
#include "vars.h"
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -48,6 +49,7 @@
|
||||
#define print_shorts(s,x) printf("%s %x,%x,%x,%x,%x,%x,%x,%x\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7])
|
||||
#define print_ints(s,x) printf("%s %x %x %x %x\n",s,(x)[0],(x)[1],(x)[2],(x)[3])
|
||||
|
||||
#define print_bytes2(s,x) printf("%s %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7],(x)[8],(x)[9],(x)[10],(x)[11],(x)[12],(x)[13],(x)[14],(x)[15],(x)[16],(x)[17],(x)[18],(x)[19],(x)[20],(x)[21],(x)[22],(x)[23],(x)[24],(x)[25],(x)[26],(x)[27],(x)[28],(x)[29],(x)[30],(x)[31])
|
||||
|
||||
//#define DEBUG_TURBO_ENCODER 1
|
||||
#define CALLGRIND 1
|
||||
@@ -57,16 +59,12 @@ unsigned long long threegpplte_interleaver_tmp;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
struct treillis {
|
||||
union {
|
||||
__m64 systematic_64[3];
|
||||
char systematic_8[24];
|
||||
};
|
||||
union {
|
||||
__m64 parity1_64[3];
|
||||
char parity1_8[24];
|
||||
__m64 systematic_andp1_64[3];
|
||||
uint8_t systematic_andp1_8[24];
|
||||
};
|
||||
union {
|
||||
__m64 parity2_64[3];
|
||||
char parity2_8[24];
|
||||
uint8_t parity2_8[24];
|
||||
};
|
||||
int exit_state;
|
||||
} __attribute__ ((aligned(64)));
|
||||
@@ -75,12 +73,8 @@ struct treillis {
|
||||
|
||||
struct treillis {
|
||||
union {
|
||||
uint8x8_t systematic_64[3];
|
||||
char systematic_8[24];
|
||||
}__attribute__((aligned(64)));
|
||||
union {
|
||||
uint8x8_t parity1_64[3];
|
||||
char parity1_8[24];
|
||||
uint8x8_t systematic_andp1_64[3];
|
||||
char systematic_andp1_8[24];
|
||||
}__attribute__((aligned(64)));
|
||||
union {
|
||||
uint8x8_t parity2_64[3];
|
||||
@@ -91,6 +85,7 @@ struct treillis {
|
||||
#endif
|
||||
|
||||
struct treillis all_treillis[8][256];
|
||||
|
||||
int all_treillis_initialized=0;
|
||||
|
||||
static inline unsigned char threegpplte_rsc(unsigned char input,unsigned char *state)
|
||||
@@ -116,18 +111,20 @@ void treillis_table_init(void)
|
||||
unsigned char v, current_state;
|
||||
|
||||
// clear all_treillis
|
||||
for (i=0; i<8; i++)
|
||||
for (i=0; i<8; i++) {
|
||||
bzero( all_treillis[i], sizeof(all_treillis[0]) );
|
||||
}
|
||||
|
||||
for (i=0; i<8; i++) { //all possible initial states
|
||||
for (j=0; j<=255; j++) { // all possible values of a byte
|
||||
current_state=i;
|
||||
|
||||
for (b=0; b<8 ; b++ ) { // pre-compute the image of the byte j in _m128i vector right place
|
||||
all_treillis[i][j].systematic_8[b*3]= (j&(1<<(7-b)))>>(7-b);
|
||||
v=threegpplte_rsc( all_treillis[i][j].systematic_8[b*3] ,
|
||||
all_treillis[i][j].systematic_andp1_8[b*3]= (j&(1<<(7-b)))>>(7-b);
|
||||
v=threegpplte_rsc( all_treillis[i][j].systematic_andp1_8[b*3] ,
|
||||
¤t_state);
|
||||
all_treillis[i][j].parity1_8[b*3+1]=v; // for the yparity1
|
||||
all_treillis[i][j].systematic_andp1_8[b*3+1]=v; // for the yparity1
|
||||
// all_treillis[i][j].parity1_8[b*3+1]=v; // for the yparity1
|
||||
all_treillis[i][j].parity2_8[b*3+2]=v; // for the yparity2
|
||||
}
|
||||
|
||||
@@ -143,9 +140,10 @@ void treillis_table_init(void)
|
||||
char interleave_compact_byte(short * base_interleaver,unsigned char * input, unsigned char * output, int n)
|
||||
{
|
||||
|
||||
char expandInput[768*8] __attribute__((aligned(16)));
|
||||
char expandInput[768*8] __attribute__((aligned(32)));
|
||||
int i,loop=n>>4;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifndef __AVX2__
|
||||
__m128i *i_128=(__m128i *)input, *o_128=(__m128i*)expandInput;
|
||||
__m128i tmp1, tmp2, tmp3, tmp4;
|
||||
__m128i BIT_MASK = _mm_set_epi8( 0b00000001,
|
||||
@@ -164,6 +162,43 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
||||
0b00100000,
|
||||
0b01000000,
|
||||
0b10000000);
|
||||
|
||||
#else
|
||||
__m256i *i_256=(__m256i *)input, *o_256=(__m256i*)expandInput;
|
||||
__m256i tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
|
||||
__m256i BIT_MASK = _mm256_set_epi8( 0b00000001,
|
||||
0b00000010,
|
||||
0b00000100,
|
||||
0b00001000,
|
||||
0b00010000,
|
||||
0b00100000,
|
||||
0b01000000,
|
||||
0b10000000,
|
||||
0b00000001,
|
||||
0b00000010,
|
||||
0b00000100,
|
||||
0b00001000,
|
||||
0b00010000,
|
||||
0b00100000,
|
||||
0b01000000,
|
||||
0b10000000,
|
||||
0b00000001,
|
||||
0b00000010,
|
||||
0b00000100,
|
||||
0b00001000,
|
||||
0b00010000,
|
||||
0b00100000,
|
||||
0b01000000,
|
||||
0b10000000,
|
||||
0b00000001,
|
||||
0b00000010,
|
||||
0b00000100,
|
||||
0b00001000,
|
||||
0b00010000,
|
||||
0b00100000,
|
||||
0b01000000,
|
||||
0b10000000);
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
uint8x16_t *i_128=(uint8x16_t *)input, *o_128=(uint8x16_t *)expandInput;
|
||||
uint8x16_t tmp1,tmp2;
|
||||
@@ -187,46 +222,126 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
||||
0b00000010,
|
||||
0b00000001};
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __AVX2__
|
||||
if ((n&15) > 0)
|
||||
loop++;
|
||||
#else
|
||||
loop=n>>5;
|
||||
if ((n&31) > 0)
|
||||
loop++;
|
||||
#endif
|
||||
|
||||
|
||||
for (i=0; i<loop ; i++ ) {
|
||||
/* int cur_byte=i<<3; */
|
||||
/* for (b=0;b<8;b++) */
|
||||
/* expandInput[cur_byte+b] = (input[i]&(1<<(7-b)))>>(7-b); */
|
||||
// int cur_byte=i<<3;
|
||||
// for (b=0;b<8;b++)
|
||||
// expandInput[cur_byte+b] = (input[i]&(1<<(7-b)))>>(7-b);
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
tmp1=_mm_load_si128(i_128++);
|
||||
tmp2=_mm_unpacklo_epi8(tmp1,tmp1);
|
||||
tmp3=_mm_unpacklo_epi16(tmp2,tmp2);
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3);
|
||||
#ifndef __AVX2__
|
||||
tmp1=_mm_load_si128(i_128++); // tmp1 = B0,B1,...,B15
|
||||
tmp2=_mm_unpacklo_epi8(tmp1,tmp1); // tmp2 = B0,B0,B1,B1,...,B7,B7
|
||||
tmp3=_mm_unpacklo_epi16(tmp2,tmp2); // tmp3 = B0,B0,B0,B0,B1,B1,B1,B1,B2,B2,B2,B2,B3,B3,B3,B3
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 - B0,B0,B0,B0,B0,B0,B0,B0,B1,B1,B1,B1,B1,B1,B1,B1
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);
|
||||
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3);
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 - B2,B2,B2,B2,B2,B2,B2,B2,B3,B3,B3,B3,B3,B3,B3,B3
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||
|
||||
tmp3=_mm_unpackhi_epi16(tmp2,tmp2);
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3);
|
||||
tmp3=_mm_unpackhi_epi16(tmp2,tmp2); // tmp3 = B4,B4,B4,B4,B5,B5,B5,B5,B6,B6,B6,B6,B7,B7,B7,B7
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 - B4,B4,B4,B4,B4,B4,B4,B4,B5,B5,B5,B5,B5,B5,B5,B5
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3);
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 - B6,B6,B6,B6,B6,B6,B6,B6,B7,B7,B7,B7,B7,B7,B7,B7
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||
|
||||
tmp2=_mm_unpackhi_epi8(tmp1,tmp1);
|
||||
tmp3=_mm_unpacklo_epi16(tmp2,tmp2);
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3);
|
||||
tmp2=_mm_unpackhi_epi8(tmp1,tmp1); // tmp2 = B8,B8,B9,B9,...,B15,B15
|
||||
tmp3=_mm_unpacklo_epi16(tmp2,tmp2); // tmp3 = B8,B8,B8,B8,B9,B9,B9,B9,B10,B10,B10,B10,B11,B11,B11,B11
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 = B8,B8,B8,B8,B8,B8,B8,B8,B9,B9,B9,B9,B9,B9,B9,B9
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3);
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 = B10,B10,B10,B10,B10,B10,B10,B10,B11,B11,B11,B11,B11,B11,B11,B11
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||
|
||||
tmp3=_mm_unpackhi_epi16(tmp2,tmp2);
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3);
|
||||
tmp3=_mm_unpackhi_epi16(tmp2,tmp2); // tmp3 = B12,B12,B12,B12,B13,B13,B13,B13,B14,B14,B14,B14,B15,B15,B15,B15
|
||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 = B12,B12,B12,B12,B12,B12,B12,B12,B13,B13,B13,B13,B13,B13,B13,B13
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3);
|
||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 = B14,B14,B14,B14,B14,B14,B14,B14,B15,B15,B15,B15,B15,B15,B15,B15
|
||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||
#else
|
||||
tmp1=_mm256_load_si256(i_256++); // tmp1 = B0,B1,...,B15,...,B31
|
||||
//print_bytes2("in",(uint8_t*)&tmp1);
|
||||
tmp2=_mm256_unpacklo_epi8(tmp1,tmp1); // tmp2 = B0,B0,B1,B1,...,B7,B7,B16,B16,B17,B17,...,B23,B23
|
||||
tmp3=_mm256_unpacklo_epi16(tmp2,tmp2); // tmp3 = B0,B0,B0,B0,B1,B1,B1,B1,B2,B2,B2,B2,B3,B3,B3,B3,B16,B16,B16,B16,...,B19,B19,B19,B19
|
||||
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 - B0,B0,B0,B0,B0,B0,B0,B0,B1,B1,B1,B1,B1,B1,B1,B1,B16,B16...,B17..,B17
|
||||
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 - B2,B2,B2,B2,B2,B2,B2,B2,B3,B3,B3,B3,B3,B3,B3,B3,B18...,B18,B19,...,B19
|
||||
tmp6=_mm256_insertf128_si256(tmp4,_mm256_extracti128_si256(tmp5,0),1); // tmp6 = B0 B1 B2 B3
|
||||
tmp7=_mm256_insertf128_si256(tmp5,_mm256_extracti128_si256(tmp4,1),0); // tmp7 = B16 B17 B18 B19
|
||||
//print_bytes2("tmp2",(uint8_t*)&tmp2);
|
||||
//print_bytes2("tmp3",(uint8_t*)&tmp3);
|
||||
//print_bytes2("tmp4",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp5",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp6",(uint8_t*)&tmp6);
|
||||
//print_bytes2("tmp7",(uint8_t*)&tmp7);
|
||||
o_256[0]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp6,BIT_MASK),BIT_MASK);
|
||||
//print_bytes2("out",(uint8_t*)o_256);
|
||||
o_256[4]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||
//print_bytes2("out",(uint8_t*)(o_256+4));
|
||||
|
||||
tmp3=_mm256_unpackhi_epi16(tmp2,tmp2); // tmp3 = B4,B4,B4,B4,B5,B5,B5,B5,B6,B6,B6,B6,B7,B7,B7,B7,B20,B20,B20,B20,...,B23,B23,B23,B23
|
||||
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 - B4,B4,B4,B4,B4,B4,B4,B4,B5,B5,B5,B5,B5,B5,B5,B5,B20,B20...,B21..,B21
|
||||
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 - B6,B6,B6,B6,B6,B6,B6,B6,B7,B7,B7,B7,B7,B7,B7,B7,B22...,B22,B23,...,B23
|
||||
tmp6=_mm256_insertf128_si256(tmp4,_mm256_extracti128_si256(tmp5,0),1); // tmp6 = B4 B5 B6 B7
|
||||
tmp7=_mm256_insertf128_si256(tmp5,_mm256_extracti128_si256(tmp4,1),0); // tmp7 = B20 B21 B22 B23
|
||||
//print_bytes2("tmp2",(uint8_t*)&tmp2);
|
||||
//print_bytes2("tmp3",(uint8_t*)&tmp3);
|
||||
//print_bytes2("tmp4",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp5",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp6",(uint8_t*)&tmp6);
|
||||
//print_bytes2("tmp7",(uint8_t*)&tmp7);
|
||||
o_256[1]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp6,BIT_MASK),BIT_MASK);
|
||||
//print_bytes2("out",(uint8_t*)(o_256+1));
|
||||
o_256[5]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||
//print_bytes2("out",(uint8_t*)(o_256+4));
|
||||
|
||||
tmp2=_mm256_unpackhi_epi8(tmp1,tmp1); // tmp2 = B8 B9 B10 B11 B12 B13 B14 B15 B25 B26 B27 B28 B29 B30 B31
|
||||
tmp3=_mm256_unpacklo_epi16(tmp2,tmp2); // tmp3 = B8,B9,B10,B11,B26,B27,B28,B29
|
||||
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 - B8,B9,B26,B27
|
||||
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 - B10,B11,B28,B29
|
||||
tmp6=_mm256_insertf128_si256(tmp4,_mm256_extracti128_si256(tmp5,0),1); // tmp6 = B8 B9 B10 B11
|
||||
tmp7=_mm256_insertf128_si256(tmp5,_mm256_extracti128_si256(tmp4,1),0); // tmp7 = B26 B27 B28 B29
|
||||
//print_bytes2("tmp2",(uint8_t*)&tmp2);
|
||||
//print_bytes2("tmp3",(uint8_t*)&tmp3);
|
||||
//print_bytes2("tmp4",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp5",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp6",(uint8_t*)&tmp6);
|
||||
//print_bytes2("tmp7",(uint8_t*)&tmp7);
|
||||
o_256[2]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp6,BIT_MASK),BIT_MASK);
|
||||
//print_bytes2("out",(uint8_t*)(o_256+2));
|
||||
o_256[6]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||
//print_bytes2("out",(uint8_t*)(o_256+4));
|
||||
|
||||
tmp3=_mm256_unpackhi_epi16(tmp2,tmp2); // tmp3 = B12 B13 B14 B15 B28 B29 B30 B31
|
||||
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 = B12 B13 B28 B29
|
||||
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 = B14 B15 B30 B31
|
||||
tmp6=_mm256_insertf128_si256(tmp4,_mm256_extracti128_si256(tmp5,0),1); // tmp6 = B12 B13 B14 B15
|
||||
tmp7=_mm256_insertf128_si256(tmp5,_mm256_extracti128_si256(tmp4,1),0); // tmp7 = B28 B29 B30 B31
|
||||
//print_bytes2("tmp2",(uint8_t*)&tmp2);
|
||||
//print_bytes2("tmp3",(uint8_t*)&tmp3);
|
||||
//print_bytes2("tmp4",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp5",(uint8_t*)&tmp4);
|
||||
//print_bytes2("tmp6",(uint8_t*)&tmp6);
|
||||
//print_bytes2("tmp7",(uint8_t*)&tmp7);
|
||||
o_256[3]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp6,BIT_MASK),BIT_MASK);
|
||||
//print_bytes2("out",(uint8_t*)(o_256+3));
|
||||
o_256[7]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||
//print_bytes2("out",(uint8_t*)(o_256+7));
|
||||
|
||||
o_256+=8;
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
tmp1=vld1q_u8((uint8_t*)i_128);
|
||||
//print_bytes("tmp1:",(uint8_t*)&tmp1);
|
||||
@@ -302,11 +417,17 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
||||
i_128++;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
short * ptr_intl=base_interleaver;
|
||||
#if defined(__x86_64) || defined(__i386__)
|
||||
#ifndef __AVX2__
|
||||
__m128i tmp;
|
||||
uint16_t *systematic2_ptr=(unsigned short *) output;
|
||||
uint16_t *systematic2_ptr=(uint16_t *) output;
|
||||
#else
|
||||
__m256i tmp;
|
||||
uint32_t *systematic2_ptr=(uint32_t *) output;
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
uint8x16_t tmp;
|
||||
const uint8_t __attribute__ ((aligned (16))) _Powers[16]=
|
||||
@@ -316,11 +437,15 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
||||
uint8x16_t Powers= vld1q_u8(_Powers);
|
||||
uint8_t *systematic2_ptr=(uint8_t *) output;
|
||||
#endif
|
||||
#ifndef __AVX2__
|
||||
int input_length_words=n>>1;
|
||||
|
||||
#else
|
||||
int input_length_words=n>>2;
|
||||
#endif
|
||||
for ( i=0; i< input_length_words ; i ++ ) {
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifndef __AVX2__
|
||||
tmp=_mm_insert_epi8(tmp,expandInput[*ptr_intl++],7);
|
||||
tmp=_mm_insert_epi8(tmp,expandInput[*ptr_intl++],6);
|
||||
tmp=_mm_insert_epi8(tmp,expandInput[*ptr_intl++],5);
|
||||
@@ -338,6 +463,45 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
||||
tmp=_mm_insert_epi8(tmp,expandInput[*ptr_intl++],8+1);
|
||||
tmp=_mm_insert_epi8(tmp,expandInput[*ptr_intl++],8+0);
|
||||
*systematic2_ptr++=(unsigned short)_mm_movemask_epi8(tmp);
|
||||
#else
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],7);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],6);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],5);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],4);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],3);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],2);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],1);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],0);
|
||||
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+7);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+6);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+5);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+4);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+3);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+2);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+1);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+0);
|
||||
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+7);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+6);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+5);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+4);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+3);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+2);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+1);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+0);
|
||||
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+7);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+6);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+5);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+4);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+3);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+2);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+1);
|
||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+0);
|
||||
|
||||
*systematic2_ptr++=(unsigned int)_mm256_movemask_epi8(tmp);
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,7);
|
||||
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,6);
|
||||
@@ -391,8 +555,9 @@ void threegpplte_turbo_encoder(unsigned char *input,
|
||||
unsigned short input_length_bits = input_length_bytes<<3;
|
||||
short * base_interleaver;
|
||||
|
||||
if ( all_treillis_initialized == 0 )
|
||||
if ( all_treillis_initialized == 0 ) {
|
||||
treillis_table_init();
|
||||
}
|
||||
|
||||
// look for f1 and f2 precomputed interleaver values
|
||||
for (i=0; i < 188 && f1f2mat[i].nb_bits != input_length_bits; i++);
|
||||
@@ -405,7 +570,7 @@ void threegpplte_turbo_encoder(unsigned char *input,
|
||||
}
|
||||
|
||||
|
||||
unsigned char systematic2[768];
|
||||
unsigned char systematic2[768] __attribute__((aligned(32)));
|
||||
interleave_compact_byte(base_interleaver,input,systematic2,input_length_bytes);
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -419,22 +584,26 @@ void threegpplte_turbo_encoder(unsigned char *input,
|
||||
for ( state0=state1=i=0 ; i<input_length_bytes; i++ ) {
|
||||
cur_s1=input[i];
|
||||
cur_s2=systematic2[i];
|
||||
|
||||
|
||||
for ( code_rate=0; code_rate<3; code_rate++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
*ptr_output++ = _mm_add_pi8(all_treillis[state0][cur_s1].systematic_64[code_rate],
|
||||
_mm_add_pi8(all_treillis[state0][cur_s1].parity1_64[code_rate],
|
||||
all_treillis[state1][cur_s2].parity2_64[code_rate]));
|
||||
/*
|
||||
*ptr_output++ = _mm_add_pi8(all_treillis[state0][cur_s1].systematic_64[code_rate],
|
||||
_mm_add_pi8(all_treillis[state0][cur_s1].parity1_64[code_rate],
|
||||
all_treillis[state1][cur_s2].parity2_64[code_rate]));
|
||||
*/
|
||||
*ptr_output++ = _mm_add_pi8(all_treillis[state0][cur_s1].systematic_andp1_64[code_rate],
|
||||
all_treillis[state1][cur_s2].parity2_64[code_rate]);
|
||||
|
||||
|
||||
#elif defined(__arm__)
|
||||
uint8x8_t ptmp = vadd_u8(all_treillis[state0][cur_s1].parity1_64[code_rate],
|
||||
all_treillis[state1][cur_s2].parity2_64[code_rate]);
|
||||
*ptr_output++ = vadd_u8(all_treillis[state0][cur_s1].systematic_64[code_rate],
|
||||
ptmp);
|
||||
*ptr_output++ = vadd_u8(all_treillis[state0][cur_s1].systematic_andp1_64[code_rate],
|
||||
all_treillis[state0][cur_s1].parity1_64[code_rate]);
|
||||
#endif
|
||||
}
|
||||
|
||||
state0=all_treillis[state0][cur_s1].exit_state;
|
||||
state1=all_treillis[state1][cur_s2].exit_state;
|
||||
}
|
||||
|
||||
state0=all_treillis[state0][cur_s1].exit_state;
|
||||
state1=all_treillis[state1][cur_s2].exit_state;
|
||||
}
|
||||
|
||||
x=output+(input_length_bits*3);
|
||||
@@ -485,7 +654,7 @@ void threegpplte_turbo_encoder(unsigned char *input,
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
|
||||
unsigned char input[INPUT_LENGTH+16],state,state2;
|
||||
unsigned char input[INPUT_LENGTH+32],state,state2;
|
||||
unsigned char output[12+(3*(INPUT_LENGTH<<3))],x,z;
|
||||
int i;
|
||||
unsigned char out;
|
||||
@@ -510,7 +679,7 @@ int main(int argc,char **argv)
|
||||
memset((void*)input,0,INPUT_LENGTH+16);
|
||||
for (i=0; i<INPUT_LENGTH; i++) {
|
||||
input[i] = i*219;
|
||||
printf("Input %d : %x\n",i,input[i]);
|
||||
printf("Input %d : %d\n",i,input[i]);
|
||||
}
|
||||
|
||||
threegpplte_turbo_encoder(&input[0],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,11 +63,17 @@
|
||||
#include "mex.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7])
|
||||
|
||||
//#define DEBUG_LOGMAP
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
#define print_shorts(s,x) fprintf(fdsse4,"%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7])
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
FILE *fdsse4;
|
||||
#endif
|
||||
|
||||
typedef int16_t llr_t; // internal decoder LLR data is 16-bit fixed
|
||||
typedef int16_t channel_t;
|
||||
@@ -99,7 +105,7 @@ void log_map16(llr_t* systematic,
|
||||
{
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
msg("log_map, frame_length %d\n",frame_length);
|
||||
fprintf(fdsse4,"log_map, frame_length %d\n",frame_length);
|
||||
#endif
|
||||
|
||||
start_meas(gamma_stats) ;
|
||||
@@ -135,22 +141,35 @@ void compute_gamma16(llr_t* m11,llr_t* m10,llr_t* systematic,channel_t* y_parity
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
msg("compute_gamma, %p,%p,%p,%p,framelength %d\n",m11,m10,systematic,y_parity,frame_length);
|
||||
fprintf(fdsse4,"compute_gamma (sse_16bit), %p,%p,%p,%p,framelength %d\n",m11,m10,systematic,y_parity,frame_length);
|
||||
#endif
|
||||
|
||||
#ifndef __AVX2__
|
||||
K1=frame_length>>3;
|
||||
#else
|
||||
if ((frame_length&15) > 0)
|
||||
K1=(frame_length+1)>>4;
|
||||
else
|
||||
K1=frame_length>>4;
|
||||
#endif
|
||||
|
||||
for (k=0; k<K1; k++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifndef __AVX2__
|
||||
m11_128[k] = _mm_srai_epi16(_mm_adds_epi16(systematic128[k],y_parity128[k]),1);
|
||||
m10_128[k] = _mm_srai_epi16(_mm_subs_epi16(systematic128[k],y_parity128[k]),1);
|
||||
#else
|
||||
((__m256i*)m11_128)[k] = _mm256_srai_epi16(_mm256_adds_epi16(((__m256i*)systematic128)[k],((__m256i*)y_parity128)[k]),1);
|
||||
// ((__m256i*)m10_128)[k] = _mm256_srai_epi16(_mm256_subs_epi16(((__m256i*)y_parity128)[k],((__m256i*)systematic128)[k]),1);
|
||||
((__m256i*)m10_128)[k] = _mm256_srai_epi16(_mm256_subs_epi16(((__m256i*)systematic128)[k],((__m256i*)y_parity128)[k]),1);
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
m11_128[k] = vhaddq_s16(systematic128[k],y_parity128[k]);
|
||||
m10_128[k] = vhsubq_s16(systematic128[k],y_parity128[k]);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
printf("Loop index k, m11,m10\n");
|
||||
fprintf(fdsse4,"Loop index k %d\n", k);
|
||||
print_shorts("sys",(int16_t*)&systematic128[k]);
|
||||
print_shorts("yp",(int16_t*)&y_parity128[k]);
|
||||
print_shorts("m11",(int16_t*)&m11_128[k]);
|
||||
@@ -158,14 +177,28 @@ void compute_gamma16(llr_t* m11,llr_t* m10,llr_t* systematic,channel_t* y_parity
|
||||
#endif
|
||||
}
|
||||
|
||||
k=frame_length>>3;
|
||||
// Termination
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
m11_128[k] = _mm_srai_epi16(_mm_adds_epi16(systematic128[k+term_flag],y_parity128[k]),1);
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
m10_128[k] = _mm_srai_epi16(_mm_subs_epi16(systematic128[k+term_flag],y_parity128[k]),1);
|
||||
#else
|
||||
m10_128[k] = _mm_srai_epi16(_mm_subs_epi16(y_parity128[k],systematic128[k+term_flag]),1);
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
m11_128[k] = vhaddq_s16(systematic128[k+term_flag],y_parity128[k]);
|
||||
m10_128[k] = vhsubq_s16(systematic128[k+term_flag],y_parity128[k]);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"Loop index k %d (term flag %d)\n", k,term_flag);
|
||||
print_shorts("sys",(int16_t*)&systematic128[k]);
|
||||
print_shorts("yp",(int16_t*)&y_parity128[k]);
|
||||
print_shorts("m11",(int16_t*)&m11_128[k]);
|
||||
print_shorts("m10",(int16_t*)&m10_128[k]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define L 40
|
||||
@@ -174,11 +207,21 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
{
|
||||
int k,l,l2,K1,rerun_flag=0;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *alpha128=(__m128i *)alpha,*alpha_ptr;
|
||||
__m128i a0,a1,a2,a3,a4,a5,a6,a7,*m11p,*m10p;
|
||||
__m128i *alpha128=(__m128i *)alpha,*alpha_ptr,*m11p,*m10p;
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
__m128i a0,a1,a2,a3,a4,a5,a6,a7;
|
||||
__m128i m_b0,m_b1,m_b2,m_b3,m_b4,m_b5,m_b6,m_b7;
|
||||
__m128i new0,new1,new2,new3,new4,new5,new6,new7;
|
||||
__m128i alpha_max;
|
||||
#else
|
||||
__m256i *alpha256=(__m256i *)alpha,*alpha_ptr256,m11,m10;
|
||||
__m256i a01,a23,a45,a67,a02,a13,a64,a75;
|
||||
__m256i m_b01,m_b23,m_b45,m_b67,new01,new23,new45,new67;
|
||||
__m256i m11m10_256;
|
||||
__m256i alpha_max;
|
||||
#endif
|
||||
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *alpha128=(int16x8_t *)alpha,*alpha_ptr;
|
||||
int16x8_t a0,a1,a2,a3,a4,a5,a6,a7,*m11p,*m10p;
|
||||
@@ -188,10 +231,16 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
#endif
|
||||
l2 = L>>3;
|
||||
K1 = (frame_length>>3);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"compute_alpha (sse_16bit)\n");
|
||||
#endif
|
||||
for (l=K1;; l=l2,rerun_flag=1) {
|
||||
#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
|
||||
@@ -218,7 +267,7 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
alpha128[7] = vdupq_n_s16(-MAX/2);
|
||||
#endif
|
||||
#ifdef DEBUG_LOGMAP
|
||||
printf("Initial alpha\n");
|
||||
fprintf(fdsse4,"Initial alpha\n");
|
||||
print_shorts("a0",(int16_t*)&alpha128[0]);
|
||||
print_shorts("a1",(int16_t*)&alpha128[1]);
|
||||
print_shorts("a2",(int16_t*)&alpha128[2]);
|
||||
@@ -258,7 +307,7 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
alpha[48] = -MAX/2;
|
||||
alpha[56] = -MAX/2;
|
||||
#ifdef DEBUG_LOGMAP
|
||||
printf("Second run\n");
|
||||
fprintf(fdsse4,"Second run\n");
|
||||
print_shorts("a0",(int16_t*)&alpha128[0]);
|
||||
print_shorts("a1",(int16_t*)&alpha128[1]);
|
||||
print_shorts("a2",(int16_t*)&alpha128[2]);
|
||||
@@ -272,6 +321,11 @@ 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;
|
||||
@@ -284,6 +338,8 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
k++) {
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
a1=_mm_load_si128(&alpha_ptr[1]);
|
||||
a3=_mm_load_si128(&alpha_ptr[3]);
|
||||
a5=_mm_load_si128(&alpha_ptr[5]);
|
||||
@@ -328,6 +384,37 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
alpha_max = _mm_max_epi16(alpha_max,a5);
|
||||
alpha_max = _mm_max_epi16(alpha_max,a6);
|
||||
alpha_max = _mm_max_epi16(alpha_max,a7);
|
||||
#else
|
||||
a02=_mm256_load_si256(&alpha_ptr256[0]);
|
||||
a13=_mm256_load_si256(&alpha_ptr256[1]);
|
||||
a64=_mm256_load_si256(&alpha_ptr256[2]);
|
||||
a75=_mm256_load_si256(&alpha_ptr256[3]);
|
||||
m11m10_256 = _mm256_insertf128_si256(m11m10_256,*m11p,0);
|
||||
m11m10_256 = _mm256_insertf128_si256(m11m10_256,*m10p,1);
|
||||
|
||||
|
||||
m_b01 = _mm256_adds_epi16(a13,m11m10_256); //negative m10
|
||||
m_b23 = _mm256_subs_epi16(a75,m11m10_256); //negative m10
|
||||
m_b45 = _mm256_subs_epi16(a13,m11m10_256); //negative m10
|
||||
m_b67 = _mm256_adds_epi16(a75,m11m10_256); //negative m10
|
||||
|
||||
new01 = _mm256_subs_epi16(a02,m11m10_256); //negative m10
|
||||
new23 = _mm256_adds_epi16(a64,m11m10_256); //negative m10
|
||||
new45 = _mm256_adds_epi16(a02,m11m10_256); //negative m10
|
||||
new67 = _mm256_subs_epi16(a64,m11m10_256); //negative m10
|
||||
|
||||
a01 = _mm256_max_epi16(m_b01,new01);
|
||||
a23 = _mm256_max_epi16(m_b23,new23);
|
||||
a45 = _mm256_max_epi16(m_b45,new45);
|
||||
a67 = _mm256_max_epi16(m_b67,new67);
|
||||
|
||||
alpha_max = _mm256_max_epi16(a01,a23);
|
||||
alpha_max = _mm256_max_epi16(alpha_max,a45);
|
||||
alpha_max = _mm256_max_epi16(alpha_max,a67);
|
||||
alpha_max = _mm256_max_epi16(alpha_max,_mm256_permutevar8x32_epi32(alpha_max,_mm256_set_epi32(3,2,1,0,7,6,5,4)));
|
||||
|
||||
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
m_b0 = vqaddq_s16(alpha_ptr[1],*m11p); // m11
|
||||
m_b4 = vqsubq_s16(alpha_ptr[1],*m11p); // m00=-m11
|
||||
@@ -367,9 +454,15 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
#endif
|
||||
|
||||
alpha_ptr+=8;
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
alpha_ptr256+=4;
|
||||
#endif
|
||||
m11p++;
|
||||
m10p++;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
alpha_ptr[0] = _mm_subs_epi16(a0,alpha_max);
|
||||
alpha_ptr[1] = _mm_subs_epi16(a1,alpha_max);
|
||||
alpha_ptr[2] = _mm_subs_epi16(a2,alpha_max);
|
||||
@@ -378,6 +471,18 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
alpha_ptr[5] = _mm_subs_epi16(a5,alpha_max);
|
||||
alpha_ptr[6] = _mm_subs_epi16(a6,alpha_max);
|
||||
alpha_ptr[7] = _mm_subs_epi16(a7,alpha_max);
|
||||
#else
|
||||
|
||||
a01 = _mm256_subs_epi16(a01,alpha_max);
|
||||
a23 = _mm256_subs_epi16(a23,alpha_max);
|
||||
a45 = _mm256_subs_epi16(a45,alpha_max);
|
||||
a67 = _mm256_subs_epi16(a67,alpha_max);
|
||||
|
||||
alpha_ptr256[0] = _mm256_permute2x128_si256(a01,a23,0x20); //a02
|
||||
alpha_ptr256[1] = _mm256_permute2x128_si256(a01,a23,0x13); //a13
|
||||
alpha_ptr256[2] = _mm256_permute2x128_si256(a45,a67,0x02); //a64
|
||||
alpha_ptr256[3] = _mm256_permute2x128_si256(a45,a67,0x31); //a75
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
alpha_ptr[0] = vqsubq_s16(a0,alpha_max);
|
||||
alpha_ptr[1] = vqsubq_s16(a1,alpha_max);
|
||||
@@ -390,7 +495,7 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
printf("Loop index %d, mb\n",k);
|
||||
fprintf(fdsse4,"Loop index %d\n",k);
|
||||
print_shorts("mb0",(int16_t*)&m_b0);
|
||||
print_shorts("mb1",(int16_t*)&m_b1);
|
||||
print_shorts("mb2",(int16_t*)&m_b2);
|
||||
@@ -400,7 +505,7 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
print_shorts("mb6",(int16_t*)&m_b6);
|
||||
print_shorts("mb7",(int16_t*)&m_b7);
|
||||
|
||||
printf("Loop index %d, new\n",k);
|
||||
fprintf(fdsse4,"Loop index %d, new\n",k);
|
||||
print_shorts("new0",(int16_t*)&new0);
|
||||
print_shorts("new1",(int16_t*)&new1);
|
||||
print_shorts("new2",(int16_t*)&new2);
|
||||
@@ -410,7 +515,7 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
print_shorts("new6",(int16_t*)&new6);
|
||||
print_shorts("new7",(int16_t*)&new7);
|
||||
|
||||
printf("Loop index %d, after max\n",k);
|
||||
fprintf(fdsse4,"Loop index %d, after max\n",k);
|
||||
print_shorts("a0",(int16_t*)&a0);
|
||||
print_shorts("a1",(int16_t*)&a1);
|
||||
print_shorts("a2",(int16_t*)&a2);
|
||||
@@ -420,7 +525,7 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
print_shorts("a6",(int16_t*)&a6);
|
||||
print_shorts("a7",(int16_t*)&a7);
|
||||
|
||||
printf("Loop index %d\n",k);
|
||||
fprintf(fdsse4,"Loop index %d\n",k);
|
||||
print_shorts("a0",(int16_t*)&alpha_ptr[0]);
|
||||
print_shorts("a1",(int16_t*)&alpha_ptr[1]);
|
||||
print_shorts("a2",(int16_t*)&alpha_ptr[2]);
|
||||
@@ -463,25 +568,33 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
llr_t beta0,beta1;
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
msg("compute_beta, %p,%p,%p,%p,framelength %d,F %d\n",
|
||||
beta,m_11,m_10,alpha,frame_length,F);
|
||||
fprintf(fdsse4,"compute_beta, %p,%p,%p,%p,framelength %d,F %d\n",
|
||||
beta,m_11,m_10,alpha,frame_length,F);
|
||||
#endif
|
||||
|
||||
|
||||
// termination for beta initialization
|
||||
|
||||
// printf("beta init: offset8 %d\n",offset8_flag);
|
||||
// fprintf(fdsse4,"beta init: offset8 %d\n",offset8_flag);
|
||||
m11=(int16_t)m_11[2+frame_length];
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
m10=(int16_t)m_10[2+frame_length];
|
||||
|
||||
// printf("m11,m10 %d,%d\n",m11,m10);
|
||||
#else
|
||||
m10=-(int16_t)m_10[2+frame_length];
|
||||
#endif
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"m11,m10 %d,%d\n",m11,m10);
|
||||
#endif
|
||||
|
||||
beta0 = -m11;//M0T_TERM;
|
||||
beta1 = m11;//M1T_TERM;
|
||||
m11=(int16_t)m_11[1+frame_length];
|
||||
m10=(int16_t)m_10[1+frame_length];
|
||||
|
||||
// printf("m11,m10 %d,%d\n",m11,m10);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"m11,m10 %d,%d\n",m11,m10);
|
||||
#endif
|
||||
|
||||
beta0_2 = beta0-m11;//+M0T_TERM;
|
||||
beta1_2 = beta0+m11;//+M1T_TERM;
|
||||
@@ -489,8 +602,9 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
beta3_2 = beta1-m10;//+M3T_TERM;
|
||||
m11=(int16_t)m_11[frame_length];
|
||||
m10=(int16_t)m_10[frame_length];
|
||||
// printf("m11,m10 %d,%d (%p)\n",m11,m10,m_11+frame_length);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"m11,m10 %d,%d\n",m11,m10);
|
||||
#endif
|
||||
beta0_16 = beta0_2-m11;//+M0T_TERM;
|
||||
beta1_16 = beta0_2+m11;//+M1T_TERM;
|
||||
beta2_16 = beta1_2+m10;//+M2T_TERM;
|
||||
@@ -536,6 +650,17 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
beta_ptr[5] = alpha128[5+(frame_length)];
|
||||
beta_ptr[6] = alpha128[6+(frame_length)];
|
||||
beta_ptr[7] = alpha128[7+(frame_length)];
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"beta init \n");
|
||||
print_shorts("b0",(int16_t*)&beta_ptr[0]);
|
||||
print_shorts("b1",(int16_t*)&beta_ptr[1]);
|
||||
print_shorts("b2",(int16_t*)&beta_ptr[2]);
|
||||
print_shorts("b3",(int16_t*)&beta_ptr[3]);
|
||||
print_shorts("b4",(int16_t*)&beta_ptr[4]);
|
||||
print_shorts("b5",(int16_t*)&beta_ptr[5]);
|
||||
print_shorts("b6",(int16_t*)&beta_ptr[6]);
|
||||
print_shorts("b7",(int16_t*)&beta_ptr[7]);
|
||||
#endif
|
||||
} else {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
beta128 = (__m128i*)&beta[0];
|
||||
@@ -558,6 +683,17 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
beta_ptr[5] = (int16x8_t)vshrq_n_s64((int64x2_t)beta128[5],16); beta_ptr[5] = vsetq_lane_s16(beta[43],beta_ptr[5],4);
|
||||
beta_ptr[6] = (int16x8_t)vshrq_n_s64((int64x2_t)beta128[6],16); beta_ptr[6] = vsetq_lane_s16(beta[51],beta_ptr[6],4);
|
||||
beta_ptr[7] = (int16x8_t)vshrq_n_s64((int64x2_t)beta128[7],16); beta_ptr[7] = vsetq_lane_s16(beta[59],beta_ptr[7],4);
|
||||
#endif
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"beta init (second run) \n");
|
||||
print_shorts("b0",(int16_t*)&beta_ptr[0]);
|
||||
print_shorts("b1",(int16_t*)&beta_ptr[1]);
|
||||
print_shorts("b2",(int16_t*)&beta_ptr[2]);
|
||||
print_shorts("b3",(int16_t*)&beta_ptr[3]);
|
||||
print_shorts("b4",(int16_t*)&beta_ptr[4]);
|
||||
print_shorts("b5",(int16_t*)&beta_ptr[5]);
|
||||
print_shorts("b6",(int16_t*)&beta_ptr[6]);
|
||||
print_shorts("b7",(int16_t*)&beta_ptr[7]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -582,6 +718,17 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
beta_ptr[7] = vsetq_lane_s16(beta7_16,beta_ptr[7],7);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"beta init (after insert) \n");
|
||||
print_shorts("b0",(int16_t*)&beta_ptr[0]);
|
||||
print_shorts("b1",(int16_t*)&beta_ptr[1]);
|
||||
print_shorts("b2",(int16_t*)&beta_ptr[2]);
|
||||
print_shorts("b3",(int16_t*)&beta_ptr[3]);
|
||||
print_shorts("b4",(int16_t*)&beta_ptr[4]);
|
||||
print_shorts("b5",(int16_t*)&beta_ptr[5]);
|
||||
print_shorts("b6",(int16_t*)&beta_ptr[6]);
|
||||
print_shorts("b7",(int16_t*)&beta_ptr[7]);
|
||||
#endif
|
||||
int loopval=((rerun_flag==0)?0:((frame_length-L)>>3));
|
||||
|
||||
for (k=(frame_length>>3)-1; k>=loopval; k--) {
|
||||
@@ -589,6 +736,9 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
m11_128=((__m128i*)m_11)[k];
|
||||
m10_128=((__m128i*)m_10)[k];
|
||||
|
||||
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
m_b0 = _mm_adds_epi16(beta_ptr[4],m11_128); //m11
|
||||
m_b1 = _mm_subs_epi16(beta_ptr[4],m11_128); //m00
|
||||
m_b2 = _mm_subs_epi16(beta_ptr[5],m10_128); //m01
|
||||
@@ -598,6 +748,7 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
m_b6 = _mm_subs_epi16(beta_ptr[7],m11_128); //m00
|
||||
m_b7 = _mm_adds_epi16(beta_ptr[7],m11_128); //m11
|
||||
|
||||
|
||||
new0 = _mm_subs_epi16(beta_ptr[0],m11_128); //m00
|
||||
new1 = _mm_adds_epi16(beta_ptr[0],m11_128); //m11
|
||||
new2 = _mm_adds_epi16(beta_ptr[1],m10_128); //m10
|
||||
@@ -607,8 +758,29 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
new6 = _mm_adds_epi16(beta_ptr[3],m11_128); //m11
|
||||
new7 = _mm_subs_epi16(beta_ptr[3],m11_128); //m00
|
||||
|
||||
#else
|
||||
b01=_mm256_load_si256(&((_m256i*)beta_ptr)[0]);
|
||||
b23=_mm256_load_si256(&((_m256i*)beta_ptr)[1]);
|
||||
b45=_mm256_load_si256(&((_m256i*)beta_ptr)[2]);
|
||||
b67=_mm256_load_si256(&((_m256i*)beta_ptr)[3]);
|
||||
m11m10_256 = _mm256_insertf128_si256(m11m10_256,m11_128,0);
|
||||
m11m10_256 = _mm256_insertf128_si256(m11m10_256,m10_128,1);
|
||||
|
||||
|
||||
m_b02 = _mm256_adds_epi16(b45,m11m10_256); //negative m10
|
||||
m_b13 = _mm256_subs_epi16(b45,m11m10_256); //negative m10
|
||||
m_b64 = _mm256_subs_epi16(b67,m11m10_256); //negative m10
|
||||
m_b75 = _mm256_adds_epi16(b67,m11m10_256); //negative m10
|
||||
new02 = _mm256_subs_epi16(b01,m11m10_256); //negative m10
|
||||
new13 = _mm256_adds_epi16(b01,m11m10_256); //negative m10
|
||||
new64 = _mm256_adds_epi16(b23,m11m10_256); //negative m10
|
||||
new75 = _mm256_subs_epi16(b24,m11m10_256); //negative m10
|
||||
#endif
|
||||
|
||||
beta_ptr-=8;
|
||||
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
beta_ptr[0] = _mm_max_epi16(m_b0,new0);
|
||||
beta_ptr[1] = _mm_max_epi16(m_b1,new1);
|
||||
beta_ptr[2] = _mm_max_epi16(m_b2,new2);
|
||||
@@ -634,6 +806,28 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
beta_ptr[5] = _mm_subs_epi16(beta_ptr[5],beta_max);
|
||||
beta_ptr[6] = _mm_subs_epi16(beta_ptr[6],beta_max);
|
||||
beta_ptr[7] = _mm_subs_epi16(beta_ptr[7],beta_max);
|
||||
#else
|
||||
b02 = _mm256_max_epi16(m_b02,new02);
|
||||
b13 = _mm256_max_epi16(m_b13,new13);
|
||||
b64 = _mm256_max_epi16(m_b64,new64);
|
||||
b75 = _mm256_max_epi16(m_b75,new75);
|
||||
|
||||
beta_max = _mm256_max_epi16(b02,b13);
|
||||
beta_max = _mm256_max_epi16(beta_max,b64);
|
||||
beta_max = _mm256_max_epi16(beta_max,b75);
|
||||
beta_max = _mm256_max_epi16(beta_max,_mm256_permutevar8x32_epi32(betaa_max,_mm256_set_epi32(3,2,1,0,7,6,5,4)));
|
||||
|
||||
b02 = _mm256_subs_epi16(b02,beta_max);
|
||||
b13 = _mm256_subs_epi16(b13,beta_max);
|
||||
b64 = _mm256_subs_epi16(b64,beta_max);
|
||||
b75 = _mm256_subs_epi16(b75,beta_max);
|
||||
|
||||
((_m256i*)beta_ptr)[0]) = _mm256_permute2x128_si256(b02,b13,0x02); //b01
|
||||
((_m256i*)beta_ptr)[1]) = _mm256_permute2x128_si256(b02,b13,0x31); //b23
|
||||
((_m256i*)beta_ptr)[2]) = _mm256_permute2x128_si256(b64,b75,0x13); //b45
|
||||
((_m256i*)beta_ptr)[3]) = _mm256_permute2x128_si256(b64,b75,0x20); //b67
|
||||
#endif
|
||||
|
||||
#elif defined(__arm__)
|
||||
m11_128=((int16x8_t*)m_11)[k];
|
||||
m10_128=((int16x8_t*)m_10)[k];
|
||||
@@ -684,6 +878,18 @@ void compute_beta16(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sh
|
||||
beta_ptr[7] = vqsubq_s16(beta_ptr[7],beta_max);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"Loop index %d, mb\n",k);
|
||||
fprintf(fdsse4,"beta init (after max)\n");
|
||||
print_shorts("b0",(int16_t*)&beta_ptr[0]);
|
||||
print_shorts("b1",(int16_t*)&beta_ptr[1]);
|
||||
print_shorts("b2",(int16_t*)&beta_ptr[2]);
|
||||
print_shorts("b3",(int16_t*)&beta_ptr[3]);
|
||||
print_shorts("b4",(int16_t*)&beta_ptr[4]);
|
||||
print_shorts("b5",(int16_t*)&beta_ptr[5]);
|
||||
print_shorts("b6",(int16_t*)&beta_ptr[6]);
|
||||
print_shorts("b7",(int16_t*)&beta_ptr[7]);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -721,7 +927,7 @@ void compute_ext16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext,
|
||||
//
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
msg("compute_ext, %p, %p, %p, %p, %p, %p ,framelength %d\n",alpha,beta,m_11,m_10,ext,systematic,frame_length);
|
||||
fprintf(fdsse4,"compute_ext (sse_16bit), %p, %p, %p, %p, %p, %p ,framelength %d\n",alpha,beta,m_11,m_10,ext,systematic,frame_length);
|
||||
#endif
|
||||
|
||||
alpha_ptr = alpha128;
|
||||
@@ -736,7 +942,7 @@ void compute_ext16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext,
|
||||
ext_128 = (__m128i*)&ext[k<<3];
|
||||
|
||||
/*
|
||||
printf("EXT %03d\n",k);
|
||||
fprintf(fdsse4,"EXT %03d\n",k);
|
||||
print_shorts("a0:",&alpha_ptr[0]);
|
||||
print_shorts("a1:",&alpha_ptr[1]);
|
||||
print_shorts("a2:",&alpha_ptr[2]);
|
||||
@@ -754,6 +960,9 @@ void compute_ext16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext,
|
||||
print_shorts("b6:",&beta_ptr[6]);
|
||||
print_shorts("b7:",&beta_ptr[7]);
|
||||
*/
|
||||
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
m00_4 = _mm_adds_epi16(alpha_ptr[7],beta_ptr[3]); //ALPHA_BETA_4m00;
|
||||
m11_4 = _mm_adds_epi16(alpha_ptr[7],beta_ptr[7]); //ALPHA_BETA_4m11;
|
||||
m00_3 = _mm_adds_epi16(alpha_ptr[6],beta_ptr[7]); //ALPHA_BETA_3m00;
|
||||
@@ -770,6 +979,32 @@ void compute_ext16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext,
|
||||
m10_2 = _mm_adds_epi16(alpha_ptr[3],beta_ptr[5]); //ALPHA_BETA_2m10;
|
||||
m10_1 = _mm_adds_epi16(alpha_ptr[2],beta_ptr[1]); //ALPHA_BETA_1m10;
|
||||
m01_1 = _mm_adds_epi16(alpha_ptr[2],beta_ptr[5]); //ALPHA_BETA_1m01;
|
||||
#else
|
||||
|
||||
|
||||
m00_1 = _mm_adds_epi16(alpha_ptr[0],beta_ptr[0]); //ALPHA_BETA_1m00;
|
||||
m10_1 = _mm_adds_epi16(alpha_ptr[2],beta_ptr[1]); //ALPHA_BETA_1m10;
|
||||
m11_1 = _mm_adds_epi16(alpha_ptr[0],beta_ptr[4]); //ALPHA_BETA_1m11;
|
||||
m01_1 = _mm_adds_epi16(alpha_ptr[2],beta_ptr[5]); //ALPHA_BETA_1m01;
|
||||
|
||||
m11_2 = _mm_adds_epi16(alpha_ptr[1],beta_ptr[0]); //ALPHA_BETA_2m11;
|
||||
m01_2 = _mm_adds_epi16(alpha_ptr[3],beta_ptr[1]); //ALPHA_BETA_2m01;
|
||||
m00_2 = _mm_adds_epi16(alpha_ptr[1],beta_ptr[4]); //ALPHA_BETA_2m00;
|
||||
m10_2 = _mm_adds_epi16(alpha_ptr[3],beta_ptr[5]); //ALPHA_BETA_2m10;
|
||||
|
||||
m11_3 = _mm_adds_epi16(alpha_ptr[6],beta_ptr[3]); //ALPHA_BETA_3m11;
|
||||
m01_3 = _mm_adds_epi16(alpha_ptr[4],beta_ptr[2]); //ALPHA_BETA_3m01;
|
||||
m00_3 = _mm_adds_epi16(alpha_ptr[6],beta_ptr[7]); //ALPHA_BETA_3m00;
|
||||
m10_3 = _mm_adds_epi16(alpha_ptr[4],beta_ptr[6]); //ALPHA_BETA_3m10;
|
||||
|
||||
m00_4 = _mm_adds_epi16(alpha_ptr[7],beta_ptr[3]); //ALPHA_BETA_4m00;
|
||||
m10_4 = _mm_adds_epi16(alpha_ptr[5],beta_ptr[2]); //ALPHA_BETA_4m10;
|
||||
m11_4 = _mm_adds_epi16(alpha_ptr[7],beta_ptr[7]); //ALPHA_BETA_4m11;
|
||||
m01_4 = _mm_adds_epi16(alpha_ptr[5],beta_ptr[6]); //ALPHA_BETA_4m01;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
print_shorts("m11_1:",&m11_1);
|
||||
print_shorts("m11_2:",&m11_2);
|
||||
@@ -816,15 +1051,15 @@ void compute_ext16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext,
|
||||
// print_shorts("m10_1:",&m10_1);
|
||||
|
||||
*ext_128 = _mm_subs_epi16(m10_1,m01_1);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"ext %p\n",ext_128);
|
||||
print_shorts("ext:",(int16_t*)ext_128);
|
||||
print_shorts("m11:",(int16_t*)m11_128);
|
||||
print_shorts("m10:",(int16_t*)m10_128);
|
||||
print_shorts("m10_1:",(int16_t*)&m10_1);
|
||||
print_shorts("m01_1:",(int16_t*)&m01_1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
print_shorts("ext:",ext_128);
|
||||
print_shorts("m11:",m11_128);
|
||||
print_shorts("m10:",m10_128);
|
||||
print_shorts("m10_1:",&m10_1);
|
||||
print_shorts("m01_1:",&m01_1);
|
||||
print_shorts("syst:",systematic_128);
|
||||
*/
|
||||
#elif defined(__arm__)
|
||||
m11_128 = (int16x8_t*)&m_11[k<<3];
|
||||
m10_128 = (int16x8_t*)&m_10[k<<3];
|
||||
@@ -927,7 +1162,7 @@ void init_td16()
|
||||
// j-=(n-1);
|
||||
|
||||
pi2tab16[ind][i] = j;
|
||||
// printf("pi2[%d] = %d\n",i,j);
|
||||
// fprintf(fdsse4,"pi2[%d] = %d\n",i,j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -964,19 +1199,19 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
n is the size in bits of the coded block, with the tail */
|
||||
|
||||
|
||||
llr_t systematic0[n+16] __attribute__ ((aligned(16)));
|
||||
llr_t systematic1[n+16] __attribute__ ((aligned(16)));
|
||||
llr_t systematic2[n+16] __attribute__ ((aligned(16)));
|
||||
llr_t yparity1[n+16] __attribute__ ((aligned(16)));
|
||||
llr_t yparity2[n+16] __attribute__ ((aligned(16)));
|
||||
llr_t systematic0[n+16] __attribute__ ((aligned(32)));
|
||||
llr_t systematic1[n+16] __attribute__ ((aligned(32)));
|
||||
llr_t systematic2[n+16] __attribute__ ((aligned(32)));
|
||||
llr_t yparity1[n+16] __attribute__ ((aligned(32)));
|
||||
llr_t yparity2[n+16] __attribute__ ((aligned(32)));
|
||||
|
||||
llr_t ext[n+128] __attribute__((aligned(16)));
|
||||
llr_t ext2[n+128] __attribute__((aligned(16)));
|
||||
llr_t ext[n+128] __attribute__((aligned(32)));
|
||||
llr_t ext2[n+128] __attribute__((aligned(32)));
|
||||
|
||||
llr_t alpha[(n+16)*8] __attribute__ ((aligned(16)));
|
||||
llr_t beta[(n+16)*8] __attribute__ ((aligned(16)));
|
||||
llr_t m11[n+16] __attribute__ ((aligned(16)));
|
||||
llr_t m10[n+16] __attribute__ ((aligned(16)));
|
||||
llr_t alpha[(n+16)*8] __attribute__ ((aligned(32)));
|
||||
llr_t beta[(n+16)*8] __attribute__ ((aligned(32)));
|
||||
llr_t m11[n+32] __attribute__ ((aligned(32)));
|
||||
llr_t m10[n+32] __attribute__ ((aligned(32)));
|
||||
|
||||
|
||||
int *pi2_p,*pi4_p,*pi5_p,*pi6_p;
|
||||
@@ -989,7 +1224,7 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *yp128;
|
||||
__m128i tmp, zeros=_mm_setzero_si128();
|
||||
register __m128i tmpe;
|
||||
__m128i tmpe;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *yp128;
|
||||
// int16x8_t tmp128[(n+8)>>3];
|
||||
@@ -1000,12 +1235,20 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
#endif
|
||||
int offset8_flag=0;
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fdsse4 = fopen("dump_sse4.txt","w");
|
||||
|
||||
|
||||
printf("tc sse4_16 (y) %p\n",y);
|
||||
#endif
|
||||
|
||||
if (crc_type > 3) {
|
||||
msg("Illegal crc length!\n");
|
||||
printf("Illegal crc length!\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
|
||||
|
||||
start_meas(init_stats);
|
||||
|
||||
|
||||
@@ -1013,7 +1256,7 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++);
|
||||
|
||||
if ( iind == 188 ) {
|
||||
msg("Illegal frame length!\n");
|
||||
printf("Illegal frame length!\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
@@ -1059,62 +1302,74 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
tmpe = _mm_load_si128(yp128);
|
||||
// fprintf(fdsse4,"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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init0: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init1: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init2: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init3: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init4: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init5: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init6: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#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);
|
||||
// printf("init: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"init7: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",j,s[j],yp1[j],yp2[j]);
|
||||
#endif
|
||||
|
||||
#elif defined(__arm__)
|
||||
s[j] = vgetq_lane_s16(yp128[0],0);
|
||||
@@ -1172,7 +1427,7 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
yp1[i] = *yp;
|
||||
yp++;
|
||||
#ifdef DEBUG_LOGMAP
|
||||
msg("Term 1 (%d): %d %d\n",i,s[i],yp1[i]);
|
||||
fprintf(fdsse4,"Term 1 (%d): %d %d\n",i,s[i],yp1[i]);
|
||||
#endif //DEBUG_LOGMAP
|
||||
}
|
||||
|
||||
@@ -1184,12 +1439,12 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
yp2[i-8] = *yp;
|
||||
yp++;
|
||||
#ifdef DEBUG_LOGMAP
|
||||
msg("Term 2 (%d): %d %d\n",i-3,s[i],yp2[i-8]);
|
||||
fprintf(fdsse4,"Term 2 (%d): %d %d\n",i-3,s[i],yp2[i-8]);
|
||||
#endif //DEBUG_LOGMAP
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
msg("\n");
|
||||
fprintf(fdsse4,"\n");
|
||||
#endif //DEBUG_LOGMAP
|
||||
|
||||
stop_meas(init_stats);
|
||||
@@ -1201,7 +1456,7 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
while (iteration_cnt++ < max_iterations) {
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
printf("\n*******************ITERATION %d (n %d), ext %p\n\n",iteration_cnt,n,ext);
|
||||
fprintf(fdsse4,"\n*******************ITERATION %d (n %d), ext %p\n\n",iteration_cnt,n,ext);
|
||||
#endif //DEBUG_LOGMAP
|
||||
|
||||
start_meas(intl1_stats);
|
||||
@@ -1209,24 +1464,29 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
pi4_p=pi4tab16[iind];
|
||||
|
||||
for (i=0; i<(n>>3); i++) { // steady-state portion
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],0);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],1);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],2);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],3);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],4);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],5);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],6);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],((llr_t*)ext)[*pi4_p++],7);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],0);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],1);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],2);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],3);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],4);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],5);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],6);
|
||||
((__m128i *)systematic2)[i]=_mm_insert_epi16(((__m128i *)systematic2)[i],ext[*pi4_p++],7);
|
||||
|
||||
#elif defined(__arm__)
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],0);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],1);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],2);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],3);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],4);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],5);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],6);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(((llr_t*)ext)[*pi4_p++],((int16x8_t*)systematic2)[i],7);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],0);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],1);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],2);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],3);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],4);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],5);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],6);
|
||||
((int16x8_t*)systematic2)[i]=vsetq_lane_s16(ext[*pi4_p++],((int16x8_t*)systematic2)[i],7);
|
||||
#endif
|
||||
#ifdef DEBUG_LOGMAP
|
||||
print_shorts("syst2",(int16_t*)&((__m128i *)systematic2)[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1261,6 +1521,9 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
tmp=vsetq_lane_s16(ext2[*pi5_p++],tmp,6);
|
||||
tmp=vsetq_lane_s16(ext2[*pi5_p++],tmp,7);
|
||||
((int16x8_t *)systematic1)[i] = vqaddq_s16(vqsubq_s16(tmp,((int16x8_t*)ext)[i]),((int16x8_t *)systematic0)[i]);
|
||||
#endif
|
||||
#ifdef DEBUG_LOGMAP
|
||||
print_shorts("syst1",(int16_t*)&((__m128i *)systematic1)[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1278,6 +1541,9 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
tmp=_mm_insert_epi16(tmp, ((llr_t*)ext2)[*pi6_p++],2);
|
||||
tmp=_mm_insert_epi16(tmp, ((llr_t*)ext2)[*pi6_p++],1);
|
||||
tmp=_mm_insert_epi16(tmp, ((llr_t*)ext2)[*pi6_p++],0);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
print_shorts("tmp",(int16_t*)&tmp);
|
||||
#endif
|
||||
tmp=_mm_cmpgt_epi8(_mm_packs_epi16(tmp,zeros),zeros);
|
||||
decoded_bytes[i]=(unsigned char)_mm_movemask_epi8(tmp);
|
||||
#elif defined(__arm__)
|
||||
@@ -1297,6 +1563,10 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
uint64x2_t Mask = vpaddlq_u32(vpaddlq_u16(vandq_u16(vcgtq_s16(tmp,zeros), Powers)));
|
||||
uint64x1_t Mask64 = vget_high_u64(Mask)+vget_low_u64(Mask);
|
||||
decoded_bytes[i] = (uint8_t)Mask64;
|
||||
#endif
|
||||
#ifdef DEBUG_LOGMAP
|
||||
print_shorts("tmp",(int16_t*)&tmp);
|
||||
fprintf(fdsse4,"decoded_bytes[%d] %x\n",i,decoded_bytes[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1344,6 +1614,9 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
}
|
||||
|
||||
stop_meas(intl2_stats);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdsse4,"oldcrc %x, crc %x\n",oldcrc,crc);
|
||||
#endif
|
||||
|
||||
if ((crc == oldcrc) && (crc!=0)) {
|
||||
return(iteration_cnt);
|
||||
@@ -1374,8 +1647,12 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fprintf(fdsse4,"crc %x, oldcrc %x\n",crc,oldcrc);
|
||||
|
||||
// printf("crc %x, oldcrc %x\n",crc,oldcrc);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fclose(fdsse4);
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
_mm_empty();
|
||||
|
||||
@@ -5,7 +5,7 @@ RATE12CC_SRC = ccoding_byte.c viterbi.c crc_byte.c
|
||||
all: 3gpplte_sse
|
||||
|
||||
3gpplte_sse: $(TURBO_SRC)
|
||||
gcc -o 3gpplte_sse 3gpplte_sse.c -msse4 -Wall -g -ggdb -DMAIN
|
||||
gcc -o 3gpplte_sse 3gpplte_sse.c -msse4 -Wall -g -ggdb -DTC_MAIN -I../..
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -483,6 +483,24 @@ uint8_t phy_threegpplte_turbo_decoder16(int16_t *y,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats);
|
||||
|
||||
uint8_t phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint16_t interleaver_f1,
|
||||
uint16_t interleaver_f2,
|
||||
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);
|
||||
|
||||
/*!
|
||||
\brief This routine performs max-logmap detection for the 3GPP turbo code (with termination). It is optimized for SIMD processing and 8-bit
|
||||
LLR arithmetic, and requires SSE2,SSSE3 and SSE4.1 (gcc >=4.3 and appropriate CPU)
|
||||
|
||||
@@ -888,12 +888,16 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms)
|
||||
ccodelte_init();
|
||||
ccodelte_init_inv();
|
||||
|
||||
treillis_table_init();
|
||||
|
||||
phy_generate_viterbi_tables();
|
||||
phy_generate_viterbi_tables_lte();
|
||||
|
||||
init_td8();
|
||||
init_td16();
|
||||
|
||||
#ifdef __AVX2__
|
||||
init_td16avx2();
|
||||
#endif
|
||||
|
||||
lte_sync_time_init(lte_frame_parms);
|
||||
|
||||
|
||||
@@ -38,23 +38,16 @@ extern int card;
|
||||
#endif
|
||||
|
||||
void
|
||||
phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id)
|
||||
phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
|
||||
{
|
||||
|
||||
uint16_t rx_power_fil_dB;
|
||||
#ifdef EXMIMO
|
||||
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
|
||||
uint16_t i;
|
||||
#endif
|
||||
int rssi;
|
||||
|
||||
rssi = dB_fixed(phy_vars_ue->PHY_measurements.rssi);
|
||||
|
||||
if (rssi>0) rx_power_fil_dB = rssi;
|
||||
else rx_power_fil_dB = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id];
|
||||
|
||||
LOG_D(PHY,"Gain control: rssi %d (%d,%d)\n",
|
||||
rssi,
|
||||
rx_power_fil_dB,
|
||||
phy_vars_ue->PHY_measurements.rssi,
|
||||
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id]
|
||||
);
|
||||
|
||||
@@ -213,6 +213,7 @@ int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,floa
|
||||
|
||||
//! Automatic gain control
|
||||
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
|
||||
uint32_t rx_power_fil_dB,
|
||||
unsigned char eNB_id);
|
||||
|
||||
int lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
|
||||
|
||||
@@ -26,187 +26,187 @@
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
short filt24_0[24] __attribute__((aligned(16))) ={
|
||||
short filt24_0[24] __attribute__((aligned(32))) ={
|
||||
2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_0_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_0_dcl[24] __attribute__((aligned(32))) ={
|
||||
2341,4681,7022,9362,11703,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_0_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_0_dcr[24] __attribute__((aligned(32))) ={
|
||||
2730,5461,8192,10922,13653,16384,14043,11703,9362,7022,4681,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
short filt24_1[24] __attribute__((aligned(16))) ={
|
||||
short filt24_1[24] __attribute__((aligned(32))) ={
|
||||
0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_1_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_1_dcl[24] __attribute__((aligned(32))) ={
|
||||
0,4681,7022,9362,11703,14043,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_1_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_1_dcr[24] __attribute__((aligned(32))) ={
|
||||
0,2730,5461,8192,10922,13653,16384,14043,11703,9362,7022,4681,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
|
||||
short filt24_2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_2[24] __attribute__((aligned(32))) ={
|
||||
0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_2_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_2_dcl[24] __attribute__((aligned(32))) ={
|
||||
0,0,2341,4681,7022,9362, 11703,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_2_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_2_dcr[24] __attribute__((aligned(32))) ={
|
||||
0,0,2730,5461,8192,10922,13653,16384,14043,11703,9362,4681,2341,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
// X X X Y | X X X X | X Y X X
|
||||
short filt24_3[24] __attribute__((aligned(16))) ={
|
||||
short filt24_3[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_3_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_3_dcl[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,2341,4681,7022,9362,14043,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
// X X X Y | X X DC X X | X Y X X
|
||||
short filt24_3_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_3_dcr[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,2730,5461,8192,10922,13653,16384,14043,11703,7022,4681,2341,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
|
||||
short filt24_4[24] __attribute__((aligned(16))) ={
|
||||
short filt24_4[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_4_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_4_dcl[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,2341,7022,9362,11703,14043,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_4_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_4_dcr[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,2730,5461,8192,10922,13653,16384,14043,11703,7022,4681,2341,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
short filt24_5[24] __attribute__((aligned(16))) ={
|
||||
short filt24_5[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0
|
||||
};
|
||||
// X X X Y | X X DC X X | X Y X X
|
||||
short filt24_5_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_5_dcl[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,2341,4681,9362,11703,14043,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_5_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_5_dcr[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,2730,5461,8192,10922,13653,16384,11703,9362,7022,4681,2730,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
|
||||
short filt24_6[24] __attribute__((aligned(16))) ={
|
||||
short filt24_6[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_6_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_6_dcl[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,4681,7022,9362,11703,14043,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_6_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_6_dcr[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,14043,11703,9362,7022,4681,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
|
||||
short filt24_7[24] __attribute__((aligned(16))) ={
|
||||
short filt24_7[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_7_dcl[24] __attribute__((aligned(16))) ={
|
||||
short filt24_7_dcl[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,0,4681,7022,9362,11703,14043,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_7_dcr[24] __attribute__((aligned(16))) ={
|
||||
short filt24_7_dcr[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,14043,11703,9362,7022,4681,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
short filt24_0l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_0l[24] __attribute__((aligned(32))) ={
|
||||
30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_1l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_1l[24] __attribute__((aligned(32))) ={
|
||||
0,30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_2l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_2l[24] __attribute__((aligned(32))) ={
|
||||
0,0,30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_3l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_3l[24] __attribute__((aligned(32))) ={
|
||||
//0,0,0,30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0};
|
||||
0,0,0,0,0,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_4l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_4l[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_5l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_5l[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_6l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_6l[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_7l[24] __attribute__((aligned(16))) ={
|
||||
short filt24_7l[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,0,30037,27306,24576,21845,19114,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_0l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_0l2[24] __attribute__((aligned(32))) ={
|
||||
2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_1l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_1l2[24] __attribute__((aligned(32))) ={
|
||||
0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_2l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_2l2[24] __attribute__((aligned(32))) ={
|
||||
-2730,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_3l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_3l2[24] __attribute__((aligned(32))) ={
|
||||
-5461,-2730,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_4l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_4l2[24] __attribute__((aligned(32))) ={
|
||||
-8192,-5461,-2730,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_5l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_5l2[24] __attribute__((aligned(32))) ={
|
||||
0,-8192,-5461,-2730,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_6l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_6l2[24] __attribute__((aligned(32))) ={
|
||||
-13653,-10922,-8192,-5461,-2730,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_7l2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_7l2[24] __attribute__((aligned(32))) ={
|
||||
0,-13653,-10922,-8192,-5461,-2730,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_0r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_0r[24] __attribute__((aligned(32))) ={
|
||||
2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_1r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_1r[24] __attribute__((aligned(32))) ={
|
||||
0,2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_2r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_2r[24] __attribute__((aligned(32))) ={
|
||||
0,0,2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_3r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_3r[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_4r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_4r[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_5r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_5r[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_6r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_6r[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_7r[24] __attribute__((aligned(16))) ={
|
||||
short filt24_7r[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,19114,21845,24576,27306,30037,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_0r2[24] __attribute__((aligned(16))) ={ /****/
|
||||
short filt24_0r2[24] __attribute__((aligned(32))) ={ /****/
|
||||
2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653,0,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_1r2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_1r2[24] __attribute__((aligned(32))) ={
|
||||
0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653,0,0,0,0,0,0
|
||||
};
|
||||
short filt24_2r2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_2r2[24] __attribute__((aligned(32))) ={
|
||||
0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653,0,0,0,0,0
|
||||
};
|
||||
short filt24_3r2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_3r2[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653,0,0,0,0
|
||||
};
|
||||
short filt24_4r2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_4r2[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653,0,0,0
|
||||
};
|
||||
short filt24_5r2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_5r2[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653,0,0
|
||||
};
|
||||
short filt24_6r2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_6r2[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653,0
|
||||
};
|
||||
short filt24_7r2[24] __attribute__((aligned(16))) ={
|
||||
short filt24_7r2[24] __attribute__((aligned(32))) ={
|
||||
0,0,0,0,0,0,0,2730,5461,8192,10922,13653,16384,13653,10922,8192,5461,2730,0,-2730,-5461,-8192,-10922,-13653
|
||||
};
|
||||
|
||||
@@ -203,8 +203,9 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
multadd_complex_vector_real_scalar(dl_ch-(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1),
|
||||
phy_vars_ue->ch_est_alpha,dl_ch-(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1),
|
||||
1,phy_vars_ue->lte_frame_parms.ofdm_symbol_size);
|
||||
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("k %d, first_carrier %d\n",k,phy_vars_ue->lte_frame_parms.first_carrier_offset);
|
||||
#endif
|
||||
if ((phy_vars_ue->lte_frame_parms.N_RB_DL==6) ||
|
||||
(phy_vars_ue->lte_frame_parms.N_RB_DL==50) ||
|
||||
(phy_vars_ue->lte_frame_parms.N_RB_DL==100)) {
|
||||
@@ -213,7 +214,9 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
// Treat first 2 pilots specially (left edge)
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
// printf("pilot 0 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot 0 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fl,
|
||||
ch,
|
||||
dl_ch,
|
||||
@@ -224,7 +227,9 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
// printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(f2l2,
|
||||
ch,
|
||||
dl_ch,
|
||||
@@ -235,15 +240,13 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
for (pilot_cnt=2; pilot_cnt<((phy_vars_ue->lte_frame_parms.N_RB_DL)-1); pilot_cnt+=2) {
|
||||
|
||||
// printf("%d\n",dl_ch-(int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset]);
|
||||
|
||||
// printf("pilot[%d][%d] (%d,%d)\n",p,pilot_cnt,pil[0],pil[1]);
|
||||
// printf("rx[%d] -> (%d,%d)\n", k, rxF[0], rxF[1]);
|
||||
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); //Re
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); //Im
|
||||
// printf("**rb %d %d\n",rb,dl_ch-(int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset]);
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(f,
|
||||
ch,
|
||||
dl_ch,
|
||||
@@ -254,13 +257,11 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
rxF+=12;
|
||||
dl_ch+=8;
|
||||
|
||||
// printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
|
||||
// printf("rx[%d] -> (%d,%d)\n", k+6, rxF[0], rxF[1]);
|
||||
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
// printf("**rb %d %d\n",rb,dl_ch-(int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset]);
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(f2,
|
||||
ch,
|
||||
dl_ch,
|
||||
@@ -281,15 +282,17 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))];
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("second half k %d\n",k);
|
||||
#endif
|
||||
for (pilot_cnt=0; pilot_cnt<((phy_vars_ue->lte_frame_parms.N_RB_DL)-3); pilot_cnt+=2) {
|
||||
// printf("pilot[%d][%d] (%d,%d)\n",p,pilot_cnt,pil[0],pil[1]);
|
||||
// printf("rx[%d] -> (%d,%d)\n", k+6, rxF[0], rxF[1]);
|
||||
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
// printf("**rb %d %d\n",rb,dl_ch-(int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset]);
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(f,
|
||||
ch,
|
||||
dl_ch,
|
||||
@@ -300,8 +303,9 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
// printf("**rb %d %d\n",rb,dl_ch-(int16_T *)&dl_ch_estimates[(p<<1)+aarx][ch_offset]);
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(f2,
|
||||
ch,
|
||||
dl_ch,
|
||||
@@ -314,8 +318,9 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
// printf("pilot 49: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot %d: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fr,
|
||||
ch,
|
||||
dl_ch,
|
||||
@@ -326,7 +331,9 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
// printf("pilot 50: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#ifdef DEBUG_CH
|
||||
printf("pilot %d: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(f2r2,
|
||||
ch,
|
||||
dl_ch,
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
int* sync_corr_ue0 = NULL;
|
||||
int* sync_corr_ue1 = NULL;
|
||||
int* sync_corr_ue2 = NULL;
|
||||
int sync_tmp[2048*4] __attribute__((aligned(16)));
|
||||
short syncF_tmp[2048*2] __attribute__((aligned(16)));
|
||||
int sync_tmp[2048*4] __attribute__((aligned(32)));
|
||||
short syncF_tmp[2048*2] __attribute__((aligned(32)));
|
||||
|
||||
|
||||
|
||||
@@ -485,13 +485,10 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
|
||||
|
||||
*eNB_id = sync_source;
|
||||
|
||||
LOG_D(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
|
||||
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
msg("[PHY][UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d\n",
|
||||
sync_source,peak_pos,peak_val);
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@@ -56,8 +56,8 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
{
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
UE_SCAN_INFO_t *scan_info = &ue->scan_info[band];
|
||||
int16_t spectrum[12288] __attribute__((aligned(16)));
|
||||
int16_t spectrum_p5ms[12288] __attribute__((aligned(16)));
|
||||
int16_t spectrum[12288] __attribute__((aligned(32)));
|
||||
int16_t spectrum_p5ms[12288] __attribute__((aligned(32)));
|
||||
int i,f,band_idx;
|
||||
__m128i autocorr0[256/4],autocorr1[256/4],autocorr2[256/4];
|
||||
__m128i autocorr0_t[256/4],autocorr1_t[256/4],autocorr2_t[256/4];
|
||||
|
||||
@@ -61,21 +61,18 @@ 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
|
||||
// printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
|
||||
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);
|
||||
// printf("x1 : %x, x2 : %x\n",x1,x2);
|
||||
}
|
||||
|
||||
for (n=0; n<14; n++) {
|
||||
@@ -84,7 +81,6 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
|
||||
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
|
||||
lte_gold_table[ns][l][n] = x1^x2;
|
||||
// printf("n=%d : c %x\n",n,x1^x2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4467,7 +4467,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
|
||||
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
|
||||
|
||||
if (TPC!=1)
|
||||
LOG_I(PHY,"format1 TPC %d, dlsch0_harq->delta_PUCCH %d\n",TPC,dlsch0_harq->delta_PUCCH);
|
||||
LOG_D(PHY,"format1 TPC %d, dlsch0_harq->delta_PUCCH %d\n",TPC,dlsch0_harq->delta_PUCCH);
|
||||
|
||||
dlsch0_harq->rvidx = rv;
|
||||
|
||||
@@ -4476,7 +4476,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
|
||||
|
||||
dlsch0_harq->dl_power_off = 1; //no power offset
|
||||
|
||||
LOG_D(PHY,"UE (%x/%d): Subframe %d Format2 DCI: ndi %d, old_ndi %d (first tx %d) harq_status %d\n",dlsch[0]->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi,
|
||||
LOG_D(PHY,"UE (%x/%d): Subframe %d Format1 DCI: ndi %d, old_ndi %d (first tx %d) harq_status %d\n",dlsch[0]->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi,
|
||||
dlsch0_harq->first_tx,dlsch0_harq->status);
|
||||
|
||||
// printf("Format2 DCI (UE, hard pid %d): ndi %d, old_ndi %d (first tx %d)\n",harq_pid,ndi,dlsch0_harq->DCINdi,
|
||||
|
||||
@@ -572,6 +572,10 @@ typedef struct {
|
||||
vrb_t vrb_type;
|
||||
/// downlink power offset field
|
||||
uint8_t dl_power_off;
|
||||
/// trials per round statistics
|
||||
uint32_t trials[8];
|
||||
/// error statistics per round
|
||||
uint32_t errors[8];
|
||||
} LTE_DL_UE_HARQ_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -117,7 +117,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
|
||||
dlsch->max_turbo_iterations = max_turbo_iterations;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
// msg("new_ue_dlsch: Harq process %d\n",i);
|
||||
// printf("new_ue_dlsch: Harq process %d\n",i);
|
||||
dlsch->harq_processes[i] = (LTE_DL_UE_HARQ_t *)malloc16(sizeof(LTE_DL_UE_HARQ_t));
|
||||
|
||||
if (dlsch->harq_processes[i]) {
|
||||
@@ -156,7 +156,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
|
||||
return(dlsch);
|
||||
}
|
||||
|
||||
msg("new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(LTE_DL_UE_HARQ_t), exit_flag);
|
||||
printf("new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(LTE_DL_UE_HARQ_t), exit_flag);
|
||||
free_ue_dlsch(dlsch);
|
||||
|
||||
return(NULL);
|
||||
@@ -187,6 +187,27 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
uint8_t crc_type;
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
uint16_t i;
|
||||
#endif
|
||||
#ifdef __AVX2__
|
||||
int Kr_last,skipped_last=0;
|
||||
uint8_t (*tc_2cw)(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *,
|
||||
uint8_t *,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *);
|
||||
|
||||
#endif
|
||||
uint8_t (*tc)(int16_t *y,
|
||||
uint8_t *,
|
||||
@@ -204,28 +225,35 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
time_stats_t *,
|
||||
time_stats_t *);
|
||||
|
||||
|
||||
|
||||
|
||||
if (!dlsch_llr) {
|
||||
msg("dlsch_decoding.c: NULL dlsch_llr pointer\n");
|
||||
printf("dlsch_decoding.c: NULL dlsch_llr pointer\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (!harq_process) {
|
||||
msg("dlsch_decoding.c: NULL harq_process pointer\n");
|
||||
printf("dlsch_decoding.c: NULL harq_process pointer\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (!frame_parms) {
|
||||
msg("dlsch_decoding.c: NULL frame_parms pointer\n");
|
||||
printf("dlsch_decoding.c: NULL frame_parms pointer\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (subframe>9) {
|
||||
msg("dlsch_decoding.c: Illegal subframe index %d\n",subframe);
|
||||
printf("dlsch_decoding.c: Illegal subframe index %d\n",subframe);
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (llr8_flag == 0)
|
||||
if (llr8_flag == 0) {
|
||||
#ifdef __AVX2__
|
||||
tc_2cw = phy_threegpplte_turbo_decoder16avx2;
|
||||
#endif
|
||||
tc = phy_threegpplte_turbo_decoder16;
|
||||
}
|
||||
else
|
||||
tc = phy_threegpplte_turbo_decoder8;
|
||||
|
||||
@@ -233,16 +261,19 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
/*
|
||||
if (nb_rb > frame_parms->N_RB_DL) {
|
||||
msg("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb);
|
||||
printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb);
|
||||
return(max_turbo_iterations);
|
||||
}*/
|
||||
|
||||
/*harq_pid = dlsch->current_harq_pid;
|
||||
if (harq_pid >= 8) {
|
||||
msg("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid);
|
||||
printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid);
|
||||
return(max_turbo_iterations);
|
||||
}
|
||||
*/
|
||||
|
||||
harq_process->trials[harq_process->round]++;
|
||||
|
||||
A = harq_process->TBS; //2072 for QPSK 1/3
|
||||
|
||||
ret = dlsch->max_turbo_iterations;
|
||||
@@ -251,7 +282,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
G = harq_process->G;
|
||||
//get_G(frame_parms,nb_rb,dlsch->rb_alloc,mod_order,num_pdcch_symbols,phy_vars_ue->frame,subframe);
|
||||
|
||||
// msg("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi);
|
||||
// printf("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi);
|
||||
|
||||
if (harq_process->round == 0) {
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
@@ -270,7 +301,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
/*
|
||||
else {
|
||||
msg("dlsch_decoding.c: Ndi>0 not checked yet!!\n");
|
||||
printf("dlsch_decoding.c: Ndi>0 not checked yet!!\n");
|
||||
return(max_turbo_iterations);
|
||||
}
|
||||
*/
|
||||
@@ -297,10 +328,14 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
break;
|
||||
}
|
||||
|
||||
if (harq_process->C >= MAX_NUM_DLSCH_SEGMENTS/bw_scaling) {
|
||||
if (harq_process->C > MAX_NUM_DLSCH_SEGMENTS/bw_scaling) {
|
||||
LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,MAX_NUM_DLSCH_SEGMENTS/bw_scaling);
|
||||
return((1+dlsch->max_turbo_iterations));
|
||||
}
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus);
|
||||
#endif
|
||||
|
||||
for (r=0; r<harq_process->C; r++) {
|
||||
|
||||
|
||||
@@ -321,7 +356,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
msg("dlsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
printf("dlsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
@@ -415,15 +450,12 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
printf("\n");
|
||||
*/
|
||||
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
if (err_flag == 0) {
|
||||
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#ifdef TURBO_S
|
||||
ret = phy_threegpplte_turbo_decoder_scalar
|
||||
#else
|
||||
|
||||
ret = tc
|
||||
#endif
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
@@ -443,7 +475,130 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
}
|
||||
#else
|
||||
if ((harq_process->C == 1) ||
|
||||
((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments
|
||||
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
// printf("single decode, exit\n");
|
||||
// exit(-1);
|
||||
}
|
||||
else {
|
||||
// we can merge code segments
|
||||
if ((skipped_last == 0) && (r<harq_process->C-1)) {
|
||||
skipped_last = 1;
|
||||
Kr_last = Kr;
|
||||
}
|
||||
else {
|
||||
skipped_last=0;
|
||||
|
||||
if (Kr_last == Kr) { // decode 2 code segments with AVX2 version
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("single decoding segment %d (%p)\n",r-1,&harq_process->d[r-1][96]);
|
||||
#endif
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("double decoding segments %d,%d (%p,%p)\n",r-1,r,&harq_process->d[r-1][96],&harq_process->d[r][96]);
|
||||
#endif
|
||||
ret = tc_2cw
|
||||
(&harq_process->d[r-1][96],
|
||||
&harq_process->d[r][96],
|
||||
harq_process->c[r-1],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
/*
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
|
||||
exit(-1);*/
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
}
|
||||
else { // Kr_last != Kr
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_turbo_iterations))) {// a Code segment is in error so break;
|
||||
@@ -457,6 +612,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
dlsch->harq_ack[subframe].ack = 0;
|
||||
dlsch->harq_ack[subframe].harq_id = harq_pid;
|
||||
dlsch->harq_ack[subframe].send_harq_status = 1;
|
||||
harq_process->errors[harq_process->round]++;
|
||||
harq_process->round++;
|
||||
|
||||
// LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
||||
|
||||
@@ -281,7 +281,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
|
||||
// avgs = cmax(avgs,avg[(aarx<<1)+aatx]);
|
||||
|
||||
|
||||
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2);
|
||||
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2)+1;
|
||||
// + log2_approx(frame_parms->nb_antennas_tx_eNB-1) //-1 because log2_approx counts the number of bits
|
||||
// + log2_approx(frame_parms->nb_antennas_rx-1);
|
||||
|
||||
@@ -1898,17 +1898,17 @@ void dlsch_channel_compensation_TM3(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
|
||||
dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; // hr,0
|
||||
dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; // hr,1
|
||||
|
||||
|
||||
dl_ch_mag0_128 = (__m128i *)&dl_ch_mag0[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
dl_ch_mag0_128b = (__m128i *)&dl_ch_magb0[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
dl_ch_mag1_128 = (__m128i *)&dl_ch_mag1[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
dl_ch_mag1_128b = (__m128i *)&dl_ch_magb1[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
rxdataF_comp0_128 = (__m128i *)&rxdataF_comp0[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
rxdataF_comp1_128 = (__m128i *)&rxdataF_comp1[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; // yr
|
||||
rxdataF_comp0_128 = (__m128i *)&rxdataF_comp0[aarx][symbol*frame_parms->N_RB_DL*12]; // yr,0 = yr * conj(hr,0)
|
||||
rxdataF_comp1_128 = (__m128i *)&rxdataF_comp1[aarx][symbol*frame_parms->N_RB_DL*12]; // yr,1 = yr * conj(hr,1)
|
||||
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
|
||||
@@ -280,7 +280,6 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
|
||||
uint8_t flip_fdd_ncp,flip_fdd_ecp,flip_tdd_ncp,flip_tdd_ecp;
|
||||
// uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0;
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms;
|
||||
int i;
|
||||
int ret=-1;
|
||||
int aarx,rx_power=0;
|
||||
/*#ifdef OAI_USRP
|
||||
@@ -309,34 +308,6 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
|
||||
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n",phy_vars_ue->Mod_id,sync_pos,phy_vars_ue->lte_ue_common_vars.eNb_id);
|
||||
#endif
|
||||
|
||||
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
|
||||
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][sync_pos2],
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
|
||||
|
||||
phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] = dB_fixed(rx_power/frame_parms->nb_antennas_rx);
|
||||
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",phy_vars_ue->Mod_id,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] );
|
||||
#endif
|
||||
|
||||
#ifdef EXMIMO
|
||||
|
||||
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
||||
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
||||
//phy_adjust_gain(phy_vars_ue,0);
|
||||
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
|
||||
|
||||
#else
|
||||
#ifndef OAI_USRP
|
||||
#ifndef OAI_BLADERF
|
||||
#ifndef OAI_LMSSDR
|
||||
phy_adjust_gain(phy_vars_ue,0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// SSS detection
|
||||
|
||||
// PSS is hypothesized in last symbol of first slot in Frame
|
||||
@@ -525,20 +496,20 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
|
||||
#endif
|
||||
|
||||
if (phy_vars_ue->UE_scan_carrier == 0) {
|
||||
#ifdef OPENAIR2
|
||||
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",phy_vars_ue->Mod_id);
|
||||
//mac_resynch();
|
||||
mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,0,1);//phy_vars_ue->lte_ue_common_vars.eNb_id);
|
||||
#endif //OPENAIR2
|
||||
|
||||
if (phy_vars_ue->mac_enabled==1) {
|
||||
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",phy_vars_ue->Mod_id);
|
||||
//mac_resynch();
|
||||
mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,0,1);//phy_vars_ue->lte_ue_common_vars.eNb_id);
|
||||
phy_vars_ue->UE_mode[0] = PRACH;
|
||||
}
|
||||
else {
|
||||
phy_vars_ue->UE_mode[0] = PUSCH;
|
||||
}
|
||||
|
||||
generate_pcfich_reg_mapping(frame_parms);
|
||||
generate_phich_reg_mapping(frame_parms);
|
||||
// init_prach625(frame_parms);
|
||||
#ifndef OPENAIR2
|
||||
phy_vars_ue->UE_mode[0] = PUSCH;
|
||||
#else
|
||||
phy_vars_ue->UE_mode[0] = PRACH;
|
||||
#endif
|
||||
|
||||
//phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors=0;
|
||||
phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_conseq=0;
|
||||
//phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_last=0;
|
||||
@@ -592,6 +563,65 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
|
||||
|
||||
}
|
||||
|
||||
// gain control
|
||||
if (ret!=0) { //we are not synched, so we cannot use rssi measurement (which is based on channel estimates)
|
||||
rx_power = 0;
|
||||
|
||||
// do a measurement on the best guess of the PSS
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
|
||||
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][sync_pos2],
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
|
||||
|
||||
/*
|
||||
// do a measurement on the full frame
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
|
||||
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][0],
|
||||
frame_parms->samples_per_tti*10);
|
||||
*/
|
||||
|
||||
// we might add a low-pass filter here later
|
||||
phy_vars_ue->PHY_measurements.rx_power_avg[0] = rx_power/frame_parms->nb_antennas_rx;
|
||||
|
||||
phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] = dB_fixed(phy_vars_ue->PHY_measurements.rx_power_avg[0]);
|
||||
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",phy_vars_ue->Mod_id,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] );
|
||||
#endif
|
||||
|
||||
#ifdef EXMIMO
|
||||
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
||||
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
||||
//phy_adjust_gain(phy_vars_ue,0);
|
||||
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
|
||||
|
||||
#else
|
||||
#ifndef OAI_USRP
|
||||
#ifndef OAI_BLADERF
|
||||
#ifndef OAI_LMSSDR
|
||||
phy_adjust_gain(phy_vars_ue,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef EXMIMO
|
||||
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
||||
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
||||
//phy_adjust_gain(phy_vars_ue,0);
|
||||
gain_control_all(dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||
|
||||
#else
|
||||
#ifndef OAI_USRP
|
||||
#ifndef OAI_BLADERF
|
||||
#ifndef OAI_LMSSDR
|
||||
phy_adjust_gain(phy_vars_ue,dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// exit_fun("debug exit");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
|
||||
uint8_t preamble_index = phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex;
|
||||
uint8_t tdd_mapindex = phy_vars_ue->prach_resources[eNB_id]->ra_TDD_map_index;
|
||||
int16_t *prachF = phy_vars_ue->lte_ue_prach_vars[eNB_id]->prachF;
|
||||
static int16_t prach_tmp[45600*2] __attribute__((aligned(16)));
|
||||
static int16_t prach_tmp[45600*2] __attribute__((aligned(32)));
|
||||
int16_t *prach = prach_tmp;
|
||||
int16_t *prach2;
|
||||
int16_t amp = phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp;
|
||||
|
||||
@@ -61,6 +61,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
|
||||
uint8_t eNB=0;
|
||||
uint32_t RRC_status;
|
||||
int len=length;
|
||||
int harq_pid,round;
|
||||
|
||||
if (phy_vars_ue==NULL)
|
||||
return 0;
|
||||
@@ -107,10 +108,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
|
||||
len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",phy_vars_ue->timing_advance);
|
||||
if (phy_vars_ue->UE_mode[0]==PUSCH) {
|
||||
len += sprintf(&buffer[len], "[UE PROC] Po_PUSCH = %d dBm (PL %d dB, Po_NOMINAL_PUSCH %d dBm, PHR %d dB)\n",
|
||||
PHY_vars_UE_g[0][0]->ulsch_ue[0]->Po_PUSCH,
|
||||
phy_vars_ue->ulsch_ue[0]->Po_PUSCH,
|
||||
get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,0),
|
||||
mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0),
|
||||
PHY_vars_UE_g[0][0]->ulsch_ue[0]->PHR);
|
||||
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
|
||||
phy_vars_ue->ulsch_ue[0]->PHR);
|
||||
len += sprintf(&buffer[len], "[UE PROC] Po_PUCCH = %d dBm (Po_NOMINAL_PUCCH %d dBm, g_pucch %d dB)\n",
|
||||
get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,0)+
|
||||
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH+
|
||||
@@ -488,13 +489,27 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
|
||||
if (phy_vars_ue->transmission_mode[eNB] == 6)
|
||||
len += sprintf(&buffer[len], "[UE PROC] Mode 6 Wideband CQI eNB %d : %d dB\n",eNB,phy_vars_ue->PHY_measurements.precoded_cqi_dB[eNB][0]);
|
||||
|
||||
for (harq_pid=0;harq_pid<8;harq_pid++) {
|
||||
len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 0 harq_pid %d, mcs %d:",eNB,harq_pid,phy_vars_ue->dlsch_ue[0][0]->harq_processes[harq_pid]->mcs);
|
||||
for (round=0;round<8;round++)
|
||||
len+=sprintf(&buffer[len],"%d/%d ",
|
||||
phy_vars_ue->dlsch_ue[0][0]->harq_processes[harq_pid]->errors[round],
|
||||
phy_vars_ue->dlsch_ue[0][0]->harq_processes[harq_pid]->trials[round]);
|
||||
len+=sprintf(&buffer[len],"\n");
|
||||
}
|
||||
if (phy_vars_ue->dlsch_ue[0] && phy_vars_ue->dlsch_ue[0][0] && phy_vars_ue->dlsch_ue[0][1]) {
|
||||
len += sprintf(&buffer[len], "[UE PROC] Saved PMI for DLSCH eNB %d : %jx (%p)\n",eNB,pmi2hex_2Ar1(phy_vars_ue->dlsch_ue[0][0]->pmi_alloc),phy_vars_ue->dlsch_ue[0][0]);
|
||||
|
||||
len += sprintf(&buffer[len], "[UE PROC] eNB %d: dl_power_off = %d\n",eNB,phy_vars_ue->dlsch_ue[0][0]->harq_processes[0]->dl_power_off);
|
||||
|
||||
len += sprintf(&buffer[len], "[UE PROC] DL mcs1 (dlsch cw1) %d\n",phy_vars_ue->dlsch_ue[0][0]->harq_processes[0]->mcs);
|
||||
len += sprintf(&buffer[len], "[UE PROC] DL mcs2 (dlsch cw2) %d\n",phy_vars_ue->dlsch_ue[0][1]->harq_processes[0]->mcs);
|
||||
for (harq_pid=0;harq_pid<8;harq_pid++) {
|
||||
len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 1 harq_pid %d, mcs %d:",eNB,harq_pid,phy_vars_ue->dlsch_ue[0][1]->harq_processes[0]->mcs);
|
||||
for (round=0;round<8;round++)
|
||||
len+=sprintf(&buffer[len],"%d/%d ",
|
||||
phy_vars_ue->dlsch_ue[0][1]->harq_processes[harq_pid]->errors[round],
|
||||
phy_vars_ue->dlsch_ue[0][1]->harq_processes[harq_pid]->trials[round]);
|
||||
len+=sprintf(&buffer[len],"\n");
|
||||
}
|
||||
}
|
||||
|
||||
len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",phy_vars_ue->dlsch_received[0],phy_vars_ue->dlsch_errors[0],phy_vars_ue->dlsch_fer[0]);
|
||||
@@ -582,9 +597,7 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length)
|
||||
len += sprintf(&buffer[len],"%4d ",
|
||||
phy_vars_eNB->PHY_measurements_eNB[eNB].n0_subband_power_tot_dBm[i]);
|
||||
if ((i>0) && ((i%25) == 0))
|
||||
len += sprintf(&buffer[len],"\n ",
|
||||
phy_vars_eNB->PHY_measurements_eNB[eNB].n0_subband_power_tot_dBm[i]);
|
||||
|
||||
len += sprintf(&buffer[len],"\n");
|
||||
}
|
||||
len += sprintf(&buffer[len],"\n");
|
||||
len += sprintf(&buffer[len],"\nPERFORMANCE PARAMETERS\n");
|
||||
|
||||
@@ -91,7 +91,7 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
|
||||
)
|
||||
{
|
||||
|
||||
static short temp[2048*4] __attribute__((aligned(16)));
|
||||
static short temp[2048*4] __attribute__((aligned(32)));
|
||||
unsigned short i,j;
|
||||
short k;
|
||||
|
||||
@@ -143,9 +143,18 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
|
||||
printf("[PHY] symbol %d/%d offset %d (%p,%p -> %p)\n",i,nb_symbols,i*fftsize+(i*nb_prefix_samples),input,&input[i*fftsize],&output[(i*fftsize) + ((i)*nb_prefix_samples)]);
|
||||
#endif
|
||||
|
||||
#ifndef __AVX2__
|
||||
// handle 128-bit alignment for 128-bit SIMD (SSE4,NEON,AltiVEC)
|
||||
idft((int16_t *)&input[i*fftsize],
|
||||
(fftsize==128) ? (int16_t *)temp : (int16_t *)&output[(i*fftsize) + ((1+i)*nb_prefix_samples)],
|
||||
1);
|
||||
#else
|
||||
// on AVX2 need 256-bit alignment
|
||||
idft((int16_t *)&input[i*fftsize],
|
||||
(fftsize<=512) ? (int16_t *)temp : (int16_t *)&output[(i*fftsize) + ((1+i)*nb_prefix_samples)],
|
||||
1);
|
||||
|
||||
#endif
|
||||
|
||||
// Copy to frame buffer with Cyclic Extension
|
||||
// Note: will have to adjust for synchronization offset!
|
||||
@@ -158,7 +167,12 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
|
||||
|
||||
// msg("Doing cyclic prefix method\n");
|
||||
|
||||
if (fftsize==128) {
|
||||
#ifndef __AVX2__
|
||||
if (fftsize==128)
|
||||
#else
|
||||
if (fftsize<=512)
|
||||
#endif
|
||||
{
|
||||
for (j=0; j<fftsize ; j++) {
|
||||
output_ptr[j] = temp_ptr[j];
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
|
||||
unsigned int rx_offset;
|
||||
|
||||
void (*dft)(int16_t *,int16_t *, int);
|
||||
int tmp_dft_in[256]; // This is for misalignment issues for 6 and 15 PRBs
|
||||
int tmp_dft_in[2048]; // This is for misalignment issues for 6 and 15 PRBs
|
||||
|
||||
switch (frame_parms->ofdm_symbol_size) {
|
||||
case 128:
|
||||
@@ -115,8 +115,8 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
|
||||
memset(&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
|
||||
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 + subframe_offset - SOFFSET;
|
||||
// Align with 128 bit
|
||||
rx_offset = rx_offset - rx_offset % 4;
|
||||
// Align with 256 bit
|
||||
// rx_offset = rx_offset&0xfffffff8;
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (phy_vars_ue->frame <100)
|
||||
@@ -131,9 +131,9 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
|
||||
(short *)&ue_common_vars->rxdata[aa][0],
|
||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
|
||||
if ((rx_offset&3)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
|
||||
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
|
||||
memcpy((void *)tmp_dft_in,
|
||||
(void *)&ue_common_vars->rxdata[aa][(rx_offset-nb_prefix_samples0) % frame_length_samples],
|
||||
(void *)&ue_common_vars->rxdata[aa][rx_offset % frame_length_samples],
|
||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
dft((int16_t *)tmp_dft_in,
|
||||
(int16_t *)&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
@@ -146,8 +146,8 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
}
|
||||
} else {
|
||||
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples) +
|
||||
(frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
|
||||
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
|
||||
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (phy_vars_ue->frame <100)
|
||||
@@ -162,7 +162,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
start_meas(&phy_vars_ue->rx_dft_stats);
|
||||
|
||||
if ((rx_offset&3)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
|
||||
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
|
||||
memcpy((void *)tmp_dft_in,
|
||||
(void *)&ue_common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
lte_dfts: lte_dfts.c
|
||||
gcc -O2 -mavx2 -g -ggdb -o lte_dfts lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
||||
lte_dfts_sse4: lte_dfts.c
|
||||
gcc -O2 -msse4.1 -g -ggdb -o lte_dfts_sse4 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
||||
|
||||
lte_dfts.s: lte_dfts.c
|
||||
lte_dfts_avx2: lte_dfts.c
|
||||
gcc -O2 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
||||
|
||||
lte_dfts_avx2.s: lte_dfts.c
|
||||
gcc -O2 -mavx2 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
||||
|
||||
dft_cycles: lte_dfts
|
||||
./lte_dfts | egrep cycles
|
||||
lte_dfts_sse4.s: lte_dfts.c
|
||||
gcc -O2 -msse4.1 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
||||
|
||||
dft_cycles_avx2: lte_dfts_avx2
|
||||
./lte_dfts_avx2 | egrep cycles
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
#include "defs.h"
|
||||
|
||||
int mult_cpx_matrix_h(short *x1[2][2],
|
||||
short *x2[2][2],
|
||||
short *y[2][2],
|
||||
unsigned int N,
|
||||
unsigned short output_shift,
|
||||
short hermitian)
|
||||
{
|
||||
|
||||
if (hermitian) {
|
||||
// this computes x1^H*x2 and stores it in y
|
||||
mult_cpx_vector_h(x2[0][0],x1[0][0],y[0][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x2[0][1],x1[0][1],y[0][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x2[0][0],x1[1][0],y[1][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x2[0][1],x1[1][1],y[1][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x2[1][0],x1[0][0],y[0][1],N,output_shift,1);
|
||||
mult_cpx_vector_h(x2[1][1],x1[0][1],y[0][1],N,output_shift,1);
|
||||
mult_cpx_vector_h(x2[1][0],x1[1][0],y[1][1],N,output_shift,1);
|
||||
mult_cpx_vector_h(x2[1][1],x1[1][1],y[1][1],N,output_shift,1);
|
||||
} else {
|
||||
// this computes x1*x2^H and stores it in y
|
||||
mult_cpx_vector_h(x1[0][0],x2[0][0],y[0][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x1[0][1],x2[0][1],y[0][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x1[0][0],x2[1][0],y[0][1],N,output_shift,1);
|
||||
mult_cpx_vector_h(x1[0][1],x2[1][1],y[0][1],N,output_shift,1);
|
||||
mult_cpx_vector_h(x1[1][0],x2[0][0],y[1][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x1[1][1],x2[0][1],y[1][0],N,output_shift,1);
|
||||
mult_cpx_vector_h(x1[1][0],x2[1][0],y[1][1],N,output_shift,1);
|
||||
mult_cpx_vector_h(x1[1][1],x2[1][1],y[1][1],N,output_shift,1);
|
||||
}
|
||||
}
|
||||
|
||||
int mult_cpx_matrix_vector(int *x1[2][2],
|
||||
int *x2[2],
|
||||
int *y[2],
|
||||
unsigned int N,
|
||||
unsigned short output_shift)
|
||||
{
|
||||
|
||||
Zero_Buffer(y[0],N*8);
|
||||
Zero_Buffer(y[1],N*8);
|
||||
|
||||
// this computes x1*x2 and stores it in y (32 bit)
|
||||
mult_cpx_vector_add32((short*)x2[0],(short*)x1[0][0],(short*)y[0],N);
|
||||
mult_cpx_vector_add32((short*)x2[1],(short*)x1[0][1],(short*)y[0],N);
|
||||
mult_cpx_vector_add32((short*)x2[0],(short*)x1[1][0],(short*)y[1],N);
|
||||
mult_cpx_vector_add32((short*)x2[1],(short*)x1[1][1],(short*)y[1],N);
|
||||
|
||||
// shift and pack
|
||||
shift_and_pack((short*)y[0],N,output_shift);
|
||||
shift_and_pack((short*)y[1],N,output_shift);
|
||||
|
||||
}
|
||||
|
||||
#ifdef MAIN_MM
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
main ()
|
||||
{
|
||||
short x1_00[256] __attribute__((aligned(16)));
|
||||
short x1_10[256] __attribute__((aligned(16)));
|
||||
short x1_01[256] __attribute__((aligned(16)));
|
||||
short x1_11[256] __attribute__((aligned(16)));
|
||||
short x2_0[256] __attribute__((aligned(16)));
|
||||
short x2_1[256] __attribute__((aligned(16)));
|
||||
short y_0[256] __attribute__((aligned(16)));
|
||||
short y_1[256] __attribute__((aligned(16)));
|
||||
|
||||
int *x1[2][2];
|
||||
int *x2[2];
|
||||
int *y[2];
|
||||
int i,m,n;
|
||||
|
||||
x1[0][0] = (int*)x1_00;
|
||||
x1[0][1] = (int*)x1_01;
|
||||
x1[1][0] = (int*)x1_10;
|
||||
x1[1][1] = (int*)x1_11;
|
||||
x2[0] = (int*)x2_0;
|
||||
x2[1] = (int*)x2_1;
|
||||
y[0] = (int*)y_0;
|
||||
y[1] = (int*)y_1;
|
||||
|
||||
for(m=0; m<2; m++) {
|
||||
for(n=0; n<2; n++) {
|
||||
for(i=0; i<256; i+=4) {
|
||||
((short*)x1[m][n])[i] = ((short) rand())/4;
|
||||
((short*)x1[m][n])[i+1] = ((short) rand())/4;
|
||||
((short*)x1[m][n])[i+2] = -((short*)x1[m][n])[i+1];
|
||||
((short*)x1[m][n])[i+3] = ((short*)x1[m][n])[i];
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<256; i+=4) {
|
||||
((short*)x2[m])[i] = ((short) rand())/4;
|
||||
((short*)x2[m])[i+1] = ((short) rand())/4;
|
||||
((short*)x2[m])[i+2] = ((short*)x2[m])[i];
|
||||
((short*)x2[m])[i+3] = ((short*)x2[m])[i+1];
|
||||
}
|
||||
|
||||
Zero_Buffer(y[m],512);
|
||||
}
|
||||
|
||||
/*
|
||||
input[0] = 100;
|
||||
input[1] = 200;
|
||||
input[2] = -200;
|
||||
input[3] = 100;
|
||||
input[4] = 1000;
|
||||
input[5] = 2000;
|
||||
input[6] = -2000;
|
||||
input[7] = 1000;
|
||||
input[8] = 100;
|
||||
input[9] = 200;
|
||||
input[10] = -200;
|
||||
input[11] = 100;
|
||||
input[12] = 1000;
|
||||
input[13] = 2000;
|
||||
input[14] = -2000;
|
||||
input[15] = 1000;
|
||||
|
||||
input2[0] = 2;
|
||||
input2[1] = 1;
|
||||
input2[2] = 2;
|
||||
input2[3] = 1;
|
||||
input2[4] = 20;
|
||||
input2[5] = 10;
|
||||
input2[6] = 20;
|
||||
input2[7] = 10;
|
||||
input2[8] = 2;
|
||||
input2[9] = 1;
|
||||
input2[10] = 2;
|
||||
input2[11] = 1;
|
||||
input2[12] = 2000;
|
||||
input2[13] = 1000;
|
||||
input2[14] = 2000;
|
||||
input2[15] = 1000;
|
||||
|
||||
x1[0][0] = (int*)input;
|
||||
x1[0][1] = (int*)input;
|
||||
x1[1][0] = (int*)input;
|
||||
x1[1][1] = (int*)input;
|
||||
|
||||
x2[0] = (int*)input2;
|
||||
x2[1] = (int*)input2;
|
||||
|
||||
y[0] = (int*)output;
|
||||
y[1] = (int*)output2;
|
||||
*/
|
||||
|
||||
mult_cpx_matrix_vector(x1,x2,y,64,15);
|
||||
|
||||
//mult_cpx_vector_add32(x2[0],x1[0][0],y[0],64);
|
||||
|
||||
for (i=0; i<128; i+=2)
|
||||
printf("i=%d, x1 = [%d+1i*%d %d+1i*%d; %d+1i*%d %d+1i*%d]; x2 = [%d+1i*%d; %d+1i*%d]; y = [%d+1i*%d; %d+1i*%d]; y_m= round(x1*x2./pow2(15)); y-y_m \n",
|
||||
i,
|
||||
((short*)x1[0][0])[2*i], ((short*)x1[0][0])[2*i+2],
|
||||
((short*)x1[0][1])[2*i], ((short*)x1[0][1])[2*i+2],
|
||||
((short*)x1[1][0])[2*i], ((short*)x1[1][0])[2*i+2],
|
||||
((short*)x1[1][1])[2*i], ((short*)x1[1][1])[2*i+2],
|
||||
((short*)x2[0])[2*i], ((short*)x2[0])[2*i+1],
|
||||
((short*)x2[1])[2*i], ((short*)x2[1])[2*i+1],
|
||||
((short*)y[0])[2*i], ((short*)y[0])[2*i+1],
|
||||
((short*)y[1])[2*i], ((short*)y[1])[2*i+1]);
|
||||
|
||||
//((int*)y[0])[i], ((int*)y[0])[i+1],
|
||||
//((int*)y[1])[i], ((int*)y[1])[i+1]);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -50,7 +50,7 @@ int mult_cpx_conj_vector(int16_t *x1,
|
||||
uint32_t N,
|
||||
int output_shift)
|
||||
{
|
||||
// Multiply elementwise two complex vectors of N elements with repeated formatted output
|
||||
// Multiply elementwise the complex conjugate of x1 with x2.
|
||||
// x1 - input 1 in the format |Re0 Im0 Re1 Im1|,......,|Re(N-2) Im(N-2) Re(N-1) Im(N-1)|
|
||||
// We assume x1 with a dinamic of 15 bit maximum
|
||||
//
|
||||
@@ -90,7 +90,7 @@ int mult_cpx_conj_vector(int16_t *x1,
|
||||
tmp_im = _mm_shufflelo_epi16(*x1_128,_MM_SHUFFLE(2,3,0,1));
|
||||
tmp_im = _mm_shufflehi_epi16(tmp_im,_MM_SHUFFLE(2,3,0,1));
|
||||
tmp_im = _mm_sign_epi16(tmp_im,*(__m128i*)&conjug[0]);
|
||||
tmp_im = _mm_madd_epi16(tmp_im,*x1_128);
|
||||
tmp_im = _mm_madd_epi16(tmp_im,*x2_128);
|
||||
tmp_re = _mm_srai_epi32(tmp_re,output_shift);
|
||||
tmp_im = _mm_srai_epi32(tmp_im,output_shift);
|
||||
tmpy0 = _mm_unpacklo_epi32(tmp_re,tmp_im);
|
||||
@@ -130,3 +130,4 @@ int mult_cpx_conj_vector(int16_t *x1,
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,366 +0,0 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
#include "defs.h"
|
||||
|
||||
static __m128i shift __attribute__ ((aligned(16)));
|
||||
|
||||
|
||||
int mult_cpx_vector_h(short *x1,
|
||||
short *x2,
|
||||
short *y,
|
||||
unsigned int N,
|
||||
unsigned short output_shift,
|
||||
short sign)
|
||||
{
|
||||
// Multiply elementwise the complex vector x1 with the complex conjugate of the complex vecotr x2 of N elements and adds it to the vector y.
|
||||
// x1 - input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
// We assume x1 with a dinamic of 15 bit maximum
|
||||
//
|
||||
// x2 - input 2 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
// We assume x2 with a dinamic of 14 bit maximum
|
||||
//
|
||||
// y - output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
//
|
||||
// N - the size f the vectors (this function does N cpx mpy. WARNING: N>=4;
|
||||
//
|
||||
// log2_amp - increase the output amplitude by a factor 2^log2_amp (default is 0)
|
||||
// WARNING: log2_amp>0 can cause overflow!!
|
||||
// sign - +1..add, -1..substract
|
||||
|
||||
unsigned int i; // loop counter
|
||||
|
||||
register __m128i m0,m1,m2;
|
||||
|
||||
short *temps;
|
||||
int *tempd;
|
||||
|
||||
__m128i *x1_128;
|
||||
__m128i *x2_128;
|
||||
__m128i *y_128;
|
||||
__m128i mask;
|
||||
|
||||
__m128i temp;
|
||||
|
||||
shift = _mm_cvtsi32_si128(output_shift);
|
||||
x1_128 = (__m128i *)&x1[0];
|
||||
x2_128 = (__m128i *)&x2[0];
|
||||
y_128 = (__m128i *)&y[0];
|
||||
|
||||
if (sign == -1)
|
||||
mask = (__m128i) _mm_set_epi16 (-1,1,-1,-1,-1,1,-1,-1);
|
||||
else
|
||||
mask = (__m128i) _mm_set_epi16 (1,-1,1,1,1,-1,1,1);
|
||||
|
||||
// we compute 2*4 cpx multiply for each loop
|
||||
for(i=0; i<(N>>3); i++) {
|
||||
|
||||
// printf("i=%d\n",i);
|
||||
|
||||
// unroll 1
|
||||
// temps = (short *)x1_128;
|
||||
// printf("x1 : %d,%d,%d,%d,%d,%d,%d,%d\n",temps[0],temps[1],temps[2],temps[3],temps[4],temps[5],temps[6],temps[7]);
|
||||
m1 = x1_128[0];
|
||||
m2 = x2_128[0];
|
||||
|
||||
// temps = (short *)&x2_128[0];
|
||||
// printf("x2 : %x,%x,%x,%x,%x,%x,%x,%x\n",temps[0],temps[1],temps[2],temps[3],temps[4],temps[5],temps[6],temps[7]);
|
||||
|
||||
// bring x2 in conjugate form
|
||||
// the first two instructions might be replaced with a single one in SSE3
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
// temp = m2;
|
||||
// temps = (short *)&temp;
|
||||
// printf("x2 conj : %x,%x,%x,%x,%x,%x,%x,%x\n",temps[0],temps[1],temps[2],temps[3],temps[4],temps[5],temps[6],temps[7]);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2); //pmaddwd_r2r(mm1,mm0); // 1- compute x1[0]*x2[0]
|
||||
|
||||
// temp = m0;
|
||||
|
||||
// tempd = &temp;
|
||||
// printf("m0 : %d,%d,%d,%d\n",tempd[0],tempd[1],tempd[2],tempd[3]);
|
||||
|
||||
m0 = _mm_sra_epi32(m0,shift); // 1- shift right by shift in order to compensate for the input amplitude
|
||||
|
||||
// temp = m0;
|
||||
|
||||
// tempd = (int *)&temp;
|
||||
// printf("m0 : %d,%d,%d,%d\n",tempd[0],tempd[1],tempd[2],tempd[3]);
|
||||
|
||||
m0 = _mm_packs_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
m0 = _mm_unpacklo_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
|
||||
y_128[0] = _mm_add_epi16(m0,y_128[0]);
|
||||
|
||||
// temps = (short *)&y_128[0];
|
||||
// printf("y0 : %d,%d,%d,%d,%d,%d,%d,%d\n",temps[0],temps[1],temps[2],temps[3],temps[4],temps[5],temps[6],temps[7]);
|
||||
|
||||
// unroll 2
|
||||
m1 = x1_128[1];
|
||||
m2 = x2_128[1];
|
||||
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2); //pmaddwd_r2r(mm1,mm0); // 1- compute x1[0]*x2[0]
|
||||
|
||||
m0 = _mm_sra_epi32(m0,shift); // 1- shift right by shift in order to compensate for the input amplitude
|
||||
|
||||
m0 = _mm_packs_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
m0 = _mm_unpacklo_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
|
||||
y_128[1] = _mm_add_epi16(m0,y_128[1]);
|
||||
|
||||
// unroll 3
|
||||
m1 = x1_128[2];
|
||||
m2 = x2_128[2];
|
||||
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2); //pmaddwd_r2r(mm1,mm0); // 1- compute x1[0]*x2[0]
|
||||
|
||||
m0 = _mm_sra_epi32(m0,shift); // 1- shift right by shift in order to compensate for the input amplitude
|
||||
|
||||
m0 = _mm_packs_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
m0 = _mm_unpacklo_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
|
||||
y_128[2] = _mm_add_epi16(m0,y_128[2]);
|
||||
|
||||
|
||||
// unroll 4
|
||||
m1 = x1_128[3];
|
||||
m2 = x2_128[3];
|
||||
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2); //pmaddwd_r2r(mm1,mm0); // 1- compute x1[0]*x2[0]
|
||||
|
||||
m0 = _mm_sra_epi32(m0,shift); // 1- shift right by shift in order to compensate for the input amplitude
|
||||
|
||||
m0 = _mm_packs_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
m0 = _mm_unpacklo_epi32(m0,m0); // 1- pack in a 128 bit register [re im re im]
|
||||
|
||||
y_128[3] = _mm_add_epi16(m0,y_128[3]);
|
||||
|
||||
x1_128+=4;
|
||||
x2_128+=4;
|
||||
y_128 +=4;
|
||||
// printf("x1_128 = %p, x2_128 =%p, y_128=%p\n",x1_128,x2_128,y_128);
|
||||
|
||||
}
|
||||
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int mult_cpx_vector_h_add32(short *x1,
|
||||
short *x2,
|
||||
short *y,
|
||||
unsigned int N,
|
||||
short sign)
|
||||
{
|
||||
// Multiply elementwise the complex vector x1 with the complex conjugate of the complex vecotr x2 of N elements and adds it to the vector y.
|
||||
// x1 - input 1 in 16bit format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
// We assume x1 with a dinamic of 15 bit maximum
|
||||
//
|
||||
// x2 - input 2 in 16bit format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
// We assume x2 with a dinamic of 14 bit maximum
|
||||
//
|
||||
// y - output in 32bit format |Re0 Im0|,......,|Re(N-1) Im(N-1)|
|
||||
//
|
||||
// N - the size f the vectors (this function does N cpx mpy. WARNING: N>=4;
|
||||
//
|
||||
// sign - +1..add, -1..substract
|
||||
|
||||
unsigned int i; // loop counter
|
||||
|
||||
register __m128i m0,m1,m2;
|
||||
|
||||
short *temps;
|
||||
int *tempd;
|
||||
|
||||
__m128i *x1_128;
|
||||
__m128i *x2_128;
|
||||
__m128i *y_128;
|
||||
__m128i mask;
|
||||
|
||||
__m128i temp;
|
||||
|
||||
x1_128 = (__m128i *)&x1[0];
|
||||
x2_128 = (__m128i *)&x2[0];
|
||||
y_128 = (__m128i *)&y[0];
|
||||
|
||||
if (sign == -1)
|
||||
mask = (__m128i) _mm_set_epi16 (-1,1,-1,-1,-1,1,-1,-1);
|
||||
else
|
||||
mask = (__m128i) _mm_set_epi16 (1,-1,1,1,1,-1,1,1);
|
||||
|
||||
// we compute 2*4 cpx multiply for each loop
|
||||
for(i=0; i<(N>>3); i++) {
|
||||
|
||||
m1 = x1_128[0];
|
||||
m2 = x2_128[0];
|
||||
|
||||
// bring x2 in conjugate form
|
||||
// the first two instructions might be replaced with a single one in SSE3
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2); // 1- compute x1[0]*x2[0], result is 32bit
|
||||
|
||||
y_128[0] = _mm_add_epi32(m0,y_128[0]);
|
||||
|
||||
// unroll 2
|
||||
m1 = x1_128[1];
|
||||
m2 = x2_128[1];
|
||||
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2);
|
||||
|
||||
y_128[1] = _mm_add_epi32(m0,y_128[1]);
|
||||
|
||||
// unroll 3
|
||||
m1 = x1_128[2];
|
||||
m2 = x2_128[2];
|
||||
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2);
|
||||
|
||||
y_128[2] = _mm_add_epi32(m0,y_128[2]);
|
||||
|
||||
|
||||
// unroll 4
|
||||
m1 = x1_128[3];
|
||||
m2 = x2_128[3];
|
||||
|
||||
m2 = _mm_shufflelo_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_shufflehi_epi16(m2,_MM_SHUFFLE(0,1,3,2));
|
||||
m2 = _mm_mullo_epi16(m2, mask);
|
||||
|
||||
m0 = _mm_madd_epi16(m1,m2);
|
||||
|
||||
y_128[3] = _mm_add_epi32(m0,y_128[3]);
|
||||
|
||||
x1_128+=4;
|
||||
x2_128+=4;
|
||||
y_128 +=4;
|
||||
|
||||
}
|
||||
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef MAIN
|
||||
#define L 16
|
||||
|
||||
main ()
|
||||
{
|
||||
|
||||
short input[256] __attribute__((aligned(16)));
|
||||
short input2[256] __attribute__((aligned(16)));
|
||||
short output[256] __attribute__((aligned(16)));
|
||||
|
||||
int i;
|
||||
|
||||
Zero_Buffer(output,256*2);
|
||||
|
||||
for (i=0; i<16; i+=2)
|
||||
printf("output[%d] = %d + %d i\n",i,output[i],output[i+1]);
|
||||
|
||||
input[0] = 100;
|
||||
input[1] = 200;
|
||||
input[2] = 100;
|
||||
input[3] = 200;
|
||||
input[4] = 1234;
|
||||
input[5] = -1234;
|
||||
input[6] = 1234;
|
||||
input[7] = -1234;
|
||||
input[8] = 100;
|
||||
input[9] = 200;
|
||||
input[10] = 100;
|
||||
input[11] = 200;
|
||||
input[12] = 1000;
|
||||
input[13] = 2000;
|
||||
input[14] = 1000;
|
||||
input[15] = 2000;
|
||||
|
||||
input2[0] = 1;
|
||||
input2[1] = 2;
|
||||
input2[2] = 1;
|
||||
input2[3] = 2;
|
||||
input2[4] = 10;
|
||||
input2[5] = 20;
|
||||
input2[6] = 10;
|
||||
input2[7] = 20;
|
||||
input2[8] = 1;
|
||||
input2[9] = 2;
|
||||
input2[10] = 1;
|
||||
input2[11] = 2;
|
||||
input2[12] = 1000;
|
||||
input2[13] = 2000;
|
||||
input2[14] = 1000;
|
||||
input2[15] = 2000;
|
||||
|
||||
|
||||
mult_cpx_vector_h(input2,input2,output,8,0,1);
|
||||
|
||||
for (i=0; i<16; i+=2)
|
||||
printf("output[%d] = %d + %d i\n",i,output[i],output[i+1]);
|
||||
|
||||
Zero_Buffer(output,256*2);
|
||||
mult_cpx_vector_h(input2,input2,output,8,0,-1);
|
||||
|
||||
for (i=0; i<16; i+=2)
|
||||
printf("output[%d] = %d + %d i\n",i,output[i],output[i+1]);
|
||||
|
||||
}
|
||||
|
||||
#endif //MAIN
|
||||
+26
-182
@@ -64,6 +64,8 @@ struct complex32 {
|
||||
int32_t i;
|
||||
};
|
||||
|
||||
//cmult_sv.h
|
||||
|
||||
/*!\fn void multadd_real_vector_complex_scalar(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N)
|
||||
This function performs componentwise multiplication and accumulation of a complex scalar and a real vector.
|
||||
@param x Vector input (Q1.15)
|
||||
@@ -95,192 +97,14 @@ void multadd_complex_vector_real_scalar(int16_t *x,
|
||||
uint8_t zero_flag,
|
||||
uint32_t N);
|
||||
|
||||
|
||||
/*!\fn int32_t mult_cpx_vector(int16_t *x1,int16_t *x2,int16_t *y,uint32_t N,int32_t output_shift)
|
||||
This function performs optimized componentwise multiplication of two Q1.15 vectors in repeated format.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param N Length of Vector WARNING: N must be a multiple of 8 (4x loop unrolling and two complex multiplies per cycle)
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
|
||||
The function implemented is : \f$\mathbf{y} = \mathbf{x_1}\odot\mathbf{x_2}\f$
|
||||
*/
|
||||
int32_t mult_cpx_vector(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
/*!\fn int32_t mult_cpx_vector_norep(int16_t *x1,int16_t *x2,int16_t *y,uint32_t N,int32_t output_shift)
|
||||
This function performs optimized componentwise multiplication of two Q1.15 vectors with normal formatted output.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re1 Im1|,......,|Re(N-2) Im(N-2) Re(N-1) Im(N-1)|
|
||||
@param N Length of Vector WARNING: N must be a multiple of 8 (4x loop unrolling and two complex multiplies per cycle)
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
|
||||
The function implemented is : \f$\mathbf{y} = \mathbf{x_1}\odot\mathbf{x_2}\f$
|
||||
*/
|
||||
int32_t mult_cpx_vector_norep(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
|
||||
/*!\fn int32_t mult_cpx_vector_norep2(int16_t *x1,int16_t *x2,int16_t *y,uint32_t N,int32_t output_shift)
|
||||
This function performs optimized componentwise multiplication of two Q1.15 vectors with normal formatted output.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re1 Im1|,......,|Re(N-2) Im(N-2) Re(N-1) Im(N-1)|
|
||||
@param N Length of Vector WARNING: N must be a multiple of 8 (no unrolling and two complex multiplies per cycle)
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
|
||||
The function implemented is : \f$\mathbf{y} = \mathbf{x_1}\odot\mathbf{x_2}\f$
|
||||
*/
|
||||
int32_t mult_cpx_vector_norep2(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
int32_t mult_cpx_vector_norep_conj(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
int32_t mult_cpx_vector_norep_conj2(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
/*!\fn int32_t mult_cpx_vector2(int16_t *x1,int16_t *x2,int16_t *y,uint32_t N,int32_t output_shift)
|
||||
This function performs optimized componentwise multiplication of two Q1.15 vectors.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param N Length of Vector WARNING: N must be a multiple of 2 (2 complex multiplies per cycle)
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
|
||||
The function implemented is : \f$\mathbf{y} = \mathbf{x_1}\odot\mathbf{x_2}\f$
|
||||
*/
|
||||
int32_t mult_cpx_vector2(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
/*!\fn int32_t mult_cpx_vector_add(int16_t *x1,int16_t *x2,int16_t *y,uint32_t N,int32_t output_shift)
|
||||
This function performs optimized componentwise multiplication of two Q1.15 vectors. The output IS ADDED TO y. WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param N Length of Vector WARNING: N>=4
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
|
||||
The function implemented is : \f$\mathbf{y} += \mathbf{x_1}\odot\mathbf{x_2}\f$
|
||||
*/
|
||||
|
||||
int32_t mult_cpx_vector_add(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
|
||||
int32_t mult_cpx_vector_h_add32(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int16_t sign);
|
||||
|
||||
int32_t mult_cpx_vector_add32(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N);
|
||||
|
||||
int32_t mult_vector32(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int rotate_cpx_vector(int16_t *x,
|
||||
int16_t *alpha,
|
||||
int16_t *y,
|
||||
uint32_t N);
|
||||
|
||||
int32_t mult_vector32_scalar(int16_t *x1,
|
||||
int32_t x2,
|
||||
int16_t *y,
|
||||
uint32_t N);
|
||||
|
||||
int32_t mult_cpx_vector32_conj(int16_t *x,
|
||||
int16_t *y,
|
||||
uint32_t N);
|
||||
|
||||
int32_t mult_cpx_vector32_real(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N);
|
||||
|
||||
int32_t shift_and_pack(int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift);
|
||||
|
||||
/*!\fn int32_t mult_cpx_vector_h(int16_t *x1,int16_t *x2,int16_t *y,uint32_t N,int32_t output_shift,int16_t sign)
|
||||
This function performs optimized componentwise multiplication of the vector x1 with the conjugate of the vector x2. The output IS ADDED TO y. WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param N Length of Vector (complex samples) WARNING: N>=4
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
@param sign +1..add, -1..substract
|
||||
|
||||
The function implemented is : \f$\mathbf{y} = \mathbf{y} + \mathbf{x_1}\odot\mathbf{x_2}^*\f$
|
||||
*/
|
||||
int32_t mult_cpx_vector_h(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int32_t output_shift,
|
||||
int16_t sign);
|
||||
|
||||
/*!\fn int32_t mult_cpx_matrix_h(int16_t *x1[2][2],int16_t *x2[2][2],int16_t *y[2][2],uint32_t N,uint16_t output_shift,int16_t hermitian)
|
||||
This function performs optimized componentwise matrix multiplication of the 2x2 matrices x1 with the 2x2 matrices x2. The output IS ADDED TO y (i.e. make sure y is initilized correctly). WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param N Length of Vector (complex samples) WARNING: N>=4
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
@param hermitian if !=0 the hermitian transpose is returned (i.e. A^H*B instead of A*B^H)
|
||||
*/
|
||||
int32_t mult_cpx_matrix_h(int16_t *x1[2][2],
|
||||
int16_t *x2[2][2],
|
||||
int16_t *y[2][2],
|
||||
uint32_t N,
|
||||
uint16_t output_shift,
|
||||
int16_t hermitian);
|
||||
uint32_t N,
|
||||
uint16_t output_shift);
|
||||
|
||||
|
||||
/*!\fn int32_t mult_cpx_matrix_vector(int32_t *x1[2][2],int32_t *x2[2],int32_t *y[2],uint32_t N,uint16_t output_shift)
|
||||
This function performs optimized componentwise matrix-vector multiplication of the 2x2 matrices x1 with the 2x1 vectors x2. The output IS ADDED TO y (i.e. make sure y is initilized correctly). WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.
|
||||
|
||||
@param x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
|
||||
@param x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
|
||||
@param y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)| WARNING: y must be different for x2
|
||||
@param N Length of Vector (complex samples) WARNING: N>=4
|
||||
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
|
||||
*/
|
||||
int32_t mult_cpx_matrix_vector(int32_t *x1[2][2],
|
||||
int32_t *x2[2],
|
||||
int32_t *y[2],
|
||||
uint32_t N,
|
||||
uint16_t output_shift);
|
||||
|
||||
/*!\fn void init_fft(uint16_t size,uint8_t logsize,uint16_t *rev)
|
||||
\brief Initialize the FFT engine for a given size
|
||||
@@ -289,6 +113,25 @@ int32_t mult_cpx_matrix_vector(int32_t *x1[2][2],
|
||||
@param rev Pointer to bit-reversal permutation array
|
||||
*/
|
||||
|
||||
//cmult_vv.c
|
||||
/*!
|
||||
Multiply elementwise the complex conjugate of x1 with x2.
|
||||
@param x1 - input 1 in the format |Re0 Im0 Re1 Im1|,......,|Re(N-2) Im(N-2) Re(N-1) Im(N-1)|
|
||||
We assume x1 with a dinamic of 15 bit maximum
|
||||
@param x2 - input 2 in the format |Re0 Im0 Re1 Im1|,......,|Re(N-2) Im(N-2) Re(N-1) Im(N-1)|
|
||||
We assume x2 with a dinamic of 14 bit maximum
|
||||
@param y - output in the format |Re0 Im0 Re1 Im1|,......,|Re(N-2) Im(N-2) Re(N-1) Im(N-1)|
|
||||
@param N - the size f the vectors (this function does N cpx mpy. WARNING: N>=4;
|
||||
@param output_shift - shift to be applied to generate output
|
||||
*/
|
||||
|
||||
int mult_cpx_conj_vector(int16_t *x1,
|
||||
int16_t *x2,
|
||||
int16_t *y,
|
||||
uint32_t N,
|
||||
int output_shift);
|
||||
|
||||
// lte_dfts.c
|
||||
void init_fft(uint16_t size,
|
||||
uint8_t logsize,
|
||||
uint16_t *rev);
|
||||
@@ -355,6 +198,7 @@ int32_t rotate_cpx_vector(int16_t *x,
|
||||
uint16_t output_shift);
|
||||
|
||||
|
||||
//cadd_sv.c
|
||||
|
||||
/*!\fn int32_t add_cpx_vector(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N)
|
||||
This function performs componentwise addition of a vector with a complex scalar.
|
||||
|
||||
+2720
-207
File diff suppressed because one or more lines are too long
@@ -719,13 +719,13 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
||||
|
||||
// PDSCH LLRs
|
||||
if (pdsch_llr != NULL) {
|
||||
for (i=0; i<coded_bits_per_codeword/4; i++) {
|
||||
llr[i] = (float) pdsch_llr[4*i];
|
||||
for (i=0; i<coded_bits_per_codeword; i++) {
|
||||
llr[i] = (float) pdsch_llr[i];
|
||||
bit[i] = (float) i;
|
||||
}
|
||||
|
||||
fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword/4);
|
||||
fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword/4,"","","");
|
||||
fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword);
|
||||
fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword,"","","");
|
||||
}
|
||||
|
||||
// PDSCH I/Q of MF Output
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
#ifndef __TIME_MEAS_DEFS__H__
|
||||
#define __TIME_MEAS_DEFS__H__
|
||||
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
@@ -148,3 +151,4 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts)
|
||||
dst_ts->max=src_ts->max;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -278,6 +278,9 @@ typedef struct PHY_VARS_eNB_s {
|
||||
int **dl_precoder_SeNB[3];
|
||||
char log2_maxp; /// holds the maximum channel/precoder coefficient
|
||||
|
||||
/// if ==0 enables phy only test mode
|
||||
int mac_enabled;
|
||||
|
||||
/// For emulation only (used by UE abstraction to retrieve DCI)
|
||||
uint8_t num_common_dci[2]; // num_dci in even/odd subframes
|
||||
uint8_t num_ue_spec_dci[2]; // num_dci in even/odd subframes
|
||||
@@ -583,6 +586,9 @@ typedef struct {
|
||||
/// holds the maximum channel/precoder coefficient
|
||||
char log2_maxp;
|
||||
|
||||
/// if ==0 enables phy only test mode
|
||||
int mac_enabled;
|
||||
|
||||
/// Flag to initialize averaging of PHY measurements
|
||||
int init_averaging;
|
||||
|
||||
|
||||
@@ -0,0 +1,756 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*! \file phy_mac_stub.c
|
||||
* \brief stimulates the phy without mac
|
||||
* \author R. Knopp, F. Kaltenberger, N. Nikaein
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "MAC_INTERFACE/defs.h"
|
||||
#include "MAC_INTERFACE/extern.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "SCHED/extern.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
|
||||
#ifdef EMOS
|
||||
#include "SCHED/phy_procedures_emos.h"
|
||||
#endif
|
||||
|
||||
void fill_dci(DCI_PDU *DCI_pdu, uint8_t sched_subframe, PHY_VARS_eNB *phy_vars_eNB)
|
||||
{
|
||||
|
||||
int i;
|
||||
uint8_t cooperation_flag = phy_vars_eNB->cooperation_flag;
|
||||
uint8_t transmission_mode = phy_vars_eNB->transmission_mode[0];
|
||||
|
||||
uint32_t rballoc = 0x7FFF;
|
||||
uint32_t rballoc2 = 0x000F;
|
||||
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_tx;
|
||||
|
||||
LTE_eNB_DLSCH_t *DLSCH_ptr = phy_vars_eNB->dlsch_eNB[0][0];
|
||||
|
||||
/*
|
||||
uint32_t rand = taus();
|
||||
if ((subframe==8) || (subframe==9) || (subframe==0))
|
||||
rand = (rand%5)+5;
|
||||
else
|
||||
rand = (rand%4)+5;
|
||||
*/
|
||||
uint32_t bcch_pdu;
|
||||
uint64_t dlsch_pdu;
|
||||
|
||||
DCI_pdu->Num_common_dci = 0;
|
||||
DCI_pdu->Num_ue_spec_dci=0;
|
||||
|
||||
switch (subframe) {
|
||||
case 5:
|
||||
DCI_pdu->Num_common_dci = 1;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = SI_RNTI;
|
||||
DCI_pdu->dci_alloc[0].format = format1A;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
switch (phy_vars_eNB->lte_frame_parms.N_RB_DL) {
|
||||
case 6:
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD) {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
|
||||
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_1_5MHz_TDD_1_6_t));
|
||||
} else {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0;
|
||||
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_1_5MHz_TDD_1_6_t));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 25:
|
||||
default:
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD) {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_5MHz_FDD_t;
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
|
||||
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
|
||||
} else {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0;
|
||||
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 50:
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD) {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_10MHz_FDD_t;
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
|
||||
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_10MHz_TDD_1_6_t));
|
||||
} else {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t;
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_10MHz_TDD_1_6_t));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 100:
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD) {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_20MHz_FDD_t;
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
|
||||
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_20MHz_TDD_1_6_t));
|
||||
} else {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t;
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0;
|
||||
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->TPC = 1; // set to 3 PRB
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&bcch_pdu,sizeof(DCI1A_20MHz_TDD_1_6_t));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break; //subframe switch
|
||||
|
||||
/*
|
||||
case 6:
|
||||
DCI_pdu->Num_ue_spec_dci = 1;
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI2_5MHz_2A_M10PRB_TDD_t;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[0].format = format2_2A_M10PRB;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
DLSCH_alloc_pdu1.rballoc = 0x00ff;
|
||||
DLSCH_alloc_pdu1.TPC = 0;
|
||||
DLSCH_alloc_pdu1.dai = 0;
|
||||
DLSCH_alloc_pdu1.harq_pid = 0;
|
||||
DLSCH_alloc_pdu1.tb_swap = 0;
|
||||
DLSCH_alloc_pdu1.mcs1 = 0;
|
||||
DLSCH_alloc_pdu1.ndi1 = 1;
|
||||
DLSCH_alloc_pdu1.rv1 = 0;
|
||||
DLSCH_alloc_pdu1.tpmi = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu1,sizeof(DCI2_5MHz_2A_M10PRB_TDD_t));
|
||||
break;
|
||||
*/
|
||||
|
||||
default:
|
||||
case 7:
|
||||
DCI_pdu->Num_ue_spec_dci = 1;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format1;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
if (transmission_mode<3) {
|
||||
//user 1
|
||||
switch (phy_vars_eNB->lte_frame_parms.N_RB_DL) {
|
||||
case 25:
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD) {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_5MHz_FDD_t;
|
||||
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->frame%1024)%28);
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t));
|
||||
|
||||
/*
|
||||
//user2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_5MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1;
|
||||
//((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->proc[subframe].frame%1024)%28);
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = 1;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_5MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_5MHz_TDD_t));
|
||||
*/
|
||||
} else {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_5MHz_TDD_t;
|
||||
|
||||
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->rballoc = rballoc;
|
||||
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//((DCI1_5MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->frame%1024)%28);
|
||||
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t));
|
||||
|
||||
/*
|
||||
//user2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_5MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1;
|
||||
//((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->proc[subframe].frame%1024)%28);
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = 1;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_5MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_5MHz_TDD_t));
|
||||
*/
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 50:
|
||||
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD) {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_10MHz_FDD_t;
|
||||
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->frame%1024)%28);
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_TDD_t));
|
||||
|
||||
/*
|
||||
//user2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_10MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1;
|
||||
//((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->proc[subframe].frame%1024)%28);
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = 1;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_10MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_10MHz_TDD_t));
|
||||
*/
|
||||
} else {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_10MHz_TDD_t;
|
||||
|
||||
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->rballoc = rballoc;
|
||||
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//((DCI1_10MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->frame%1024)%28);
|
||||
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_TDD_t));
|
||||
|
||||
/*
|
||||
//user2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_10MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1;
|
||||
//((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->proc[subframe].frame%1024)%28);
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = 1;
|
||||
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_10MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_10MHz_TDD_t));
|
||||
*/
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 100:
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD) {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_5MHz_FDD_t;
|
||||
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->frame%1024)%28);
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t));
|
||||
|
||||
/*
|
||||
//user2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_5MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1;
|
||||
//((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->proc[subframe].frame%1024)%28);
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = 1;
|
||||
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_5MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_5MHz_TDD_t));
|
||||
*/
|
||||
} else {
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_20MHz_TDD_t;
|
||||
|
||||
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->rballoc = rballoc;
|
||||
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//((DCI1_20MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->frame%1024)%28);
|
||||
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_20MHz_TDD_t));
|
||||
|
||||
/*
|
||||
//user2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_20MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
((DCI1_20MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2;
|
||||
((DCI1_20MHz_FDD_t *)&dlsch_pdu)->TPC = 0;
|
||||
((DCI1_20MHz_FDD_t *)&dlsch_pdu)->dai = 0;
|
||||
((DCI1_20MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1;
|
||||
//((DCI1_20MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((phy_vars_eNB->proc[subframe].frame%1024)%28);
|
||||
((DCI1_20MHz_FDD_t *)&dlsch_pdu)->mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI1_20MHz_FDD_t *)&dlsch_pdu)->ndi = 1;
|
||||
((DCI1_20MHz_FDD_t *)&dlsch_pdu)->rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_20MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_5MHz_TDD_t));
|
||||
*/
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
} else if (transmission_mode==4) {
|
||||
DCI_pdu->Num_ue_spec_dci = 1;
|
||||
// user 1
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI2_5MHz_2A_FDD_t;
|
||||
DCI_pdu->dci_alloc[0].L = 3;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format2;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->tpmi = 0;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rv1 = 0;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->ndi1 = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->mcs1 = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rv2 = 0;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->ndi2 = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->mcs2 = openair_daq_vars.target_ue_dl_mcs;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->tb_swap = 0;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->TPC = 0;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rballoc = openair_daq_vars.ue_dl_rb_alloc;
|
||||
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rah = 0;
|
||||
|
||||
} else if (transmission_mode==5) {
|
||||
DCI_pdu->Num_ue_spec_dci = 2;
|
||||
// user 1
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
|
||||
DCI_pdu->dci_alloc[0].L = 3;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format1E_2A_M10PRB;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
DLSCH_alloc_pdu1E.tpmi = 5; //5=use feedback
|
||||
DLSCH_alloc_pdu1E.rv = 0;
|
||||
DLSCH_alloc_pdu1E.ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
//DLSCH_alloc_pdu1E.mcs = cqi_to_mcs[phy_vars_eNB->eNB_UE_stats->DL_cqi[0]];
|
||||
//DLSCH_alloc_pdu1E.mcs = (unsigned char) (taus()%28);
|
||||
DLSCH_alloc_pdu1E.mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//DLSCH_alloc_pdu1E.mcs = (unsigned char) ((phy_vars_eNB->proc[subframe].frame%1024)%28);
|
||||
phy_vars_eNB->eNB_UE_stats[0].dlsch_mcs1 = DLSCH_alloc_pdu1E.mcs;
|
||||
DLSCH_alloc_pdu1E.harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
DLSCH_alloc_pdu1E.dai = 0;
|
||||
DLSCH_alloc_pdu1E.TPC = 0;
|
||||
DLSCH_alloc_pdu1E.rballoc = openair_daq_vars.ue_dl_rb_alloc;
|
||||
DLSCH_alloc_pdu1E.rah = 0;
|
||||
DLSCH_alloc_pdu1E.dl_power_off = 0; //0=second user present
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
|
||||
|
||||
//user 2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 0;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1E_2A_M10PRB;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
//DLSCH_alloc_pdu1E.mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
//DLSCH_alloc_pdu1E.mcs = (unsigned char) (taus()%28);
|
||||
//DLSCH_alloc_pdu1E.mcs = (unsigned char) ((phy_vars_eNB->frame%1024)%28);
|
||||
DLSCH_alloc_pdu1E.mcs = (unsigned char) (((phy_vars_eNB->proc[sched_subframe].frame_tx%1024)/3)%28);
|
||||
phy_vars_eNB->eNB_UE_stats[1].dlsch_mcs1 = DLSCH_alloc_pdu1E.mcs;
|
||||
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
|
||||
|
||||
// set the precoder of the second UE orthogonal to the first
|
||||
phy_vars_eNB->eNB_UE_stats[1].DL_pmi_single = (phy_vars_eNB->eNB_UE_stats[0].DL_pmi_single ^ 0x1555);
|
||||
}
|
||||
|
||||
break; //subframe switch
|
||||
|
||||
/*
|
||||
case 8:
|
||||
DCI_pdu->Num_common_dci = 1;
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0xbeef;
|
||||
DCI_pdu->dci_alloc[0].format = format1A;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 1;
|
||||
|
||||
RA_alloc_pdu.type = 1;
|
||||
RA_alloc_pdu.vrb_type = 0;
|
||||
RA_alloc_pdu.rballoc = computeRIV(25,12,3);
|
||||
RA_alloc_pdu.ndi = 1;
|
||||
RA_alloc_pdu.rv = 1;
|
||||
RA_alloc_pdu.mcs = 4;
|
||||
RA_alloc_pdu.harq_pid = 0;
|
||||
RA_alloc_pdu.TPC = 1;
|
||||
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&RA_alloc_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
|
||||
break;
|
||||
*/
|
||||
/*
|
||||
case 9:
|
||||
DCI_pdu->Num_ue_spec_dci = 1;
|
||||
|
||||
//user 1
|
||||
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD)
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI0_5MHz_FDD_t ;
|
||||
else
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI0_5MHz_TDD_1_6_t ;
|
||||
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format0;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
UL_alloc_pdu.type = 0;
|
||||
UL_alloc_pdu.hopping = 0;
|
||||
UL_alloc_pdu.rballoc = computeRIV(25,2,openair_daq_vars.ue_ul_nb_rb);
|
||||
UL_alloc_pdu.mcs = openair_daq_vars.target_ue_ul_mcs;
|
||||
UL_alloc_pdu.ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
UL_alloc_pdu.TPC = 0;
|
||||
UL_alloc_pdu.cshift = 0;
|
||||
UL_alloc_pdu.dai = 0;
|
||||
UL_alloc_pdu.cqi_req = 1;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
|
||||
*/
|
||||
// user 2
|
||||
/*
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI0_5MHz_TDD_1_6_t ;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format0;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
UL_alloc_pdu.type = 0;
|
||||
UL_alloc_pdu.hopping = 0;
|
||||
if (cooperation_flag==0)
|
||||
UL_alloc_pdu.rballoc = computeRIV(25,2+openair_daq_vars.ue_ul_nb_rb,openair_daq_vars.ue_ul_nb_rb);
|
||||
else
|
||||
UL_alloc_pdu.rballoc = computeRIV(25,0,openair_daq_vars.ue_ul_nb_rb);
|
||||
UL_alloc_pdu.mcs = openair_daq_vars.target_ue_ul_mcs;
|
||||
UL_alloc_pdu.ndi = phy_vars_eNB->proc[sched_subframe].frame_tx&1;
|
||||
UL_alloc_pdu.TPC = 0;
|
||||
if ((cooperation_flag==0) || (cooperation_flag==1))
|
||||
UL_alloc_pdu.cshift = 0;
|
||||
else
|
||||
UL_alloc_pdu.cshift = 1;
|
||||
UL_alloc_pdu.dai = 0;
|
||||
UL_alloc_pdu.cqi_req = 1;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
|
||||
break;
|
||||
*/
|
||||
|
||||
/*default:
|
||||
break;*/
|
||||
}
|
||||
|
||||
DCI_pdu->nCCE = 0;
|
||||
|
||||
for (i=0; i<DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci; i++) {
|
||||
DCI_pdu->nCCE += (1<<(DCI_pdu->dci_alloc[i].L));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void fill_dci_emos(DCI_PDU *DCI_pdu, uint8_t subframe, PHY_VARS_eNB *phy_vars_eNB)
|
||||
{
|
||||
|
||||
int i;
|
||||
uint8_t cooperation_flag = phy_vars_eNB->cooperation_flag;
|
||||
uint8_t transmission_mode = phy_vars_eNB->transmission_mode[0];
|
||||
|
||||
//uint32_t rballoc = 0x00F0;
|
||||
//uint32_t rballoc2 = 0x000F;
|
||||
/*
|
||||
uint32_t rand = taus();
|
||||
if ((subframe==8) || (subframe==9) || (subframe==0))
|
||||
rand = (rand%5)+5;
|
||||
else
|
||||
rand = (rand%4)+5;
|
||||
*/
|
||||
|
||||
DCI_pdu->Num_common_dci = 0;
|
||||
DCI_pdu->Num_ue_spec_dci=0;
|
||||
|
||||
switch (subframe) {
|
||||
case 5:
|
||||
DCI_pdu->Num_ue_spec_dci = 1;
|
||||
|
||||
if (transmission_mode<3) {
|
||||
//user 1
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_5MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format1;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
DLSCH_alloc_pdu.rballoc = openair_daq_vars.ue_dl_rb_alloc;
|
||||
DLSCH_alloc_pdu.TPC = 0;
|
||||
DLSCH_alloc_pdu.dai = 0;
|
||||
DLSCH_alloc_pdu.harq_pid = 1;
|
||||
DLSCH_alloc_pdu.mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
DLSCH_alloc_pdu.ndi = 1;
|
||||
DLSCH_alloc_pdu.rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu,sizeof(DCI1_5MHz_TDD_t));
|
||||
|
||||
/*
|
||||
//user2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_5MHz_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
DLSCH_alloc_pdu.rballoc = rballoc2;
|
||||
DLSCH_alloc_pdu.TPC = 0;
|
||||
DLSCH_alloc_pdu.dai = 0;
|
||||
DLSCH_alloc_pdu.harq_pid = 1;
|
||||
DLSCH_alloc_pdu.mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
DLSCH_alloc_pdu.ndi = 1;
|
||||
DLSCH_alloc_pdu.rv = 0;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu,sizeof(DCI1_5MHz_TDD_t));
|
||||
*/
|
||||
} else if (transmission_mode==5) {
|
||||
DCI_pdu->Num_ue_spec_dci = 2;
|
||||
// user 1
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format1E_2A_M10PRB;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
DLSCH_alloc_pdu1E.tpmi = 5; //5=use feedback
|
||||
DLSCH_alloc_pdu1E.rv = 0;
|
||||
DLSCH_alloc_pdu1E.ndi = 1;
|
||||
DLSCH_alloc_pdu1E.mcs = openair_daq_vars.target_ue_dl_mcs;
|
||||
DLSCH_alloc_pdu1E.harq_pid = 1;
|
||||
DLSCH_alloc_pdu1E.dai = 0;
|
||||
DLSCH_alloc_pdu1E.TPC = 0;
|
||||
DLSCH_alloc_pdu1E.rballoc = openair_daq_vars.ue_dl_rb_alloc;
|
||||
DLSCH_alloc_pdu1E.rah = 0;
|
||||
DLSCH_alloc_pdu1E.dl_power_off = 0; //0=second user present
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
|
||||
|
||||
//user 2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format1E_2A_M10PRB;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
|
||||
|
||||
// set the precoder of the second UE orthogonal to the first
|
||||
phy_vars_eNB->eNB_UE_stats[1].DL_pmi_single = (phy_vars_eNB->eNB_UE_stats[0].DL_pmi_single ^ 0x1555);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
DCI_pdu->Num_common_dci = 1;
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0xbeef;
|
||||
DCI_pdu->dci_alloc[0].format = format1A;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 1;
|
||||
|
||||
RA_alloc_pdu.type = 1;
|
||||
RA_alloc_pdu.vrb_type = 0;
|
||||
RA_alloc_pdu.rballoc = computeRIV(25,12,3);
|
||||
RA_alloc_pdu.ndi = 1;
|
||||
RA_alloc_pdu.rv = 1;
|
||||
RA_alloc_pdu.mcs = 4;
|
||||
RA_alloc_pdu.harq_pid = 0;
|
||||
RA_alloc_pdu.TPC = 1;
|
||||
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&RA_alloc_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
|
||||
break;
|
||||
|
||||
case 9:
|
||||
DCI_pdu->Num_ue_spec_dci = 1;
|
||||
|
||||
//user 1
|
||||
DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI0_5MHz_TDD_1_6_t ;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format0;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
UL_alloc_pdu.type = 0;
|
||||
UL_alloc_pdu.hopping = 0;
|
||||
UL_alloc_pdu.rballoc = computeRIV(25,0,openair_daq_vars.ue_ul_nb_rb);
|
||||
UL_alloc_pdu.mcs = openair_daq_vars.target_ue_ul_mcs;
|
||||
UL_alloc_pdu.ndi = 1;
|
||||
UL_alloc_pdu.TPC = 0;
|
||||
UL_alloc_pdu.cshift = 0;
|
||||
UL_alloc_pdu.dai = 0;
|
||||
UL_alloc_pdu.cqi_req = 1;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
|
||||
|
||||
/*
|
||||
//user 2
|
||||
DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI0_5MHz_TDD_1_6_t ;
|
||||
DCI_pdu->dci_alloc[1].L = 2;
|
||||
DCI_pdu->dci_alloc[1].rnti = 0x1236;
|
||||
DCI_pdu->dci_alloc[1].format = format0;
|
||||
DCI_pdu->dci_alloc[1].ra_flag = 0;
|
||||
|
||||
UL_alloc_pdu.type = 0;
|
||||
UL_alloc_pdu.hopping = 0;
|
||||
if (cooperation_flag==0)
|
||||
UL_alloc_pdu.rballoc = computeRIV(25,2+openair_daq_vars.ue_ul_nb_rb,openair_daq_vars.ue_ul_nb_rb);
|
||||
else
|
||||
UL_alloc_pdu.rballoc = computeRIV(25,0,openair_daq_vars.ue_ul_nb_rb);
|
||||
UL_alloc_pdu.mcs = openair_daq_vars.target_ue_ul_mcs;
|
||||
UL_alloc_pdu.ndi = 1;
|
||||
UL_alloc_pdu.TPC = 0;
|
||||
if ((cooperation_flag==0) || (cooperation_flag==1))
|
||||
UL_alloc_pdu.cshift = 0;
|
||||
else
|
||||
UL_alloc_pdu.cshift = 1;
|
||||
UL_alloc_pdu.dai = 0;
|
||||
UL_alloc_pdu.cqi_req = 1;
|
||||
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
|
||||
*/
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DCI_pdu->nCCE = 0;
|
||||
|
||||
for (i=0; i<DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci; i++) {
|
||||
DCI_pdu->nCCE += (1<<(DCI_pdu->dci_alloc[i].L));
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,20 +59,15 @@ extern int card;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define DEBUG_PHY_PROC
|
||||
#define UE_TX_POWER (-10)
|
||||
#define DEBUG_PHY_PROC
|
||||
|
||||
//#ifdef OPENAIR2
|
||||
#ifndef PUCCH
|
||||
#define PUCCH
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
//#ifdef OPENAIR2
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "LAYER2/MAC/defs.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
//#endif
|
||||
|
||||
#ifdef EMOS
|
||||
fifo_dump_emos_UE emos_dump_UE;
|
||||
@@ -87,9 +82,6 @@ fifo_dump_emos_UE emos_dump_UE;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OPENAIR2
|
||||
//#define DIAG_PHY
|
||||
#endif
|
||||
|
||||
#define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs)
|
||||
#define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs)
|
||||
@@ -454,7 +446,7 @@ uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue,
|
||||
|
||||
if (frame_parms->frame_type == FDD ) { // FDD
|
||||
sf = (subframe<4)? subframe+6 : subframe-4;
|
||||
printf("n1_pucch_UE: subframe %d, nCCE %d\n",sf,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->nCCE[sf]);
|
||||
LOG_D(PHY,"n1_pucch_UE: subframe %d, nCCE %d\n",sf,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->nCCE[sf]);
|
||||
|
||||
if (SR == 0)
|
||||
return(frame_parms->pucch_config_common.n1PUCCH_AN + phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->nCCE[sf]);
|
||||
@@ -642,16 +634,12 @@ void phy_procedures_emos_UE_TX(uint8_t next_slot,uint8_t eNB_id) {
|
||||
#endif
|
||||
|
||||
int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
|
||||
#ifndef OPENAIR2
|
||||
PRACH_RESOURCES_t prach_resources_local;
|
||||
#endif
|
||||
|
||||
void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type)
|
||||
{
|
||||
|
||||
#ifndef OPENAIR2
|
||||
int i;
|
||||
#endif
|
||||
uint16_t first_rb, nb_rb;
|
||||
uint8_t harq_pid;
|
||||
unsigned int input_buffer_length;
|
||||
@@ -724,8 +712,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
subframe_tx);
|
||||
|
||||
|
||||
#ifdef OPENAIR2
|
||||
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
if ((phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] == 1) &&
|
||||
(phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id] == frame_tx) &&
|
||||
(phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3
|
||||
@@ -756,8 +743,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
|
||||
Msg3_flag=0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
|
||||
|
||||
@@ -856,19 +842,17 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
#endif
|
||||
stop_meas(&phy_vars_ue->ulsch_encoding_stats);
|
||||
|
||||
|
||||
#ifdef OPENAIR2
|
||||
// signal MAC that Msg3 was sent
|
||||
mac_xface->Msg3_transmitted(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id);
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
// signal MAC that Msg3 was sent
|
||||
mac_xface->Msg3_transmitted(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id);
|
||||
}
|
||||
} else {
|
||||
input_buffer_length = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS/8;
|
||||
|
||||
#ifdef OPENAIR2
|
||||
|
||||
if (phy_vars_ue->mac_enabled==1) {
|
||||
// LOG_D(PHY,"[UE %d] ULSCH : Searching for MAC SDUs\n",Mod_id);
|
||||
if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->round==0) {
|
||||
//if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->calibration_flag == 0) {
|
||||
@@ -905,7 +889,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
LOG_T(PHY,"\n");
|
||||
#endif
|
||||
#endif
|
||||
#else //OPENAIR2
|
||||
}
|
||||
else {
|
||||
// the following lines were necessary for the calibration in CROWN
|
||||
/*
|
||||
if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->calibration_flag == 0) {
|
||||
@@ -928,8 +913,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
for (i=0;i<input_buffer_length;i++)
|
||||
ulsch_input_buffer[i]= i;
|
||||
*/
|
||||
}
|
||||
|
||||
#endif //OPENAIR2
|
||||
start_meas(&phy_vars_ue->ulsch_encoding_stats);
|
||||
|
||||
if (abstraction_flag==0) {
|
||||
@@ -961,12 +946,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
}
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
#ifdef OPENAIR2
|
||||
pusch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,1, abstraction_flag);
|
||||
phy_vars_ue->tx_power_dBm = phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH;
|
||||
#else
|
||||
phy_vars_ue->tx_power_dBm = UE_TX_POWER;
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled==1) {
|
||||
pusch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,1, abstraction_flag);
|
||||
phy_vars_ue->tx_power_dBm = phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH;
|
||||
}
|
||||
else {
|
||||
phy_vars_ue->tx_power_dBm = phy_vars_ue->tx_power_max_dBm;
|
||||
}
|
||||
phy_vars_ue->tx_total_RE = nb_rb*12;
|
||||
|
||||
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
|
||||
@@ -1023,17 +1009,19 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
if (is_SR_TXOp(phy_vars_ue,eNB_id,subframe_tx)==1) {
|
||||
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d: got SR_TXOp, Checking for SR for PUSCH from MAC\n",
|
||||
Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,frame_tx,subframe_tx);
|
||||
#ifdef OPENAIR2
|
||||
SR_payload = mac_xface->ue_get_SR(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id,
|
||||
phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,
|
||||
subframe_tx); // subframe used for meas gap
|
||||
#else
|
||||
SR_payload = 1;
|
||||
#endif
|
||||
|
||||
if (phy_vars_ue->mac_enabled==1) {
|
||||
SR_payload = mac_xface->ue_get_SR(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id,
|
||||
phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,
|
||||
subframe_tx); // subframe used for meas gap
|
||||
}
|
||||
else {
|
||||
SR_payload = 1;
|
||||
}
|
||||
|
||||
if (SR_payload>0) {
|
||||
generate_ul_signal = 1;
|
||||
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d got the SR for PUSCH is %d\n",
|
||||
@@ -1041,8 +1029,9 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
} else {
|
||||
phy_vars_ue->sr[subframe_tx]=0;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
SR_payload=0;
|
||||
}
|
||||
|
||||
if (get_ack(&phy_vars_ue->lte_frame_parms,
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_ack,
|
||||
@@ -1057,12 +1046,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
pucch_ack_payload,
|
||||
SR_payload);
|
||||
|
||||
#ifdef OPENAIR2
|
||||
Po_PUCCH = pucch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,format);
|
||||
phy_vars_ue->tx_power_dBm = Po_PUCCH;
|
||||
#else
|
||||
phy_vars_ue->tx_power_dBm = UE_TX_POWER;
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
Po_PUCCH = pucch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,format);
|
||||
}
|
||||
else {
|
||||
Po_PUCCH = phy_vars_ue->tx_power_max_dBm;
|
||||
}
|
||||
phy_vars_ue->tx_power_dBm = Po_PUCCH;
|
||||
phy_vars_ue->tx_total_RE = 12;
|
||||
|
||||
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
|
||||
@@ -1120,12 +1110,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
}
|
||||
} else if (SR_payload==1) { // no ACK/NAK but SR is triggered by MAC
|
||||
|
||||
#ifdef OPENAIR2
|
||||
Po_PUCCH = pucch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,pucch_format1);
|
||||
phy_vars_ue->tx_power_dBm = Po_PUCCH;
|
||||
#else
|
||||
phy_vars_ue->tx_power_dBm = UE_TX_POWER;
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
Po_PUCCH = pucch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,pucch_format1);
|
||||
}
|
||||
else {
|
||||
Po_PUCCH = phy_vars_ue->tx_power_max_dBm;
|
||||
}
|
||||
phy_vars_ue->tx_power_dBm = Po_PUCCH;
|
||||
phy_vars_ue->tx_total_RE = 12;
|
||||
|
||||
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
|
||||
@@ -1345,30 +1336,23 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
// }// slot_tx is even
|
||||
// else { // slot_tx is odd, do the PRACH here
|
||||
|
||||
#ifdef OPENAIR2
|
||||
|
||||
if ((phy_vars_ue->UE_mode[eNB_id] == PRACH) && (phy_vars_ue->lte_frame_parms.prach_config_common.prach_Config_enabled==1)) {
|
||||
|
||||
#else
|
||||
|
||||
if (1) {
|
||||
#endif
|
||||
|
||||
// check if we have PRACH opportunity
|
||||
if (is_prach_subframe(&phy_vars_ue->lte_frame_parms,frame_tx,subframe_tx)) {
|
||||
phy_vars_ue->generate_prach=0;
|
||||
#ifdef OPENAIR2
|
||||
|
||||
// ask L2 for RACH transport
|
||||
if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ) {
|
||||
phy_vars_ue->prach_resources[eNB_id] = mac_xface->ue_get_rach(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id,
|
||||
subframe_tx);
|
||||
// LOG_I(PHY,"Got prach_resources for eNB %d address %d, RRCCommon %d\n",eNB_id,phy_vars_ue->prach_resources[eNB_id],UE_mac_inst[Mod_id].radioResourceConfigCommon);
|
||||
}
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled==1){
|
||||
// ask L2 for RACH transport
|
||||
if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ) {
|
||||
phy_vars_ue->prach_resources[eNB_id] = mac_xface->ue_get_rach(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id,
|
||||
subframe_tx);
|
||||
// LOG_I(PHY,"Got prach_resources for eNB %d address %d, RRCCommon %d\n",eNB_id,phy_vars_ue->prach_resources[eNB_id],UE_mac_inst[Mod_id].radioResourceConfigCommon);
|
||||
}
|
||||
}
|
||||
|
||||
if (phy_vars_ue->prach_resources[eNB_id]!=NULL) {
|
||||
|
||||
@@ -1391,16 +1375,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
phy_vars_ue->prach_resources[eNB_id]->ra_TDD_map_index,
|
||||
phy_vars_ue->prach_resources[eNB_id]->ra_RNTI);
|
||||
|
||||
#ifdef OPENAIR2
|
||||
if (mode != calib_prach_tx)
|
||||
if ((phy_vars_ue->mac_enabled==1) && (mode != calib_prach_tx)) {
|
||||
phy_vars_ue->tx_power_dBm = phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(Mod_id,CC_id,eNB_id);
|
||||
}
|
||||
else {
|
||||
phy_vars_ue->tx_power_dBm = phy_vars_ue->tx_power_max_dBm;
|
||||
phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex = 19;
|
||||
}
|
||||
#else
|
||||
phy_vars_ue->tx_power_dBm = UE_TX_POWER;
|
||||
#endif
|
||||
|
||||
phy_vars_ue->tx_total_RE = 96;
|
||||
|
||||
@@ -1431,12 +1412,12 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
|
||||
} else {
|
||||
UE_transport_info[Mod_id][CC_id].cntl.prach_flag=1;
|
||||
UE_transport_info[Mod_id][CC_id].cntl.prach_id=phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex;
|
||||
#ifdef OPENAIR2
|
||||
mac_xface->Msg1_transmitted(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id);
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled==1){
|
||||
mac_xface->Msg1_transmitted(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
eNB_id);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n",
|
||||
@@ -1549,13 +1530,13 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
|
||||
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
||||
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
||||
if (phy_vars_ue->frame_rx%100==0)
|
||||
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id],0);
|
||||
gain_control_all(dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||
|
||||
#else
|
||||
#ifndef OAI_USRP
|
||||
#ifndef OAI_BLADERF
|
||||
#ifndef OAI_LMSSDR
|
||||
phy_adjust_gain (phy_vars_ue,0);
|
||||
phy_adjust_gain (phy_vars_ue,dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -1822,11 +1803,11 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
|
||||
frame_tx += ((int)(phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output[1]&0xfc));
|
||||
frame_tx += pbch_phase;
|
||||
|
||||
#ifdef OPENAIR2
|
||||
mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,frame_rx,eNB_id,
|
||||
phy_vars_ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
|
||||
#endif
|
||||
|
||||
if (phy_vars_ue->mac_enabled==1) {
|
||||
mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,frame_rx,eNB_id,
|
||||
phy_vars_ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
|
||||
}
|
||||
|
||||
#ifdef EMOS
|
||||
//emos_dump_UE.frame_tx = frame_tx;
|
||||
//emos_dump_UE.mimo_mode = phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output[1];
|
||||
@@ -1906,16 +1887,15 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
|
||||
phy_vars_ue->Mod_id,frame_rx, slot_rx);
|
||||
phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq++;
|
||||
phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors++;
|
||||
#ifdef OPENAIR2
|
||||
mac_xface->out_of_sync_ind(phy_vars_ue->Mod_id,frame_rx,eNB_id);
|
||||
#else
|
||||
|
||||
if (phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq>=100) {
|
||||
LOG_E(PHY,"More that 100 consecutive PBCH errors! Exiting!\n");
|
||||
mac_xface->macphy_exit("More that 100 consecutive PBCH errors!");
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
mac_xface->out_of_sync_ind(phy_vars_ue->Mod_id,frame_rx,eNB_id);
|
||||
}
|
||||
else{
|
||||
if (phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq>=100) {
|
||||
LOG_E(PHY,"More that 100 consecutive PBCH errors! Exiting!\n");
|
||||
mac_xface->macphy_exit("More that 100 consecutive PBCH errors!");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
if (frame_rx % 100 == 0) {
|
||||
@@ -2105,10 +2085,10 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
|
||||
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
|
||||
// if (subframe_rx == 9) { //( frame_rx % 100 == 0) {
|
||||
if ( frame_rx % 100 == 0) {
|
||||
LOG_D(PHY,"frame %d, subframe %d, rnti %x: dci %d/%d\n",frame_rx,subframe_rx,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,i,dci_cnt);
|
||||
//dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]);
|
||||
// }
|
||||
dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2416,9 +2396,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
int eNB_id_i = 1;
|
||||
uint8_t dual_stream_UE = 0;
|
||||
#endif
|
||||
#ifndef OPENAIR2
|
||||
uint8_t *rar;
|
||||
#endif
|
||||
int pmch_flag=0;
|
||||
uint8_t sync_area=255;
|
||||
int pmch_mcs=-1;
|
||||
@@ -2427,9 +2405,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
int slot_rx = phy_vars_ue->slot_rx;
|
||||
int subframe_rx = slot_rx>>1;
|
||||
int subframe_prev = (subframe_rx+9)%10;
|
||||
#ifdef OPENAIR2
|
||||
int CC_id = phy_vars_ue->CC_id;
|
||||
#endif
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
|
||||
|
||||
@@ -2661,7 +2637,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid],
|
||||
subframe_prev,
|
||||
harq_pid,
|
||||
1,0);
|
||||
1,1);
|
||||
stop_meas(&phy_vars_ue->dlsch_decoding_stats);
|
||||
}
|
||||
|
||||
@@ -2685,10 +2661,11 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->rvidx,
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs,
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS);
|
||||
|
||||
// if (abstraction_flag ==0 )
|
||||
dump_dlsch(phy_vars_ue,eNB_id,subframe_prev,harq_pid);
|
||||
mac_xface->macphy_exit("DLSCH in error");
|
||||
/*
|
||||
if (abstraction_flag ==0 )
|
||||
dump_dlsch(phy_vars_ue,eNB_id,subframe_prev,harq_pid);
|
||||
mac_xface->macphy_exit("");
|
||||
*/
|
||||
#endif
|
||||
} else {
|
||||
LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d (slot_rx %d): Received DLSCH (rv %d,mcs %d,TBS %d)\n",
|
||||
@@ -2708,14 +2685,14 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
LOG_T(PHY,"\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef OPENAIR2
|
||||
mac_xface->ue_send_sdu(phy_vars_ue->Mod_id,
|
||||
CC_id,
|
||||
frame_rx,
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->b,
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS>>3,
|
||||
eNB_id);
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
mac_xface->ue_send_sdu(phy_vars_ue->Mod_id,
|
||||
CC_id,
|
||||
frame_rx,
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->b,
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS>>3,
|
||||
eNB_id);
|
||||
}
|
||||
phy_vars_ue->total_TBS[eNB_id] = phy_vars_ue->total_TBS[eNB_id] +
|
||||
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS;
|
||||
phy_vars_ue->total_received_bits[eNB_id] = phy_vars_ue->total_TBS[eNB_id] +
|
||||
@@ -2885,24 +2862,20 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc_even[3]);
|
||||
#endif
|
||||
|
||||
#ifdef OPENAIR2
|
||||
/*
|
||||
printf("\n\n");
|
||||
for (i=0;i<phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->TBS>>3;i++)
|
||||
printf("%02x ",phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->b[i]);
|
||||
printf("\n");
|
||||
*/
|
||||
mac_xface->ue_decode_si(phy_vars_ue->Mod_id,
|
||||
CC_id,
|
||||
frame_rx,
|
||||
eNB_id,
|
||||
phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->b,
|
||||
phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->TBS>>3);
|
||||
/*
|
||||
if ((frame_rx % 160) < 10)
|
||||
printf("sending SI to L2 in frame %d\n",frame_rx);
|
||||
*/
|
||||
#endif
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
/*
|
||||
printf("\n\n");
|
||||
for (i=0;i<phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->TBS>>3;i++)
|
||||
printf("%02x ",phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->b[i]);
|
||||
printf("\n");
|
||||
*/
|
||||
mac_xface->ue_decode_si(phy_vars_ue->Mod_id,
|
||||
CC_id,
|
||||
frame_rx,
|
||||
eNB_id,
|
||||
phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->b,
|
||||
phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->TBS>>3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3018,8 +2991,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
subframe_prev, phy_vars_ue->UE_mode[eNB_id]);
|
||||
#endif
|
||||
|
||||
#ifdef OPENAIR2
|
||||
|
||||
if (phy_vars_ue->mac_enabled == 1) {
|
||||
if ((phy_vars_ue->UE_mode[eNB_id] != PUSCH) && (phy_vars_ue->prach_resources[eNB_id]->Msg3!=NULL)) {
|
||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d subframe %d Invoking MAC for RAR (current preamble %d)\n",
|
||||
phy_vars_ue->Mod_id,frame_rx-((subframe_prev==9) ? 1 : 0),
|
||||
@@ -3076,14 +3048,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex);
|
||||
}
|
||||
} // mode != PUSCH
|
||||
|
||||
#else //OPENAIR2
|
||||
|
||||
rar = phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->b+1;
|
||||
timing_advance = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
||||
//timing_advance = phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->b[0];
|
||||
process_timing_advance_rar(phy_vars_ue,timing_advance);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
rar = phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->b+1;
|
||||
timing_advance = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
||||
//timing_advance = phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->b[0];
|
||||
process_timing_advance_rar(phy_vars_ue,timing_advance);
|
||||
}
|
||||
} //ret <= MAX_ITERATIONS
|
||||
|
||||
/*
|
||||
@@ -3352,7 +3323,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
|
||||
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0],
|
||||
subframe_prev,
|
||||
0,
|
||||
0,0);
|
||||
0,1);
|
||||
} else { // abstraction
|
||||
#ifdef PHY_ABSTRACTION
|
||||
ret = dlsch_decoding_emul(phy_vars_ue,
|
||||
@@ -3635,24 +3606,21 @@ void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstr
|
||||
int CC_id =0;
|
||||
#endif
|
||||
int frame_rx = phy_vars_ue->frame_rx;
|
||||
#ifdef OPENAIR2
|
||||
int frame_tx = phy_vars_ue->frame_tx;
|
||||
#endif
|
||||
int slot_rx = phy_vars_ue->slot_rx;
|
||||
int slot_tx = phy_vars_ue->slot_tx;
|
||||
int subframe_tx = slot_tx>>1;
|
||||
int subframe_rx = slot_rx>>1;
|
||||
#undef DEBUG_PHY_PROC
|
||||
|
||||
#ifdef OPENAIR2
|
||||
UE_L2_STATE_t ret;
|
||||
#endif
|
||||
#ifndef OPENAIR2
|
||||
phy_vars_ue->UE_mode[eNB_id]=PUSCH;
|
||||
phy_vars_ue->prach_resources[eNB_id] = &prach_resources_local;
|
||||
prach_resources_local.ra_RNTI = 0xbeef;
|
||||
prach_resources_local.ra_PreambleIndex = 0;
|
||||
#endif
|
||||
|
||||
if (phy_vars_ue->mac_enabled == 0) {
|
||||
phy_vars_ue->UE_mode[eNB_id]=PUSCH;
|
||||
phy_vars_ue->prach_resources[eNB_id] = &prach_resources_local;
|
||||
prach_resources_local.ra_RNTI = 0xbeef;
|
||||
prach_resources_local.ra_PreambleIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1);
|
||||
@@ -3851,16 +3819,14 @@ void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstr
|
||||
phy_procedures_UE_RX(phy_vars_ue,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn);
|
||||
}
|
||||
|
||||
#ifdef OPENAIR2
|
||||
|
||||
if (slot_rx%2==0) {
|
||||
|
||||
ret = mac_xface->ue_scheduler(phy_vars_ue->Mod_id,
|
||||
frame_tx,
|
||||
subframe_rx,
|
||||
subframe_select(&phy_vars_ue->lte_frame_parms,subframe_tx),
|
||||
eNB_id,
|
||||
0/*FIXME CC_id*/);
|
||||
if (phy_vars_ue->mac_enabled==1) {
|
||||
if (slot_rx%2==0) {
|
||||
ret = mac_xface->ue_scheduler(phy_vars_ue->Mod_id,
|
||||
frame_tx,
|
||||
subframe_rx,
|
||||
subframe_select(&phy_vars_ue->lte_frame_parms,subframe_tx),
|
||||
eNB_id,
|
||||
0/*FIXME CC_id*/);
|
||||
|
||||
if (ret == CONNECTION_LOST) {
|
||||
LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",phy_vars_ue->Mod_id,
|
||||
@@ -3879,11 +3845,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstr
|
||||
phy_vars_ue->UE_mode[eNB_id] = PRACH;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// if (last_slot == 19)
|
||||
// phy_vars_ue->frame++;
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,0);
|
||||
stop_meas(&phy_vars_ue->phy_proc);
|
||||
|
||||
@@ -61,25 +61,7 @@
|
||||
extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
|
||||
extern unsigned char offset_mumimo_llr_drange_fix;
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//#define AWGN
|
||||
//#define NO_DCI
|
||||
|
||||
|
||||
|
||||
//#define ABSTRACTION
|
||||
|
||||
/*
|
||||
#define RBmask0 0x00fc00fc
|
||||
#define RBmask1 0x0
|
||||
#define RBmask2 0x0
|
||||
#define RBmask3 0x0
|
||||
*/
|
||||
|
||||
PHY_VARS_eNB *PHY_vars_eNB;
|
||||
PHY_VARS_UE *PHY_vars_UE;
|
||||
@@ -233,14 +215,13 @@ int main(int argc, char **argv)
|
||||
// void *data;
|
||||
// int ii;
|
||||
// int bler;
|
||||
double blerr[4],uncoded_ber;//,avg_ber;
|
||||
double blerr[4],uncoded_ber,avg_ber;
|
||||
short *uncoded_ber_bit=NULL;
|
||||
uint8_t N_RB_DL=25,osf=1;
|
||||
frame_t frame_type = FDD;
|
||||
#ifdef XFORMS
|
||||
int xforms=0;
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
#endif
|
||||
uint32_t DLSCH_RB_ALLOC = 0x1fff;
|
||||
int numCCE=0;
|
||||
int dci_length_bytes=0,dci_length=0;
|
||||
@@ -305,7 +286,7 @@ int main(int argc, char **argv)
|
||||
// num_layers = 1;
|
||||
perfect_ce = 0;
|
||||
|
||||
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) {
|
||||
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:XY")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
awgn_flag = 1;
|
||||
@@ -557,6 +538,10 @@ int main(int argc, char **argv)
|
||||
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
xforms=1;
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
perfect_ce=1;
|
||||
break;
|
||||
@@ -636,21 +621,20 @@ int main(int argc, char **argv)
|
||||
if ((transmission_mode > 1) && (n_tx != 2))
|
||||
printf("n_tx must be >1 for transmission_mode %d\n",transmission_mode);
|
||||
|
||||
#ifdef XFORMS
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
sprintf (title, "LTE PHY SCOPE eNB");
|
||||
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
|
||||
if (!dual_stream_UE==0) {
|
||||
openair_daq_vars.use_ia_receiver = 1;
|
||||
fl_set_button(form_ue->button_0,1);
|
||||
fl_set_object_label(form_ue->button_0, "IA Receiver ON");
|
||||
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
|
||||
if (xforms==1) {
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
sprintf (title, "LTE PHY SCOPE eNB");
|
||||
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
|
||||
if (!dual_stream_UE==0) {
|
||||
openair_daq_vars.use_ia_receiver = 1;
|
||||
fl_set_button(form_ue->button_0,1);
|
||||
fl_set_object_label(form_ue->button_0, "IA Receiver ON");
|
||||
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (transmission_mode==5) {
|
||||
n_users = 2;
|
||||
printf("dual_stream_UE=%d\n", dual_stream_UE);
|
||||
@@ -3306,7 +3290,7 @@ PMI_FEEDBACK:
|
||||
PHY_vars_UE->dlsch_ue[0][cw]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw]->current_harq_pid]->G = coded_bits_per_codeword;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
// calculate uncoded BLER
|
||||
uncoded_ber=0;
|
||||
for (i=0;i<coded_bits_per_codeword;i++)
|
||||
@@ -3322,7 +3306,7 @@ PMI_FEEDBACK:
|
||||
|
||||
if (n_frames==1)
|
||||
write_output("uncoded_ber_bit.m","uncoded_ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0);
|
||||
*/
|
||||
|
||||
|
||||
start_meas(&PHY_vars_UE->dlsch_unscrambling_stats);
|
||||
dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms,
|
||||
@@ -3433,12 +3417,12 @@ PMI_FEEDBACK:
|
||||
}
|
||||
|
||||
sprintf(fname,"rxsig0_r%d.m",round);
|
||||
sprintf(vname,"rxs0_r%d.m",round);
|
||||
sprintf(vname,"rxs0_r%d",round);
|
||||
write_output(fname,vname, &PHY_vars_UE->lte_ue_common_vars.rxdata[0][0],10*PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1);
|
||||
sprintf(fname,"rxsigF0_r%d.m",round);
|
||||
sprintf(vname,"rxs0F_r%d.m",round);
|
||||
sprintf(vname,"rxs0F_r%d",round);
|
||||
write_output(fname,vname, &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],2*PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,2,1);
|
||||
|
||||
|
||||
if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) {
|
||||
sprintf(fname,"rxsig1_r%d.m",round);
|
||||
sprintf(vname,"rxs1_r%d.m",round);
|
||||
@@ -3449,14 +3433,14 @@ PMI_FEEDBACK:
|
||||
}
|
||||
|
||||
sprintf(fname,"dlsch00_r%d.m",round);
|
||||
sprintf(vname,"dl00_r%d.m",round);
|
||||
sprintf(vname,"dl00_r%d",round);
|
||||
write_output(fname,vname,
|
||||
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][0][0]),
|
||||
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
|
||||
|
||||
if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) {
|
||||
sprintf(fname,"dlsch01_r%d.m",round);
|
||||
sprintf(vname,"dl01_r%d.m",round);
|
||||
sprintf(vname,"dl01_r%d",round);
|
||||
write_output(fname,vname,
|
||||
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][1][0]),
|
||||
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1);
|
||||
@@ -3464,7 +3448,7 @@ PMI_FEEDBACK:
|
||||
|
||||
if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) {
|
||||
sprintf(fname,"dlsch10_r%d.m",round);
|
||||
sprintf(vname,"dl10_r%d.m",round);
|
||||
sprintf(vname,"dl10_r%d",round);
|
||||
write_output(fname,vname,
|
||||
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][2][0]),
|
||||
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1);
|
||||
@@ -3472,7 +3456,7 @@ PMI_FEEDBACK:
|
||||
|
||||
if ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) && (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)) {
|
||||
sprintf(fname,"dlsch11_r%d.m",round);
|
||||
sprintf(vname,"dl11_r%d.m",round);
|
||||
sprintf(vname,"dl11_r%d",round);
|
||||
write_output(fname,vname,
|
||||
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][3][0]),
|
||||
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1);
|
||||
@@ -3496,13 +3480,13 @@ PMI_FEEDBACK:
|
||||
// PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round++;
|
||||
}
|
||||
|
||||
#ifdef XFORMS
|
||||
phy_scope_UE(form_ue,
|
||||
PHY_vars_UE,
|
||||
eNB_id,
|
||||
0,// UE_id
|
||||
subframe);
|
||||
#endif
|
||||
if (xforms==1) {
|
||||
phy_scope_UE(form_ue,
|
||||
PHY_vars_UE,
|
||||
eNB_id,
|
||||
0,// UE_id
|
||||
subframe);
|
||||
}
|
||||
|
||||
} //round
|
||||
|
||||
@@ -4003,7 +3987,7 @@ PMI_FEEDBACK:
|
||||
printf("[continue] effective rate : %f (%2.1f%%,%f)): increase snr \n",rate*effective_rate, 100*effective_rate, rate);
|
||||
}
|
||||
|
||||
if (((double)errs[0]/(round_trials[0]))<1e-2)
|
||||
if (((double)errs[0]/(round_trials[0]))<(10.0/n_frames))
|
||||
break;
|
||||
}// SNR
|
||||
|
||||
|
||||
@@ -173,7 +173,9 @@ int main(int argc, char **argv)
|
||||
|
||||
lte_frame_type_t frame_type = FDD;
|
||||
|
||||
uint32_t Nsoft = 1827072;
|
||||
|
||||
/*
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
@@ -183,6 +185,7 @@ int main(int argc, char **argv)
|
||||
sprintf (title, "LTE DL SCOPE UE");
|
||||
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
#endif
|
||||
*/
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
@@ -382,14 +385,14 @@ int main(int argc, char **argv)
|
||||
0);
|
||||
|
||||
// Create transport channel structures for 2 transport blocks (MIMO)
|
||||
PHY_vars_eNB->dlsch_eNB_MCH = new_eNB_dlsch(1,8,N_RB_DL,0);
|
||||
PHY_vars_eNB->dlsch_eNB_MCH = new_eNB_dlsch(1,8,Nsoft,N_RB_DL,0);
|
||||
|
||||
if (!PHY_vars_eNB->dlsch_eNB_MCH) {
|
||||
printf("Can't get eNB dlsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
PHY_vars_UE->dlsch_ue_MCH[0] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS_MBSFN,N_RB_DL,0);
|
||||
PHY_vars_UE->dlsch_ue_MCH[0] = new_ue_dlsch(1,8,Nsoft,MAX_TURBO_ITERATIONS_MBSFN,N_RB_DL,0);
|
||||
|
||||
PHY_vars_eNB->lte_frame_parms.num_MBSFN_config = 1;
|
||||
PHY_vars_eNB->lte_frame_parms.MBSFN_config[0].radioframeAllocationPeriod = 0;
|
||||
|
||||
@@ -52,9 +52,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
#include "OCG_vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif
|
||||
|
||||
extern unsigned short dftsizes[33];
|
||||
extern short *ul_ref_sigs[30][2][33];
|
||||
@@ -74,12 +72,9 @@ node_desc_t *ue_data[NUMBER_OF_UE_MAX];
|
||||
extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16];
|
||||
//extern char* namepointer_chMag ;
|
||||
|
||||
|
||||
|
||||
#ifdef XFORMS
|
||||
int xforms=0;
|
||||
FD_lte_phy_scope_enb *form_enb;
|
||||
char title[255];
|
||||
#endif
|
||||
|
||||
/*the following parameters are used to control the processing times*/
|
||||
double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */
|
||||
@@ -204,7 +199,7 @@ int main(int argc, char **argv)
|
||||
|
||||
logInit();
|
||||
|
||||
while ((c = getopt (argc, argv, "hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:L")) != -1) {
|
||||
while ((c = getopt (argc, argv, "hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
channel_model = AWGN;
|
||||
@@ -454,6 +449,10 @@ int main(int argc, char **argv)
|
||||
max_turbo_iterations=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
xforms=1;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
dump_table = 1;
|
||||
break;
|
||||
@@ -589,12 +588,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
#ifdef XFORMS
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_enb = create_lte_phy_scope_enb();
|
||||
sprintf (title, "LTE PHY SCOPE eNB");
|
||||
fl_show_form (form_enb->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
#endif
|
||||
if (xforms==1) {
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_enb = create_lte_phy_scope_enb();
|
||||
sprintf (title, "LTE PHY SCOPE eNB");
|
||||
fl_show_form (form_enb->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
}
|
||||
|
||||
PHY_vars_UE->lte_ue_pdcch_vars[0]->crnti = 14;
|
||||
|
||||
@@ -1356,9 +1355,9 @@ int main(int argc, char **argv)
|
||||
if ((errs[0]>=100) && (trials>(n_frames/2)))
|
||||
break;
|
||||
|
||||
#ifdef XFORMS
|
||||
phy_scope_eNB(form_enb,PHY_vars_eNB,0);
|
||||
#endif
|
||||
if (xforms==1)
|
||||
phy_scope_eNB(form_enb,PHY_vars_eNB,0);
|
||||
|
||||
/*calculate the total processing time for each packet, get the max, min, and number of packets that exceed t>3000us*/
|
||||
|
||||
double t_tx = (double)PHY_vars_UE->phy_proc_tx.p_time/cpu_freq_GHz/1000.0;
|
||||
|
||||
@@ -48,7 +48,19 @@ Description Contains global common definitions
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef signed char boolean_t;
|
||||
|
||||
#if !defined(TRUE)
|
||||
#define TRUE (boolean_t)0x01
|
||||
#endif
|
||||
|
||||
#if !defined(FALSE)
|
||||
#define FALSE (boolean_t)0x00
|
||||
#endif
|
||||
|
||||
#define BOOL_NOT(b) (b^TRUE)
|
||||
|
||||
#define NAS_UE_ID_FMT "0x%06x"
|
||||
|
||||
@@ -59,13 +71,6 @@ Description Contains global common definitions
|
||||
#define RETURNok (0)
|
||||
#define RETURNerror (-1)
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (0)
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE (1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Name of the environment variable which defines the default directory
|
||||
* where the NAS application is executed and where are located files
|
||||
|
||||
@@ -112,7 +112,7 @@ typedef struct net_ip_address_s {
|
||||
unsigned ipv4:1;
|
||||
unsigned ipv6:1;
|
||||
char ipv4_address[16];
|
||||
char ipv6_address[40];
|
||||
char ipv6_address[46];
|
||||
} net_ip_address_t;
|
||||
|
||||
typedef uint64_t bitrate_t;
|
||||
|
||||
@@ -265,7 +265,7 @@ static const eutra_band_t eutra_bands[] = {
|
||||
|
||||
Enb_properties_array_t enb_properties;
|
||||
|
||||
static void enb_config_display(void)
|
||||
void enb_config_display(void)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
@@ -1019,7 +1019,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||
|
||||
enb_properties.properties[enb_properties_index]->prach_zero_correlation[j] =prach_zero_correlation;
|
||||
|
||||
if ((prach_zero_correlation <0) || (prach_zero_correlation > 63))
|
||||
if ((prach_zero_correlation <0) || (prach_zero_correlation > 15))
|
||||
AssertError (0, parse_errors ++,
|
||||
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n",
|
||||
lib_config_file_name_pP, i, prach_zero_correlation);
|
||||
|
||||
@@ -264,6 +264,7 @@ typedef struct Enb_properties_array_s {
|
||||
Enb_properties_t *properties[MAX_ENB];
|
||||
} Enb_properties_array_t;
|
||||
|
||||
void enb_config_display(void);
|
||||
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP);
|
||||
|
||||
const Enb_properties_array_t *enb_config_get(void);
|
||||
|
||||
@@ -525,54 +525,6 @@ uint32_t bytes_to_bsr_index(int32_t nbytes)
|
||||
return(i-1);
|
||||
}
|
||||
|
||||
/*
|
||||
void adjust_bsr_info(int buffer_occupancy,
|
||||
uint16_t TBS,
|
||||
UE_TEMPLATE *UE_template)
|
||||
{
|
||||
|
||||
uint32_t tmp_bsr;
|
||||
|
||||
// could not serve all the uplink traffic
|
||||
if (buffer_occupancy > 0 ) {
|
||||
if (BSR_TABLE[UE_template->bsr_info[LCGID0]] <= TBS ) {
|
||||
tmp_bsr = BSR_TABLE[UE_template->bsr_info[LCGID0]]; // serving this amout of bytes
|
||||
UE_template->bsr_info[LCGID0] = 0;
|
||||
|
||||
if (BSR_TABLE[UE_template->bsr_info[LCGID1]] <= (TBS-tmp_bsr)) {
|
||||
tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID1]];
|
||||
UE_template->bsr_info[LCGID1] = 0;
|
||||
|
||||
if (BSR_TABLE[UE_template->bsr_info[LCGID2]] <= (TBS-tmp_bsr)) {
|
||||
tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID2]];
|
||||
UE_template->bsr_info[LCGID2] = 0;
|
||||
|
||||
if (BSR_TABLE[UE_template->bsr_info[LCGID3]] <= (TBS-tmp_bsr)) {
|
||||
tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID3]];
|
||||
UE_template->bsr_info[LCGID3] = 0;
|
||||
} else {
|
||||
UE_template->bsr_info[LCGID3] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID3]] - ((int32_t) TBS - (int32_t)tmp_bsr));
|
||||
}
|
||||
} else {
|
||||
UE_template->bsr_info[LCGID2] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID2]] - ((int32_t)TBS - (int32_t)tmp_bsr));
|
||||
}
|
||||
} else {
|
||||
UE_template->bsr_info[LCGID1] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID1]] - ((int32_t)TBS - (int32_t)tmp_bsr));
|
||||
}
|
||||
} else {
|
||||
UE_template->bsr_info[LCGID0] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID0]] - (int32_t)TBS);
|
||||
}
|
||||
} else { // we have flushed all buffers so clear bsr
|
||||
UE_template->bsr_info[LCGID0] = 0;
|
||||
UE_template->bsr_info[LCGID1] = 0;
|
||||
UE_template->bsr_info[LCGID2] = 0;
|
||||
UE_template->bsr_info[LCGID3] = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id, sub_frame_t subframeP, UE_ULSCH_STATUS status)
|
||||
{
|
||||
|
||||
@@ -584,66 +536,6 @@ void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id, sub_frame_t
|
||||
|
||||
}
|
||||
|
||||
// This seems not to be used anymore
|
||||
/*
|
||||
int schedule_next_ulue(module_id_t module_idP, int UE_id, sub_frame_t subframeP){
|
||||
|
||||
int next_ue;
|
||||
|
||||
// first phase: scheduling for ACK
|
||||
switch (subframeP) {
|
||||
// scheduling for subframeP 2: for scheduled user during subframeP 5 and 6
|
||||
case 8:
|
||||
if ((eNB_dlsch_info[module_idP][UE_id].status == S_DL_SCHEDULED) &&
|
||||
(eNB_dlsch_info[module_idP][UE_id].subframe == 5 || eNB_dlsch_info[module_idP][UE_id].subframe == 6)){
|
||||
// set the downlink status
|
||||
eNB_dlsch_info[module_idP][UE_id].status = S_DL_BUFFERED;
|
||||
return UE_id;
|
||||
}
|
||||
break;
|
||||
// scheduling for subframeP 3: for scheduled user during subframeP 7 and 8
|
||||
case 9:
|
||||
if ((eNB_dlsch_info[module_idP][UE_id].status == S_DL_SCHEDULED) &&
|
||||
(eNB_dlsch_info[module_idP][UE_id].subframe == 7 || eNB_dlsch_info[module_idP][UE_id].subframe == 8)){
|
||||
eNB_dlsch_info[module_idP][UE_id].status = S_DL_BUFFERED;
|
||||
return UE_id;
|
||||
}
|
||||
break;
|
||||
// scheduling UL subframeP 4: for scheduled user during subframeP 9 and 0
|
||||
case 0 :
|
||||
if ((eNB_dlsch_info[module_idP][UE_id].status == S_DL_SCHEDULED) &&
|
||||
(eNB_dlsch_info[module_idP][UE_id].subframe == 9 || eNB_dlsch_info[module_idP][UE_id].subframe == 0)){
|
||||
eNB_dlsch_info[module_idP][UE_id].status = S_DL_BUFFERED;
|
||||
return UE_id;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// second phase
|
||||
for (next_ue=0; next_ue <NUMBER_OF_UE_MAX; next_ue++ ){
|
||||
|
||||
if (eNB_ulsch_info[module_idP][next_ue].status == S_UL_WAITING )
|
||||
return next_ue;
|
||||
else if (eNB_ulsch_info[module_idP][next_ue].status == S_UL_SCHEDULED){
|
||||
eNB_ulsch_info[module_idP][next_ue].status = S_UL_BUFFERED;
|
||||
}
|
||||
}
|
||||
for (next_ue=0; next_ue <NUMBER_OF_UE_MAX; next_ue++ ){
|
||||
if (eNB_ulsch_info[module_idP][next_ue].status != S_UL_NONE )// do this just for active UEs
|
||||
eNB_ulsch_info[module_idP][next_ue].status = S_UL_WAITING;
|
||||
}
|
||||
next_ue = 0;
|
||||
return next_ue;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned char *parse_ulsch_header(unsigned char *mac_header,
|
||||
unsigned char *num_ce,
|
||||
unsigned char *num_sdu,
|
||||
@@ -957,7 +849,7 @@ void schedule_ulsch_rnti(module_id_t module_idP,
|
||||
// buffer_occupancy = UE_template->ul_total_buffer;
|
||||
|
||||
while (((rb_table[rb_table_index]>(frame_parms->N_RB_UL-1-first_rb[CC_id])) ||
|
||||
(rb_table[rb_table_index]>39)) &&
|
||||
(rb_table[rb_table_index]>45)) &&
|
||||
(rb_table_index>0)) {
|
||||
rb_table_index--;
|
||||
}
|
||||
@@ -984,12 +876,6 @@ void schedule_ulsch_rnti(module_id_t module_idP,
|
||||
first_rb[CC_id],rb_table[rb_table_index],
|
||||
rb_table_index,TBS,harq_pid);
|
||||
|
||||
/*
|
||||
// Adjust BSR entries for LCGIDs
|
||||
adjust_bsr_info(buffer_occupancy,
|
||||
TBS,
|
||||
UE_template);
|
||||
*/
|
||||
// adjust total UL buffer status by TBS, wait for UL sdus to do final update
|
||||
LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,TBS);
|
||||
if (UE_template->ul_total_buffer > TBS)
|
||||
@@ -998,16 +884,8 @@ void schedule_ulsch_rnti(module_id_t module_idP,
|
||||
UE_template->ul_total_buffer = 0;
|
||||
LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);
|
||||
// Cyclic shift for DM RS
|
||||
if(cooperation_flag == 2) {
|
||||
if(UE_id == 1) { // For Distriibuted Alamouti, cyclic shift applied to 2nd UE
|
||||
cshift = 1;
|
||||
} else {
|
||||
cshift = 0;
|
||||
}
|
||||
} else {
|
||||
cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
|
||||
}
|
||||
|
||||
cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
|
||||
|
||||
if (frame_parms->frame_type == TDD) {
|
||||
switch (frame_parms->N_RB_UL) {
|
||||
case 6:
|
||||
|
||||
@@ -47,8 +47,8 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id)
|
||||
|
||||
if (CC_id>0) {
|
||||
LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n");
|
||||
mac_xface->macphy_exit("MAC FATAL CC_id>0");
|
||||
return 0; // not reached
|
||||
//mac_xface->macphy_exit("MAC FATAL CC_id>0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
|
||||
@@ -56,7 +56,8 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id)
|
||||
}
|
||||
else {
|
||||
LOG_E(MAC,"[UE %d] CCid %d FATAL radioResourceConfigCommon is NULL !!!\n",module_idP,CC_id);
|
||||
mac_xface->macphy_exit("FATAL radioResourceConfigCommon is NULL");
|
||||
//mac_xface->macphy_exit("FATAL radioResourceConfigCommon is NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return(-120 + (rach_ConfigCommon->powerRampingParameters.preambleInitialReceivedTargetPower<<1) +
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "LAYER2/MAC/proto.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "OCG.h"
|
||||
#include "OCG_extern.h"
|
||||
@@ -807,6 +808,9 @@ void dlsch_scheduler_pre_processor_reset (int module_idP,
|
||||
ue_sched_ctl->ta_timer--;
|
||||
ue_sched_ctl->ta_update =0; // don't trigger a timing advance command
|
||||
}
|
||||
if (UE_id==0) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,ue_sched_ctl->ta_update);
|
||||
}
|
||||
nb_rbs_required[CC_id][UE_id]=0;
|
||||
ue_sched_ctl->pre_nb_available_rbs[CC_id] = 0;
|
||||
ue_sched_ctl->dl_pow_off[CC_id] = 2;
|
||||
@@ -937,9 +941,6 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
|
||||
UE_TEMPLATE *UE_template = 0;
|
||||
LTE_DL_FRAME_PARMS *frame_parms = 0;
|
||||
|
||||
// LOG_I(MAC,"store ulsch buffers\n");
|
||||
// convert BSR to bytes for comparison with tbs
|
||||
// store_ulsch_buffer(module_idP,frameP, subframeP);
|
||||
|
||||
//LOG_I(MAC,"assign max mcs min rb\n");
|
||||
// maximize MCS and then allocate required RB according to the buffer occupancy with the limit of max available UL RB
|
||||
@@ -1097,51 +1098,6 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void store_ulsch_buffer(module_id_t module_idP, int frameP, sub_frame_t subframeP)
|
||||
{
|
||||
|
||||
int UE_id,pCC_id,lcgid;
|
||||
UE_list_t *UE_list = &eNB_mac_inst[module_idP].UE_list;
|
||||
UE_TEMPLATE *UE_template;
|
||||
|
||||
for (UE_id=UE_list->head_ul; UE_id>=0; UE_id=UE_list->next_ul[UE_id]) {
|
||||
|
||||
|
||||
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
|
||||
continue;
|
||||
|
||||
UE_template = &UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id];
|
||||
//LOG_I(MAC,"[UE %d next %d] SR is %d\n",UE_id, UE_list->next_ul[UE_id], UE_template->ul_SR);
|
||||
|
||||
UE_template->ul_total_buffer=0;
|
||||
|
||||
for (lcgid=0; lcgid<MAX_NUM_LCGID; lcgid++) {
|
||||
UE_template->ul_buffer_info[lcgid]=BSR_TABLE[UE_template->bsr_info[lcgid]];
|
||||
UE_template->ul_total_buffer+= UE_template->ul_buffer_info[lcgid]; // apply traffic aggregtaion if packets are small
|
||||
// UE_template->ul_buffer_creation_time_max=cmax(UE_template->ul_buffer_creation_time_max, frame_cycle*1024 + frameP-UE_template->ul_buffer_creation_time[lcgid]));
|
||||
}
|
||||
|
||||
if ( UE_template->ul_total_buffer >0)
|
||||
LOG_D(MAC,"[eNB %d] Frame %d subframe %d UE %d CC id %d: LCGID0 %d, LCGID1 %d, LCGID2 %d LCGID3 %d, BO %d\n",
|
||||
module_idP, frameP,subframeP, UE_id, UE_PCCID(module_idP,UE_id),
|
||||
UE_template->ul_buffer_info[LCGID0],
|
||||
UE_template->ul_buffer_info[LCGID1],
|
||||
UE_template->ul_buffer_info[LCGID2],
|
||||
UE_template->ul_buffer_info[LCGID3],
|
||||
UE_template->ul_total_buffer);
|
||||
else if (UE_is_to_be_scheduled(module_idP,UE_PCCID(module_idP,UE_id),UE_id) > 0 ) {
|
||||
if (UE_template->ul_total_buffer == 0 ) {
|
||||
UE_template->ul_total_buffer = BSR_TABLE[11];
|
||||
}
|
||||
|
||||
LOG_D(MAC,"[eNB %d] Frame %d subframe %d UE %d CC id %d: SR active, set BO to %d \n",
|
||||
module_idP, frameP,subframeP, UE_id, UE_PCCID(module_idP,UE_id),
|
||||
UE_template->ul_total_buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subframeP, uint16_t *first_rb)
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
# include "DRB-ToAddModList.h"
|
||||
# include "SRB-ToAddMod.h"
|
||||
# include "SRB-ToAddModList.h"
|
||||
# include "DRB-ToReleaseList.h"
|
||||
|
||||
#ifdef Rel10
|
||||
#include "PMCH-InfoList-r9.h"
|
||||
#endif
|
||||
|
||||
@@ -122,6 +122,7 @@ const char* eurecomVariablesNames[] = {
|
||||
"ue0_BSR",
|
||||
"ue0_BO",
|
||||
"ue0_scheduled",
|
||||
"ue0_timing_advance",
|
||||
"ue0_SR_ENERGY",
|
||||
"ue0_SR_THRES",
|
||||
"ue0_rssi0",
|
||||
|
||||
@@ -94,6 +94,7 @@ typedef enum {
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_THRES,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI0,
|
||||
|
||||
@@ -51,10 +51,6 @@
|
||||
#include "UTIL/OPT/opt.h"
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
char * strndup (const char *s, size_t size);
|
||||
#endif
|
||||
|
||||
static int oai_emulation_; /*!< \brief indicating that the parsing position is now within OAI_Emulation_*/
|
||||
|
||||
static int environment_system_config_; /*!< \brief indicating that the parsing position is now within Envi_Config_*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@ def outputHeaderToFile(f, filename):
|
||||
f.write("""/*******************************************************************************
|
||||
|
||||
Eurecom OpenAirInterface
|
||||
Copyright(c) 1999 - 2013 Eurecom
|
||||
Copyright(c) 1999 - 2015 Eurecom
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms and conditions of the GNU General Public License,
|
||||
@@ -250,20 +250,31 @@ for key in iesDefs:
|
||||
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
|
||||
keylowerunderscore = re.sub('-', '_', key.lower())
|
||||
firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
|
||||
|
||||
f.write("/* %s in iesDefs not in ieofielist.values() */\n" % (key))
|
||||
f.write("/** \\brief Decode function for %s ies.\n" % (key))
|
||||
if len(iesDefs[key]["ies"]) != 0:
|
||||
f.write(" * \\param %s Pointer to ASN1 structure in which data will be stored\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" * \\param any_p Pointer to the ANY value to decode.\n")
|
||||
f.write(" **/\n")
|
||||
f.write("int %s_decode_%s(\n" % (fileprefix, keylowerunderscore))
|
||||
|
||||
if len(iesDefs[key]["ies"]) != 0:
|
||||
f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" ANY_t *any_p);\n\n")
|
||||
|
||||
f.write("/* %s in iesDefs not in ieofielist.values() */\n" % (key))
|
||||
f.write("/** \\brief Compare function for %s ies.\n" % (key))
|
||||
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
|
||||
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
|
||||
f.write(" **/\n")
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, keylowerunderscore))
|
||||
f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" %s_t *%s2);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
|
||||
if len(iesDefs[key]["ies"]) == 0:
|
||||
continue
|
||||
|
||||
f.write("/* %s in iesDefs not in ieofielist.values() */\n" % (key))
|
||||
f.write("/** \\brief Encode function for %s ies.\n" % (key))
|
||||
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
|
||||
f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
@@ -272,16 +283,19 @@ for key in iesDefs:
|
||||
f.write(" %s_t *%s,\n" % (asn1cStruct, firstlower))
|
||||
f.write(" %s_t *%s);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
|
||||
|
||||
for key in iesDefs:
|
||||
if key not in ieofielist.values():
|
||||
continue
|
||||
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
|
||||
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
|
||||
firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
|
||||
f.write("/* %s in iesDefs in ieofielist.values() */\n" % (key))
|
||||
f.write("/** \\brief Encode function for %s ies.\n" % (key))
|
||||
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
|
||||
f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" **/\n")
|
||||
f.write("/* %s in iesDefs in ieofielist.values() */\n" % (key))
|
||||
f.write("int %s_encode_%s(\n" % (fileprefix, firstlower.lower()))
|
||||
f.write(" %s_t *%s,\n" % (asn1cStruct, firstlower))
|
||||
f.write(" %sIEs_t *%sIEs);\n\n" % (asn1cStruct, firstlower))
|
||||
@@ -289,9 +303,19 @@ for key in iesDefs:
|
||||
f.write(" * \\param any_p Pointer to the ANY value to decode.\n")
|
||||
f.write(" * \\param callback Callback function called when any_p is successfully decoded.\n")
|
||||
f.write(" **/\n")
|
||||
f.write("/* %s in iesDefs in ieofielist.values() */\n" % (key))
|
||||
f.write("int %s_decode_%s(\n" % (fileprefix, firstlower.lower()))
|
||||
f.write(" %sIEs_t *%sIEs,\n" % (asn1cStruct, firstlower))
|
||||
f.write(" %s_t *%s);\n\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct)))
|
||||
f.write("/** \\brief Compare function for %s ies.\n" % (key))
|
||||
f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
|
||||
f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
|
||||
f.write(" **/\n")
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, firstlower.lower()))
|
||||
f.write(" %sIEs_t *%s1,\n" % (asn1cStruct, firstlower))
|
||||
f.write(" %sIEs_t *%s2);\n\n" % (asn1cStruct, firstlower))
|
||||
|
||||
|
||||
|
||||
for key in iesDefs:
|
||||
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
|
||||
@@ -704,3 +728,170 @@ for (key, value) in iesDefs.items():
|
||||
#f.write("cb_failed:\n")
|
||||
#f.write(" return er;\n")
|
||||
f.write("}\n\n")
|
||||
|
||||
|
||||
#Generate xer print functions
|
||||
f = open(outdir + fileprefix + '_compare.c', 'w')
|
||||
outputHeaderToFile(f, filename)
|
||||
f.write("#include <stdlib.h>\n")
|
||||
f.write("#include <stdio.h>\n\n")
|
||||
f.write("#include <asn_application.h>\n#include <asn_internal.h>\n\n")
|
||||
f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n" % (fileprefix, fileprefix))
|
||||
f.write("#include \"%s-ProtocolIE-ID.h\"\n\n" % (fileprefix_first_upper))
|
||||
|
||||
|
||||
for key in iesDefs:
|
||||
if key in ieofielist.values():
|
||||
continue
|
||||
structName = re.sub('ies', '', key)
|
||||
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
|
||||
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
|
||||
if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
|
||||
asn1cStruct = asn1cStruct[:-1]
|
||||
asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
|
||||
firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
|
||||
|
||||
iesaccess = ""
|
||||
if key not in ieofielist.values():
|
||||
iesaccess = "%s_ies." % (firstwordlower)
|
||||
|
||||
keyName = re.sub('-', '_', key)
|
||||
keyupperunderscore = keyName.upper()
|
||||
# No IE to encode...
|
||||
if len(iesDefs[key]["ies"]) == 0:
|
||||
continue
|
||||
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
|
||||
f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" %s_t *%s2) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
|
||||
f.write(" asn_comp_rval_t *rv = NULL;\n\n")
|
||||
f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
|
||||
|
||||
f.write(" assert(%s1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
|
||||
f.write(" assert(%s2 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
|
||||
|
||||
loop = 0
|
||||
for ie in iesDefs[key]["ies"]:
|
||||
iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
|
||||
ienameunderscore = re.sub('-', '_', iename)
|
||||
ienamefirstwordlower = lowerFirstCamelWord(iename)
|
||||
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
|
||||
ietypeunderscore = re.sub('-', '_', ie[2])
|
||||
|
||||
if ie[3] != "mandatory":
|
||||
|
||||
loop = loop + 1
|
||||
if loop == 1:
|
||||
#f.write(" %s_IE_t *ie1 = NULL;\n" % (fileprefix_first_upper))
|
||||
#f.write(" %s_IE_t *ie2 = NULL;\n" % (fileprefix_first_upper))
|
||||
f.write(" if (%s1->presenceMask != %s2->presenceMask) {rv=calloc(1,sizeof(asn_comp_rval_t));rv->name = asn_DEF_%s.name;rv->structure1 = %s1;rv->structure2 = %s2;rv->err_code = COMPARE_ERR_CODE_VALUE_NULL; return rv;}\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key)), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
|
||||
if ie[3] == "optional":
|
||||
f.write(" /* Optional field */\n")
|
||||
elif ie[3] == "conditional":
|
||||
f.write(" /* Conditional field */\n")
|
||||
f.write(" if (%s1->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
|
||||
|
||||
|
||||
if ie[2] in ieofielist.keys():
|
||||
f.write(" /* collection field */\n")
|
||||
f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if(rv2) {")
|
||||
f.write(" if (NULL == rv) {")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" } else {")
|
||||
f.write(" rv2->next = rv;")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" }")
|
||||
f.write(" rv2 = NULL;")
|
||||
f.write(" }")
|
||||
else:
|
||||
f.write(" /* simple field */\n")
|
||||
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s); \n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if (rv2) {")
|
||||
f.write(" if (NULL == rv) {")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" } else {")
|
||||
f.write(" rv2->next = rv;")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" }")
|
||||
f.write(" rv2 = NULL;")
|
||||
f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;" % (ietypeunderscore))
|
||||
f.write(" }")
|
||||
|
||||
f.write(" assert(0);\n");
|
||||
f.write(" }\n\n")
|
||||
|
||||
else:
|
||||
if ie[2] in ieofielist.keys():
|
||||
f.write(" /* Mandatory collection field */\n")
|
||||
f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if (rv2) {\n")
|
||||
f.write(" if (NULL == rv) {\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" } else {\n")
|
||||
f.write(" rv2->next = rv;\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" }\n")
|
||||
f.write(" rv2 = NULL;\n")
|
||||
f.write(" }\n")
|
||||
|
||||
else:
|
||||
f.write(" /* Mandatory simple field */\n")
|
||||
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if(rv2) {\n")
|
||||
f.write(" if (NULL == rv) {\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" } else {\n")
|
||||
f.write(" rv2->next = rv;\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" }\n")
|
||||
f.write(" rv2 = NULL;\n")
|
||||
f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;\n" % (ietypeunderscore))
|
||||
f.write(" }\n")
|
||||
f.write(" return rv;\n")
|
||||
f.write("}\n\n")
|
||||
|
||||
for (key, value) in iesDefs.items():
|
||||
if key not in ieofielist.values():
|
||||
continue
|
||||
|
||||
ie = value["ies"][0]
|
||||
ietypeunderscore = re.sub('-', '_', ie[2])
|
||||
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key)))
|
||||
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
|
||||
firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
|
||||
|
||||
for (i, j) in ieofielist.items():
|
||||
if j == key:
|
||||
break
|
||||
|
||||
f.write("extern asn_TYPE_descriptor_t asn_DEF_%s;\n" % (ietypeunderscore))
|
||||
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', i).lower()))
|
||||
f.write(" %sIEs_t *%sIEs1,\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
|
||||
f.write(" %sIEs_t *%sIEs2) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
|
||||
f.write(" int i;\n")
|
||||
f.write(" asn_comp_rval_t *rv = NULL;\n\n")
|
||||
f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
|
||||
|
||||
|
||||
f.write(" assert(%sIEs1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
|
||||
f.write(" assert(%sIEs2 != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
|
||||
|
||||
f.write(" for (i = 0; i < %sIEs1->%s.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
|
||||
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, %sIEs1->%s.array[i], &asn_DEF_%s, %sIEs2->%s.array[i]);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
|
||||
f.write(" if(rv2) {")
|
||||
f.write(" if (NULL == rv) {")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" } else {")
|
||||
f.write(" rv2->next = rv;")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" }")
|
||||
f.write(" rv2 = NULL;")
|
||||
f.write(" }")
|
||||
f.write(" }\n")
|
||||
f.write(" return rv;\n")
|
||||
f.write("}\n\n")
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ s1ap_eNB_config_t s1ap_config;
|
||||
static int s1ap_eNB_generate_s1_setup_request(
|
||||
s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p);
|
||||
|
||||
static
|
||||
|
||||
void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB);
|
||||
static
|
||||
|
||||
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
||||
|
||||
uint32_t s1ap_generate_eNB_id(void)
|
||||
@@ -150,7 +150,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB)
|
||||
{
|
||||
s1ap_eNB_instance_t *new_instance;
|
||||
@@ -210,7 +210,6 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
|
||||
{
|
||||
s1ap_eNB_instance_t *instance_p;
|
||||
|
||||
@@ -100,6 +100,7 @@ static STAILQ_HEAD(sctp_cnx_list_head, sctp_cnx_list_elm_s) sctp_cnx_list;
|
||||
static uint16_t sctp_nb_cnx = 0;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
struct sctp_cnx_list_elm_s *sctp_get_cnx(int32_t assoc_id, int sd)
|
||||
{
|
||||
struct sctp_cnx_list_elm_s *elm;
|
||||
@@ -119,6 +120,7 @@ struct sctp_cnx_list_elm_s *sctp_get_cnx(int32_t assoc_id, int sd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
sctp_handle_new_association_req(
|
||||
const instance_t instance,
|
||||
@@ -388,6 +390,7 @@ sctp_handle_new_association_req(
|
||||
sd, sctp_nb_cnx, assoc_id);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void sctp_send_data(
|
||||
instance_t instance,
|
||||
task_id_t task_id,
|
||||
@@ -430,6 +433,7 @@ void sctp_send_data(
|
||||
sctp_cnx->assoc_id);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static int sctp_close_association(
|
||||
const instance_t instance,
|
||||
const task_id_t requestor,
|
||||
@@ -456,6 +460,7 @@ static int sctp_close_association(
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static int sctp_create_new_listener(
|
||||
const instance_t instance,
|
||||
const task_id_t requestor,
|
||||
@@ -580,6 +585,7 @@ err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static inline
|
||||
void
|
||||
sctp_eNB_accept_associations(
|
||||
@@ -646,6 +652,7 @@ sctp_eNB_accept_associations(
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static inline
|
||||
void
|
||||
sctp_eNB_read_from_socket(
|
||||
@@ -770,6 +777,7 @@ sctp_eNB_read_from_socket(
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
sctp_eNB_flush_sockets(
|
||||
struct epoll_event *events, int nb_events)
|
||||
@@ -799,6 +807,7 @@ sctp_eNB_flush_sockets(
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void *sctp_eNB_task(void *arg)
|
||||
{
|
||||
int nb_events;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+174
@@ -0,0 +1,174 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "95";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
frame_type = "FDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 7;
|
||||
downlink_frequency = 2660000000L;
|
||||
uplink_frequency_offset = -120000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 120;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -26;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -90;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -108;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -108;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
}
|
||||
);
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.188.2.2";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "tun2";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.188.2.2/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.1/24";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
gtpu_log_level ="info";
|
||||
gtpu_log_verbosity ="medium";
|
||||
udp_log_level ="info";
|
||||
udp_log_verbosity ="medium";
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
@@ -36,18 +36,33 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <libconfig.h>
|
||||
#include <inttypes.h>
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/DOCBparser.h>
|
||||
#include <libxml/xinclude.h>
|
||||
#include <libxml/catalog.h>
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/xsltInternals.h>
|
||||
#include <libxslt/transform.h>
|
||||
#include <libxslt/xsltutils.h>
|
||||
|
||||
#include "assertions.h"
|
||||
#include "enb_config.h"
|
||||
#include "generate_scenario.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
#define EPC_TEST_SCENARIO_MAX_ENB 2
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#define ENB_CONFIG_STRING_ACTIVE_ENBS "Active_eNBs"
|
||||
|
||||
@@ -79,29 +94,201 @@
|
||||
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
|
||||
|
||||
|
||||
#define ENB_CONFIG_MAX_XSLT_PARAMS 32
|
||||
|
||||
Enb_properties_array_t g_enb_properties;
|
||||
char *g_test_dir = NULL;
|
||||
char *g_pdml_in_origin = NULL;
|
||||
extern int xmlLoadExtDtdDefaultValue;
|
||||
|
||||
#define GENERATE_PDML_FILE 1
|
||||
#define GENERATE_SCENARIO 2
|
||||
|
||||
#define GS_IS_FILE 1
|
||||
#define GS_IS_DIR 2
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// test if file exist in current directory
|
||||
int is_file_exists( const char const * file_nameP, const char const *file_roleP)
|
||||
{
|
||||
struct stat s;
|
||||
int err = stat(file_nameP, &s);
|
||||
if(-1 == err) {
|
||||
if(ENOENT == errno) {
|
||||
fprintf(stderr, "Please provide a valid %s, %s does not exist\n", file_roleP, file_nameP);
|
||||
} else {
|
||||
perror("stat");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
if(S_ISREG(s.st_mode)) {
|
||||
return GS_IS_FILE;
|
||||
} else if(S_ISDIR(s.st_mode)) {
|
||||
return GS_IS_DIR;
|
||||
} else {
|
||||
fprintf(stderr, "Please provide a valid test %s, %s exists but is not found valid\n", file_roleP, file_nameP);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int strip_extension(char *in_filename)
|
||||
{
|
||||
static const uint8_t name_min_len = 1;
|
||||
static const uint8_t max_ext_len = 5; // .pdml !
|
||||
fprintf(stdout, "strip_extension %s\n", in_filename);
|
||||
|
||||
if (NULL != in_filename) {
|
||||
/* Check chars starting at end of string to find last '.' */
|
||||
for (ssize_t i = strlen(in_filename); i >= name_min_len; i--) {
|
||||
if (in_filename[i] == '.') {
|
||||
in_filename[i] = '\0';
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// return number of splitted items
|
||||
int split_path( char * pathP, char *** resP)
|
||||
{
|
||||
char * saveptr1;
|
||||
char * p = strtok_r (pathP, "/", &saveptr1);
|
||||
int n_spaces = 0;
|
||||
|
||||
/// split string and append tokens to 'res'
|
||||
while (p) {
|
||||
*resP = realloc (*resP, sizeof (char*) * ++n_spaces);
|
||||
AssertFatal (*resP, "realloc failed");
|
||||
(*resP)[n_spaces-1] = p;
|
||||
p = strtok_r (NULL, "/", &saveptr1);
|
||||
}
|
||||
return n_spaces;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int generate_test_scenario(const char const * test_nameP, const char const * pdml_in_basenameP)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
//int fd_pdml_in;
|
||||
xsltStylesheetPtr cur = NULL;
|
||||
xmlDocPtr doc, res;
|
||||
FILE *test_scenario_file = NULL;
|
||||
const char test_scenario_filename[NAME_MAX];
|
||||
const char *params[2*ENB_CONFIG_MAX_XSLT_PARAMS];
|
||||
int nb_params = 0;
|
||||
int i,j;
|
||||
char astring[1024];
|
||||
char *astring2 = NULL;
|
||||
struct in_addr addr;
|
||||
|
||||
memset(test_scenario_filename, 0, sizeof(test_scenario_filename));
|
||||
memset(astring, 0, sizeof(astring));
|
||||
if (getcwd(astring, sizeof(astring)) != NULL) {
|
||||
fprintf(stdout, "working in %s directory\n", astring);
|
||||
} else {
|
||||
perror("getcwd() error");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
xmlLoadExtDtdDefaultValue = 1;
|
||||
cur = xsltParseStylesheetFile("/usr/share/oai/xsl/generic_scenario.xsl");
|
||||
if (NULL == cur) {
|
||||
AssertFatal (0, "Could not parse stylesheet file /usr/share/oai/xsl/generic_scenario.xsl!\n");
|
||||
} else {
|
||||
fprintf(stdout, "XSLT style sheet: /usr/share/oai/xsl/generic_scenario.xsl\n");
|
||||
}
|
||||
|
||||
doc = xmlParseFile(pdml_in_basenameP);
|
||||
if (NULL == doc) {
|
||||
AssertFatal (0, "Could not parse pdml file %s!\n", pdml_in_basenameP);
|
||||
} else {
|
||||
fprintf(stdout, "pdml file: %s\n", pdml_in_basenameP);
|
||||
}
|
||||
params[nb_params++] = "test_name";
|
||||
sprintf(astring, "%s", pdml_in_basenameP);
|
||||
if (strip_extension(astring) > 0) {
|
||||
astring2 = strdup(astring);
|
||||
sprintf(astring, "\"%s\"", astring2);
|
||||
free(astring2);
|
||||
astring2 = NULL;
|
||||
} else {
|
||||
fprintf(stderr, "Assigning test name failed: %s\n", astring);
|
||||
}
|
||||
params[nb_params++] = strdup(astring);
|
||||
|
||||
for (i = 0; i < g_enb_properties.number; i++) {
|
||||
// eNB S1-C IPv4 address
|
||||
sprintf(astring, "enb%d_s1c", i);
|
||||
params[nb_params++] = strdup(astring);
|
||||
addr.s_addr = g_enb_properties.properties[i]->enb_ipv4_address_for_S1_MME;
|
||||
sprintf(astring, "\"%s\"", inet_ntoa(addr));
|
||||
params[nb_params++] = strdup(astring);
|
||||
|
||||
// MME S1-C IPv4 address
|
||||
for (j = 0; j < g_enb_properties.properties[i]->nb_mme; j++) {
|
||||
sprintf(astring, "mme%d_s1c_%d", i, j);
|
||||
params[nb_params++] = strdup(astring);
|
||||
AssertFatal (g_enb_properties.properties[i]->mme_ip_address[j].ipv4_address,
|
||||
"Only support MME IPv4 address\n");
|
||||
sprintf(astring, "\"%s\"", g_enb_properties.properties[i]->mme_ip_address[j].ipv4_address);
|
||||
params[nb_params++] = strdup(astring);
|
||||
}
|
||||
}
|
||||
params[nb_params] = NULL;
|
||||
res = xsltApplyStylesheet(cur, doc, params);
|
||||
if (NULL != res) {
|
||||
// since pdml filename is not relative (no path), just filename in current directory we can safely remove
|
||||
sprintf(test_scenario_filename,"%s",pdml_in_basenameP);
|
||||
if (strip_extension(test_scenario_filename) > 0) {
|
||||
strcat(test_scenario_filename, ".xml");
|
||||
test_scenario_file = fopen( test_scenario_filename, "w+");
|
||||
if (NULL != test_scenario_file) {
|
||||
xsltSaveResultToFile(test_scenario_file, res, cur);
|
||||
fclose(test_scenario_file);
|
||||
fprintf(stdout, "Wrote test scenario to %s\n", test_scenario_filename);
|
||||
} else {
|
||||
fprintf(stderr, "Error in fopen(%s)\n", test_scenario_filename);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Error in strip_extension()\n");
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Error in xsltApplyStylesheet()\n");
|
||||
}
|
||||
xsltFreeStylesheet(cur);
|
||||
xmlFreeDoc(res);
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
xsltCleanupGlobals();
|
||||
xmlCleanupParser();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void enb_config_display(void)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
int i,j;
|
||||
int i;
|
||||
|
||||
printf( "\n----------------------------------------------------------------------\n");
|
||||
printf( " ENB CONFIG FILE CONTENT LOADED (TBC):\n");
|
||||
printf( " ENB CONFIG FILE CONTENT LOADED:\n");
|
||||
printf( "----------------------------------------------------------------------\n");
|
||||
for (i = 0; i < g_enb_properties.number; i++) {
|
||||
printf( "ENB CONFIG for instance %u:\n\n", i);
|
||||
printf( "\teNB name: \t%s:\n",g_enb_properties.properties[i]->eNB_name);
|
||||
printf( "\teNB ID: \t%"PRIu32":\n",g_enb_properties.properties[i]->eNB_id);
|
||||
printf( "\tCell type: \t%s:\n",g_enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
|
||||
printf( "\tTAC: \t%"PRIu16":\n",g_enb_properties.properties[i]->tac);
|
||||
printf( "\tMCC: \t%"PRIu16":\n",g_enb_properties.properties[i]->mcc);
|
||||
printf( "\teNB name: \t%s\n",g_enb_properties.properties[i]->eNB_name);
|
||||
printf( "\teNB ID: \t%"PRIu32"\n",g_enb_properties.properties[i]->eNB_id);
|
||||
printf( "\tCell type: \t%s\n",g_enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
|
||||
printf( "\tTAC: \t%"PRIu16"\n",g_enb_properties.properties[i]->tac);
|
||||
printf( "\tMCC: \t%"PRIu16"\n",g_enb_properties.properties[i]->mcc);
|
||||
|
||||
if (g_enb_properties.properties[i]->mnc_digit_length == 3) {
|
||||
printf( "\tMNC: \t%03"PRIu16":\n",g_enb_properties.properties[i]->mnc);
|
||||
printf( "\tMNC: \t%03"PRIu16"\n",g_enb_properties.properties[i]->mnc);
|
||||
} else {
|
||||
printf( "\tMNC: \t%02"PRIu16":\n",g_enb_properties.properties[i]->mnc);
|
||||
printf( "\tMNC: \t%02"PRIu16"\n",g_enb_properties.properties[i]->mnc);
|
||||
}
|
||||
printf( "\n--------------------------------------------------------\n");
|
||||
}
|
||||
@@ -114,13 +301,12 @@ static void enb_config_display(void)
|
||||
#define libconfig_int int
|
||||
#endif
|
||||
//------------------------------------------------------------------------------
|
||||
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||
void enb_config_init(const char const * lib_config_file_name_pP)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
config_t cfg;
|
||||
config_setting_t *setting = NULL;
|
||||
config_setting_t *subsetting = NULL;
|
||||
config_setting_t *setting_srb1 = NULL;
|
||||
config_setting_t *setting_mme_addresses = NULL;
|
||||
config_setting_t *setting_mme_address = NULL;
|
||||
config_setting_t *setting_enb = NULL;
|
||||
@@ -128,8 +314,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||
int enb_properties_index = 0;
|
||||
int num_enbs = 0;
|
||||
int num_mme_address = 0;
|
||||
int num_otg_elements =0;
|
||||
int num_component_carriers =0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int parse_errors = 0;
|
||||
@@ -139,12 +323,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||
const char* enb_name = NULL;
|
||||
const char* mcc = 0;
|
||||
const char* mnc = 0;
|
||||
const char* frame_type = NULL;
|
||||
const char* prefix_type = NULL;
|
||||
libconfig_int Nid_cell = 0;
|
||||
|
||||
libconfig_int my_int;
|
||||
|
||||
char* ipv4 = NULL;
|
||||
char* ipv6 = NULL;
|
||||
char* active = NULL;
|
||||
@@ -157,21 +335,20 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||
char* enb_ipv4_address_for_S1_MME = NULL;
|
||||
char *address = NULL;
|
||||
char *cidr = NULL;
|
||||
char *astring = NULL;
|
||||
|
||||
|
||||
AssertFatal (lib_config_file_name_pP != NULL,
|
||||
"Bad parameter lib_config_file_name_pP %s , must reference a valid eNB config file\n",
|
||||
lib_config_file_name_pP);
|
||||
|
||||
memset((char*)active_enb, 0 , EPC_TEST_SCENARIO_MAX_ENB * sizeof(char*));
|
||||
|
||||
config_init(&cfg);
|
||||
|
||||
if (lib_config_file_name_pP != NULL) {
|
||||
/* Read the file. If there is an error, report it and exit. */
|
||||
if (! config_read_file(&cfg, lib_config_file_name_pP)) {
|
||||
config_destroy(&cfg);
|
||||
AssertFatal (0, "Failed to parse eNB configuration file %s!\n", lib_config_file_name_pP);
|
||||
}
|
||||
} else {
|
||||
/* Read the file. If there is an error, report it and exit. */
|
||||
if (! config_read_file(&cfg, lib_config_file_name_pP)) {
|
||||
config_destroy(&cfg);
|
||||
AssertFatal (0, "No eNB configuration file provided!\n");
|
||||
AssertFatal (0, "Failed to parse eNB configuration file %s!\n", lib_config_file_name_pP);
|
||||
}
|
||||
|
||||
// Get list of active eNBs, (only these will be configured)
|
||||
@@ -195,7 +372,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||
setting = config_lookup(&cfg, ENB_CONFIG_STRING_ENB_LIST);
|
||||
|
||||
if (setting != NULL) {
|
||||
enb_properties_index = 0;
|
||||
enb_properties_index = g_enb_properties.number;
|
||||
parse_errors = 0;
|
||||
num_enbs = config_setting_length(setting);
|
||||
|
||||
@@ -332,31 +509,19 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||
IPV4_STR_ADDR_TO_INT_NWBO ( address, g_enb_properties.properties[enb_properties_index]->enb_ipv4_address_for_S1_MME, "BAD IP ADDRESS FORMAT FOR eNB S1_MME !\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // if (subsetting != NULL) {
|
||||
enb_properties_index += 1;
|
||||
} // if (strcmp(active_enb[j], enb_name) == 0)
|
||||
} // for (j=0; j < num_enb_properties; j++)
|
||||
} // for (i = 0; i < num_enbs; i++)
|
||||
} // if (setting != NULL) {
|
||||
|
||||
g_enb_properties.number = num_enb_properties;
|
||||
g_enb_properties.number += num_enb_properties;
|
||||
|
||||
AssertError (enb_properties_index == num_enb_properties, parse_errors ++,
|
||||
"Failed to parse eNB configuration file %s, mismatch between %u active eNBs and %u corresponding defined eNBs !\n",
|
||||
lib_config_file_name_pP, num_enb_properties, enb_properties_index);
|
||||
|
||||
AssertFatal (parse_errors == 0,
|
||||
"Failed to parse eNB configuration file %s, found %d error%s !\n",
|
||||
lib_config_file_name_pP, parse_errors, parse_errors > 1 ? "s" : "");
|
||||
enb_config_display();
|
||||
return &g_enb_properties;
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const Enb_properties_array_t *enb_config_get(void)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
return &g_enb_properties;
|
||||
}
|
||||
|
||||
|
||||
@@ -366,19 +531,41 @@ static void usage (
|
||||
char *argv[])
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
fprintf (stdout, "Please report any bug to: openair4g-devel@lists.eurecom.fr\n\n");
|
||||
fprintf (stdout, "Please report any bug to: %s\n",PACKAGE_BUGREPORT);
|
||||
fprintf (stdout, "Usage: %s [options]\n\n", argv[0]);
|
||||
fprintf (stdout, "Available options:\n");
|
||||
fprintf (stdout, "\t--help, -h Print this help and return\n");
|
||||
fprintf (stdout, "\t--test-dir <path>\n");
|
||||
fprintf (stdout, " Set the test directory where pdml and original enb(s) config files are located\n");
|
||||
fprintf (stdout, " See README in openair3/TEST/EPC_TEST\n");
|
||||
fprintf (stdout, "\t--new-enb-conf-file <file>\n");
|
||||
fprintf (stdout, " Provide an updated eNB config file for generating a copy of the original test\n");
|
||||
fprintf (stdout, " This option is set as many times as there are some eNB in the original test\n");
|
||||
fprintf (stdout, "\n");
|
||||
fprintf (stdout, "Mandatory options:\n");
|
||||
fprintf (stdout, "\t-c | --enb-conf-file <file> Provide the old eNB config file for generating a copy of the original test\n");
|
||||
fprintf (stdout, "\t-d | --test-dir <dir> Directory where a set of files related to a particular test are located\n");
|
||||
fprintf (stdout, "\t-p | --pdml <file> File name (with no path) in 'test-dir' directory of an original scenario that has to be reworked (IP addresses) with new testbed\n");
|
||||
fprintf (stdout, "\n");
|
||||
fprintf (stdout, "Other options:\n");
|
||||
fprintf (stdout, "\t-h | --help Print this help and return\n");
|
||||
fprintf (stdout, "\t-v | --version Print informations about the version of this executable\n");
|
||||
fprintf (stdout, "\n");
|
||||
fprintf (stdout, "Example of generate_scenario use case: \n");
|
||||
fprintf (stdout, "\n");
|
||||
fprintf (stdout, " Generate a generix xml scenario from a captured pcap file: \n");
|
||||
fprintf (stdout, " +---------------------+ \n");
|
||||
fprintf (stdout, " |captured pcap-ng file| \n");
|
||||
fprintf (stdout, " +----------+----------+ \n");
|
||||
fprintf (stdout, " |\n");
|
||||
fprintf (stdout, " mme_test_s1_pcap2pdml --pcap_file <`captured pcap-ng file`>\n");
|
||||
fprintf (stdout, " |\n");
|
||||
fprintf (stdout, " +--------V----------+ +--------------------+\n");
|
||||
fprintf (stdout, " |'pdml-in-orig' file| |'enb-conf-file' file|\n");
|
||||
fprintf (stdout, " +--------+----------+ +--------------------+\n");
|
||||
fprintf (stdout, " | |\n");
|
||||
fprintf (stdout, " +----------------------------+\n");
|
||||
fprintf (stdout, " |\n");
|
||||
fprintf (stdout, " generate_scenario -d <dir> -p <'pdml-in-orig' file> -c <'enb-conf-file' file> \n");
|
||||
fprintf (stdout, " |\n");
|
||||
fprintf (stdout, " +------------V--------------+\n");
|
||||
fprintf (stdout, " +'xml-test-scenario' file |\n");
|
||||
fprintf (stdout, " +---------------------------+\n");
|
||||
fprintf (stdout, "\n");
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
config_parse_opt_line (
|
||||
@@ -387,65 +574,119 @@ config_parse_opt_line (
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
int option;
|
||||
char *enb_config_file_name = NULL;
|
||||
char *test_dir = NULL;
|
||||
int rv = 0;
|
||||
char *enb_config_file_name = NULL;
|
||||
char *pdml_in_file_name = NULL;
|
||||
char *test_dir_name = NULL;
|
||||
|
||||
enum long_option_e {
|
||||
LONG_OPTION_START = 0x100, /* Start after regular single char options */
|
||||
LONG_OPTION_ENB_CONF_FILE,
|
||||
LONG_OPTION_PDML,
|
||||
LONG_OPTION_TEST_DIR,
|
||||
LONG_OPTION_NEW_ENB_CONF_FILE,
|
||||
LONG_OPTION_HELP,
|
||||
LONG_OPTION_VERSION,
|
||||
};
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"test-dir", required_argument, 0, LONG_OPTION_TEST_DIR},
|
||||
{"new-enb-conf-file", required_argument, 0, LONG_OPTION_NEW_ENB_CONF_FILE},
|
||||
{"help", required_argument, 0, LONG_OPTION_HELP},
|
||||
{"enb-conf-file", required_argument, 0, LONG_OPTION_ENB_CONF_FILE},
|
||||
{"pdml ", required_argument, 0, LONG_OPTION_PDML},
|
||||
{"test-dir", required_argument, 0, LONG_OPTION_TEST_DIR},
|
||||
{"help", no_argument, 0, LONG_OPTION_HELP},
|
||||
{"version", no_argument, 0, LONG_OPTION_VERSION},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Parsing command line
|
||||
*/
|
||||
while ((option = getopt_long (argc, argv, "h", long_options, NULL)) != -1) {
|
||||
while ((option = getopt_long (argc, argv, "vhp:n:c:s:d:", long_options, NULL)) != -1) {
|
||||
switch (option) {
|
||||
case LONG_OPTION_TEST_DIR:
|
||||
case LONG_OPTION_ENB_CONF_FILE:
|
||||
case 'c':
|
||||
if (optarg) {
|
||||
test_dir = strdup(optarg);
|
||||
printf("TEST DIRECTORY IS %s\n", test_dir);
|
||||
}
|
||||
break;
|
||||
|
||||
case LONG_OPTION_NEW_ENB_CONF_FILE:
|
||||
if (optarg) {
|
||||
enb_config_file_name = strdup(optarg);
|
||||
enb_config_file_name = optarg;
|
||||
printf("eNB config file name is %s\n", enb_config_file_name);
|
||||
enb_config_init(enb_config_file_name);
|
||||
rv |= GENERATE_SCENARIO;
|
||||
}
|
||||
break;
|
||||
|
||||
case LONG_OPTION_PDML:
|
||||
case 'p':
|
||||
if (optarg) {
|
||||
test_dir = strdup(optarg);
|
||||
printf("TEST DIRECTORY IS %s\n", test_dir);
|
||||
pdml_in_file_name = strdup(optarg);
|
||||
printf("PDML input file name is %s\n", pdml_in_file_name);
|
||||
rv |= GENERATE_SCENARIO;
|
||||
}
|
||||
break;
|
||||
|
||||
case LONG_OPTION_TEST_DIR:
|
||||
case 'd':
|
||||
if (optarg) {
|
||||
test_dir_name = strdup(optarg);
|
||||
if (is_file_exists(test_dir_name, "test dirname") != GS_IS_DIR) {
|
||||
fprintf(stderr, "Please provide a valid test dirname, %s is not a valid directory name\n", test_dir_name);
|
||||
exit(1);
|
||||
}
|
||||
printf("Test dir name is %s\n", test_dir_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case LONG_OPTION_VERSION:
|
||||
case 'v':
|
||||
printf("Version %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
break;
|
||||
|
||||
case LONG_OPTION_HELP:
|
||||
case 'h': /* Fall through */
|
||||
case 'h':
|
||||
default:
|
||||
usage (argc, argv);
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if (NULL == test_dir_name) {
|
||||
fprintf(stderr, "Please provide a valid test dirname\n");
|
||||
exit(1);
|
||||
}
|
||||
g_test_dir = test_dir_name; test_dir_name = NULL;
|
||||
if (chdir(g_test_dir) != 0) {
|
||||
fprintf(stderr, "Error: chdir %s returned %s\n", g_test_dir, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (rv & GENERATE_SCENARIO) {
|
||||
if (NULL == enb_config_file_name) {
|
||||
fprintf(stderr, "Error: please provide the original eNB config file name that should be in %s\n", g_test_dir);
|
||||
}
|
||||
if (is_file_exists(enb_config_file_name, "ENB config file") != GS_IS_FILE) {
|
||||
fprintf(stderr, "Error: eNB config file name %s is not found in dir %s\n", enb_config_file_name, g_test_dir);
|
||||
}
|
||||
enb_config_init(enb_config_file_name);
|
||||
//enb_config_display();
|
||||
|
||||
if (NULL == pdml_in_file_name) {
|
||||
fprintf(stderr, "Error: please provide the PDML file name that should be in %s\n", g_test_dir);
|
||||
}
|
||||
if (is_file_exists(pdml_in_file_name, "PDML file") != GS_IS_FILE) {
|
||||
fprintf(stderr, "Error: PDML file name %s is not found in dir %s\n", pdml_in_file_name, g_test_dir);
|
||||
}
|
||||
g_pdml_in_origin = pdml_in_file_name; pdml_in_file_name = NULL;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int main( int argc, char **argv )
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
int actions = 0;
|
||||
|
||||
memset((char*) &g_enb_properties, 0 , sizeof(g_enb_properties));
|
||||
config_parse_opt_line (argc, argv); //Command-line options
|
||||
|
||||
actions = config_parse_opt_line (argc, argv); //Command-line options
|
||||
if (actions & GENERATE_SCENARIO) {
|
||||
generate_test_scenario(g_test_dir, g_pdml_in_origin);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
generate_scenario.h
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
|
||||
#ifndef GENERATE_SCENARIO_H_
|
||||
#define GENERATE_SCENARIO_H_
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "commonDef.h"
|
||||
#include "platform_types.h"
|
||||
#include "platform_constants.h"
|
||||
#include "PHY/impl_defs_lte.h"
|
||||
#include "s1ap_messages_types.h"
|
||||
#ifdef CMAKER
|
||||
#include "SystemInformationBlockType2.h"
|
||||
#else
|
||||
#include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h"
|
||||
#endif
|
||||
|
||||
#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
|
||||
struct in_addr inp;\
|
||||
if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\
|
||||
AssertFatal (0, MeSsAgE);\
|
||||
} else {\
|
||||
NwBo = inp.s_addr;\
|
||||
}\
|
||||
} while (0);
|
||||
|
||||
/** @defgroup _enb_app ENB APP
|
||||
* @ingroup _oai2
|
||||
* @{
|
||||
*/
|
||||
|
||||
// Hard to find a defined value for max enb...
|
||||
#define EPC_TEST_SCENARIO_MAX_ENB 4
|
||||
|
||||
|
||||
typedef struct mme_ip_address_s {
|
||||
unsigned ipv4:1;
|
||||
unsigned ipv6:1;
|
||||
unsigned active:1;
|
||||
char *ipv4_address;
|
||||
char *ipv6_address;
|
||||
} mme_ip_address_t;
|
||||
|
||||
typedef struct Enb_properties_s {
|
||||
/* Unique eNB_id to identify the eNB within EPC.
|
||||
* For macro eNB ids this field should be 20 bits long.
|
||||
* For home eNB ids this field should be 28 bits long.
|
||||
*/
|
||||
uint32_t eNB_id;
|
||||
|
||||
/* The type of the cell */
|
||||
enum cell_type_e cell_type;
|
||||
|
||||
/* Optional name for the cell
|
||||
* NOTE: the name can be NULL (i.e no name) and will be cropped to 150
|
||||
* characters.
|
||||
*/
|
||||
char *eNB_name;
|
||||
|
||||
/* Tracking area code */
|
||||
uint16_t tac;
|
||||
|
||||
/* Mobile Country Code
|
||||
* Mobile Network Code
|
||||
*/
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_digit_length;
|
||||
|
||||
/* Nb of MME to connect to */
|
||||
uint8_t nb_mme;
|
||||
/* List of MME to connect to */
|
||||
mme_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS];
|
||||
|
||||
int sctp_in_streams;
|
||||
int sctp_out_streams;
|
||||
|
||||
char *enb_interface_name_for_S1U;
|
||||
in_addr_t enb_ipv4_address_for_S1U;
|
||||
tcp_udp_port_t enb_port_for_S1U;
|
||||
|
||||
char *enb_interface_name_for_S1_MME;
|
||||
in_addr_t enb_ipv4_address_for_S1_MME;
|
||||
|
||||
} Enb_properties_t;
|
||||
|
||||
typedef struct Enb_properties_array_s {
|
||||
int number;
|
||||
Enb_properties_t *properties[EPC_TEST_SCENARIO_MAX_ENB];
|
||||
} Enb_properties_array_t;
|
||||
|
||||
void enb_config_init(const char const * lib_config_file_name_pP);
|
||||
|
||||
#endif /* ENB_CONFIG_H_ */
|
||||
/** @} */
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import subprocess
|
||||
import re
|
||||
import socket
|
||||
import datetime
|
||||
from datetime import date
|
||||
import os, errno
|
||||
import argparse
|
||||
import tempfile
|
||||
from lxml import etree
|
||||
from xml.dom.minidom import parse, parseString
|
||||
|
||||
#####################
|
||||
# program arguments
|
||||
#####################
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--pcap_file", "-p", type=str,help="input pcap file to be translated")
|
||||
args = parser.parse_args()
|
||||
|
||||
#####################
|
||||
# get xml document from pcap
|
||||
#####################
|
||||
orig_pcap_file_name = args.pcap_file.strip()
|
||||
orig_pdml_string = subprocess.check_output(["tshark", '-T', 'pdml', '-r', orig_pcap_file_name])
|
||||
|
||||
orig_dom = parseString(orig_pdml_string)
|
||||
|
||||
#####################
|
||||
# filtering unwanted packets
|
||||
#####################
|
||||
#cases = orig_etree.findall(".//proto[@name='sctp']")
|
||||
packets = orig_dom.getElementsByTagName("packet")
|
||||
for packet in packets:
|
||||
found_sctp = False
|
||||
found_s1ap = False
|
||||
protos = packet.getElementsByTagName("proto")
|
||||
for proto in protos:
|
||||
attrs = proto.attributes
|
||||
urlnode = attrs['name']
|
||||
if urlnode.nodeValue == 'sctp':
|
||||
found_sctp = True
|
||||
elif urlnode.nodeValue == 's1ap':
|
||||
found_s1ap = True
|
||||
elif urlnode.nodeValue == 'geninfo':
|
||||
packet.removeChild(proto)
|
||||
elif urlnode.nodeValue == 'eth':
|
||||
packet.removeChild(proto)
|
||||
if found_sctp == False:
|
||||
# hopefully it seems to work (remove iterated packet)
|
||||
packet.parentNode.removeChild(packet)
|
||||
|
||||
#####################
|
||||
# dom to xml string
|
||||
#####################
|
||||
filtered_pdml_string = orig_dom.toxml()
|
||||
cleaned_pdml_string = ""
|
||||
#####################
|
||||
# remove blank lines in xml string
|
||||
#####################
|
||||
lines = filtered_pdml_string.splitlines()
|
||||
for line in lines:
|
||||
if line[:-1]:
|
||||
cleaned_pdml_string += line + '\r\n'
|
||||
#print "'%s'" % cleaned_pdml_string
|
||||
#####################
|
||||
# write pdml string to pdml file
|
||||
#####################
|
||||
out_pdml_file_name = os.path.dirname(orig_pcap_file_name) + os.path.splitext(os.path.basename(orig_pcap_file_name))[0] + '.pdml'
|
||||
out_file = open(out_pdml_file_name, "w")
|
||||
out_file.write(cleaned_pdml_string)
|
||||
out_file.close()
|
||||
|
||||
############################################################
|
||||
# DECEIVING HTML BONUS: DO NOT SEEM TO WORK CORRECTLY IN FIREFOX
|
||||
# DID NOT INVESTIGATE
|
||||
#####################
|
||||
# write xml string to html file
|
||||
#####################
|
||||
xsl_root = etree.fromstring(open('/usr/share/wireshark/pdml2html.xsl').read())
|
||||
transform = etree.XSLT(xsl_root)
|
||||
xml_root = etree.fromstring(cleaned_pdml_string)
|
||||
trans_root = transform(xml_root)
|
||||
filtered_html_string = etree.tostring(trans_root)
|
||||
#####################
|
||||
# write html string to html file
|
||||
#####################
|
||||
out_html_file_name = os.path.dirname(orig_pcap_file_name) + os.path.splitext(os.path.basename(orig_pcap_file_name))[0] + '.html'
|
||||
out_file = open(out_html_file_name, "w")
|
||||
out_file.write(filtered_html_string)
|
||||
out_file.close()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,508 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
play_scenario.h
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
|
||||
#ifndef PLAY_SCENARIO_H_
|
||||
#define PLAY_SCENARIO_H_
|
||||
# include <time.h>
|
||||
# include <stdint.h>
|
||||
# include <libxml/tree.h>
|
||||
# include <libxml/xpath.h>
|
||||
# include <netinet/in.h>
|
||||
|
||||
#include "S1AP-PDU.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "play_scenario_s1ap_eNB_defs.h"
|
||||
#include "hashtable.h"
|
||||
#include "asn_compare.h"
|
||||
|
||||
#define ET_XPATH_EXPRESSION_MAX_LENGTH 400
|
||||
|
||||
|
||||
// powers of 2
|
||||
#define ET_BIT_MASK_MATCH_SCTP_STREAM 1
|
||||
#define ET_BIT_MASK_MATCH_SCTP_SSN 2
|
||||
//#define ET_BIT_MASK_MATCH_S1AP_ 2
|
||||
|
||||
#define MAX_ENB 16
|
||||
|
||||
#define ENB_CONFIG_STRING_ACTIVE_ENBS "Active_eNBs"
|
||||
|
||||
#define ENB_CONFIG_STRING_ENB_LIST "eNBs"
|
||||
#define ENB_CONFIG_STRING_ENB_ID "eNB_ID"
|
||||
#define ENB_CONFIG_STRING_CELL_TYPE "cell_type"
|
||||
#define ENB_CONFIG_STRING_ENB_NAME "eNB_name"
|
||||
|
||||
#define ENB_CONFIG_STRING_TRACKING_AREA_CODE "tracking_area_code"
|
||||
#define ENB_CONFIG_STRING_MOBILE_COUNTRY_CODE "mobile_country_code"
|
||||
#define ENB_CONFIG_STRING_MOBILE_NETWORK_CODE "mobile_network_code"
|
||||
|
||||
|
||||
#define ENB_CONFIG_STRING_MME_IP_ADDRESS "mme_ip_address"
|
||||
#define ENB_CONFIG_STRING_MME_IPV4_ADDRESS "ipv4"
|
||||
#define ENB_CONFIG_STRING_MME_IPV6_ADDRESS "ipv6"
|
||||
#define ENB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE "active"
|
||||
#define ENB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE "preference"
|
||||
|
||||
#define ENB_CONFIG_STRING_SCTP_CONFIG "SCTP"
|
||||
#define ENB_CONFIG_STRING_SCTP_INSTREAMS "SCTP_INSTREAMS"
|
||||
#define ENB_CONFIG_STRING_SCTP_OUTSTREAMS "SCTP_OUTSTREAMS"
|
||||
|
||||
#define ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES"
|
||||
#define ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1_MME "ENB_INTERFACE_NAME_FOR_S1_MME"
|
||||
#define ENB_CONFIG_STRING_ENB_IPV4_ADDRESS_FOR_S1_MME "ENB_IPV4_ADDRESS_FOR_S1_MME"
|
||||
#define ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1U "ENB_INTERFACE_NAME_FOR_S1U"
|
||||
#define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U"
|
||||
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
|
||||
|
||||
|
||||
typedef struct shift_packet_s {
|
||||
unsigned int frame_number; // original frame number
|
||||
int shift_seconds;
|
||||
int shift_microseconds;
|
||||
int single; // shift timing only for this packet (not also following packets)
|
||||
struct shift_packet_s *next;
|
||||
} shift_packet_t;
|
||||
|
||||
|
||||
typedef struct mme_ip_address_s {
|
||||
unsigned ipv4:1;
|
||||
unsigned ipv6:1;
|
||||
unsigned active:1;
|
||||
char *ipv4_address;
|
||||
char *ipv6_address;
|
||||
} mme_ip_address_t;
|
||||
|
||||
#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
|
||||
struct in_addr inp;\
|
||||
if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\
|
||||
AssertFatal (0, MeSsAgE);\
|
||||
} else {\
|
||||
NwBo = inp.s_addr;\
|
||||
}\
|
||||
} while (0);
|
||||
|
||||
|
||||
typedef struct Enb_properties_s {
|
||||
/* Unique eNB_id to identify the eNB within EPC.
|
||||
* For macro eNB ids this field should be 20 bits long.
|
||||
* For home eNB ids this field should be 28 bits long.
|
||||
*/
|
||||
uint32_t eNB_id;
|
||||
|
||||
/* The type of the cell */
|
||||
enum cell_type_e cell_type;
|
||||
|
||||
/* Optional name for the cell
|
||||
* NOTE: the name can be NULL (i.e no name) and will be cropped to 150
|
||||
* characters.
|
||||
*/
|
||||
char *eNB_name;
|
||||
|
||||
/* Tracking area code */
|
||||
uint16_t tac;
|
||||
|
||||
/* Mobile Country Code
|
||||
* Mobile Network Code
|
||||
*/
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_digit_length;
|
||||
|
||||
|
||||
|
||||
/* Physical parameters */
|
||||
|
||||
int16_t Nid_cell[1+MAX_NUM_CCs];// for testing, change later
|
||||
/* Nb of MME to connect to */
|
||||
uint8_t nb_mme;
|
||||
/* List of MME to connect to */
|
||||
mme_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS];
|
||||
|
||||
int sctp_in_streams;
|
||||
int sctp_out_streams;
|
||||
|
||||
char *enb_interface_name_for_S1U;
|
||||
in_addr_t enb_ipv4_address_for_S1U;
|
||||
tcp_udp_port_t enb_port_for_S1U;
|
||||
|
||||
char *enb_interface_name_for_S1_MME;
|
||||
in_addr_t enb_ipv4_address_for_S1_MME;
|
||||
|
||||
} Enb_properties_t;
|
||||
|
||||
typedef struct Enb_properties_array_s {
|
||||
int number;
|
||||
Enb_properties_t *properties[MAX_ENB];
|
||||
} Enb_properties_array_t;
|
||||
|
||||
# define ET_ENB_REGISTER_RETRY_DELAY 3
|
||||
# define ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC 15
|
||||
|
||||
typedef enum {
|
||||
ET_PACKET_STATUS_START = 0,
|
||||
ET_PACKET_STATUS_NONE = ET_PACKET_STATUS_START,
|
||||
ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT,
|
||||
ET_PACKET_STATUS_SCHEDULED_FOR_SENDING,
|
||||
ET_PACKET_STATUS_SENT,
|
||||
ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING,
|
||||
ET_PACKET_STATUS_RECEIVED,
|
||||
ET_PACKET_STATUS_END
|
||||
} et_packet_status_t;
|
||||
|
||||
typedef enum {
|
||||
ET_FSM_STATE_START = 0,
|
||||
ET_FSM_STATE_NULL = ET_FSM_STATE_START,
|
||||
ET_FSM_STATE_CONNECTING_S1C,
|
||||
ET_FSM_STATE_WAITING_RX_EVENT,
|
||||
ET_FSM_STATE_WAITING_TX_EVENT,
|
||||
ET_FSM_STATE_RUNNING,
|
||||
ET_FSM_STATE_END
|
||||
} et_fsm_state_t;
|
||||
|
||||
enum COMPARE_ERR_CODE_e;
|
||||
|
||||
typedef enum {
|
||||
ET_ERROR_MATCH_START = COMPARE_ERR_CODE_END,
|
||||
ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE = ET_ERROR_MATCH_START,
|
||||
ET_ERROR_MATCH_PACKET_SCTP_PPID,
|
||||
ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID,
|
||||
ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID,
|
||||
ET_ERROR_MATCH_PACKET_SCTP_SSN,
|
||||
ET_ERROR_MATCH_PACKET_S1AP_PRESENT,
|
||||
ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE,
|
||||
ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY,
|
||||
ET_ERROR_MATCH_END
|
||||
} et_error_match_code_t;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
ET_PACKET_ACTION_S1C_START = 0,
|
||||
ET_PACKET_ACTION_S1C_NULL = ET_PACKET_ACTION_S1C_START,
|
||||
ET_PACKET_ACTION_S1C_SEND,
|
||||
ET_PACKET_ACTION_S1C_RECEIVE,
|
||||
ET_PACKET_ACTION_S1C_END
|
||||
} et_packet_action_t;
|
||||
|
||||
// from kernel source file 3.19/include/linux/sctp.h
|
||||
typedef enum {
|
||||
SCTP_CID_DATA = 0,
|
||||
SCTP_CID_INIT = 1,
|
||||
SCTP_CID_INIT_ACK = 2,
|
||||
SCTP_CID_SACK = 3,
|
||||
SCTP_CID_HEARTBEAT = 4,
|
||||
SCTP_CID_HEARTBEAT_ACK = 5,
|
||||
SCTP_CID_ABORT = 6,
|
||||
SCTP_CID_SHUTDOWN = 7,
|
||||
SCTP_CID_SHUTDOWN_ACK = 8,
|
||||
SCTP_CID_ERROR = 9,
|
||||
SCTP_CID_COOKIE_ECHO = 10,
|
||||
SCTP_CID_COOKIE_ACK = 11,
|
||||
SCTP_CID_ECN_ECNE = 12,
|
||||
SCTP_CID_ECN_CWR = 13,
|
||||
SCTP_CID_SHUTDOWN_COMPLETE = 14,
|
||||
|
||||
/* AUTH Extension Section 4.1 */
|
||||
SCTP_CID_AUTH = 0x0F,
|
||||
|
||||
/* PR-SCTP Sec 3.2 */
|
||||
SCTP_CID_FWD_TSN = 0xC0,
|
||||
|
||||
/* Use hex, as defined in ADDIP sec. 3.1 */
|
||||
SCTP_CID_ASCONF = 0xC1,
|
||||
SCTP_CID_ASCONF_ACK = 0x80,
|
||||
} sctp_cid_t; /* enum */
|
||||
|
||||
typedef enum {
|
||||
TEST_S1AP_PDU_TYPE_START = 0,
|
||||
TEST_S1AP_PDU_TYPE_UNKNOWN = TEST_S1AP_PDU_TYPE_START,
|
||||
TEST_S1AP_PDU_TYPE_INITIATING,
|
||||
TEST_S1AP_PDU_TYPE_SUCCESSFUL_OUTCOME,
|
||||
TEST_S1AP_PDU_TYPE_UNSUCCESSFUL_OUTCOME,
|
||||
TEST_S1AP_PDU_TYPE_END
|
||||
} et_s1ap_pdu_type_t;
|
||||
|
||||
|
||||
typedef struct et_s1ap_s {
|
||||
//et_s1ap_pdu_type_t pdu_type;
|
||||
S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
|
||||
uint16_t xml_stream_pos_offset;
|
||||
uint16_t binary_stream_pos;
|
||||
uint16_t binary_stream_allocated_size;
|
||||
uint8_t *binary_stream;
|
||||
s1ap_message message; // decoded message: information elements
|
||||
xmlDocPtr doc; // XML representation of the S1AP PDU
|
||||
} et_s1ap_t;
|
||||
|
||||
|
||||
// from kernel source file 3.19/include/linux/sctp.h, Big Endians
|
||||
typedef struct sctp_datahdr_s {
|
||||
uint32_t tsn;
|
||||
uint16_t stream;
|
||||
uint16_t ssn;
|
||||
uint32_t ppid;
|
||||
uint32_t assoc_id; // filled when running scenario
|
||||
et_s1ap_t payload;
|
||||
} sctp_datahdr_t;
|
||||
|
||||
// from kernel source file 3.19/include/linux/sctp.h, Big Endians
|
||||
typedef struct sctp_inithdr {
|
||||
uint32_t init_tag;
|
||||
uint32_t a_rwnd;
|
||||
uint16_t num_outbound_streams;
|
||||
uint16_t num_inbound_streams;
|
||||
uint32_t initial_tsn;
|
||||
uint8_t params[0];
|
||||
} sctp_inithdr_t;
|
||||
|
||||
typedef sctp_inithdr_t sctp_initackhdr_t;
|
||||
|
||||
typedef struct et_sctp_hdr_s {
|
||||
unsigned int src_port;
|
||||
unsigned int dst_port;
|
||||
sctp_cid_t chunk_type;
|
||||
union {
|
||||
sctp_datahdr_t data_hdr;
|
||||
sctp_inithdr_t init_hdr;
|
||||
sctp_initackhdr_t init_ack_hdr;
|
||||
} u;
|
||||
} et_sctp_hdr_t;
|
||||
|
||||
typedef struct et_ip_s {
|
||||
unsigned int address_family; // AF_INET, AF_INET6
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
in_addr_t ipv4;
|
||||
}address;
|
||||
char str[INET6_ADDRSTRLEN+1];
|
||||
}et_ip_t;
|
||||
|
||||
typedef struct et_ip_hdr_s {
|
||||
et_ip_t src;
|
||||
et_ip_t dst;
|
||||
} et_ip_hdr_t;
|
||||
|
||||
typedef struct et_packet_s {
|
||||
et_packet_action_t action;
|
||||
struct timeval time_relative_to_first_packet;
|
||||
struct timeval time_relative_to_last_sent_packet;
|
||||
struct timeval time_relative_to_last_received_packet;
|
||||
unsigned int original_frame_number;
|
||||
unsigned int packet_number;
|
||||
instance_t enb_instance;
|
||||
et_ip_hdr_t ip_hdr;
|
||||
et_sctp_hdr_t sctp_hdr;
|
||||
struct et_packet_s *next;
|
||||
|
||||
//scenario running vars
|
||||
et_packet_status_t status;
|
||||
long timer_id; // ITTI timer id for waiting rx packets
|
||||
struct timeval timestamp_packet; // timestamp when rx or tx packet
|
||||
}et_packet_t;
|
||||
|
||||
|
||||
typedef struct sctp_epoll_s {
|
||||
/* Array of events monitored by the task.
|
||||
* By default only one fd is monitored (the one used to received messages
|
||||
* from other tasks).
|
||||
* More events can be suscribed later by the task itself.
|
||||
*/
|
||||
struct epoll_event *events;
|
||||
|
||||
int epoll_nb_events;
|
||||
|
||||
} thread_desc_t;
|
||||
|
||||
typedef struct et_scenario_s {
|
||||
xmlChar *name;
|
||||
et_packet_t *list_packet;
|
||||
//--------------------------
|
||||
// playing scenario
|
||||
//--------------------------
|
||||
Enb_properties_array_t *enb_properties;
|
||||
uint32_t register_enb_pending;
|
||||
uint32_t registered_enb;
|
||||
long enb_register_retry_timer_id;
|
||||
|
||||
|
||||
hash_table_t *hash_mme2association_id;
|
||||
hash_table_t *hash_old_ue_mme_id2ue_mme_id;
|
||||
struct timeval time_last_tx_packet; // Time last sent packet
|
||||
struct timeval time_last_rx_packet; // Time last packet received with all previous scenario RX packet received.
|
||||
et_packet_t *last_rx_packet; // Last packet received with all previous scenario RX packet received.
|
||||
et_packet_t *last_tx_packet; // Last sent packet
|
||||
et_packet_t *next_packet; // Next packet to be handled in the scenario (RX or TX packet)
|
||||
|
||||
int timer_count;
|
||||
} et_scenario_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
ET_EVENT_START = 0,
|
||||
ET_EVENT_INIT = ET_EVENT_START,
|
||||
ET_EVENT_S1C_CONNECTED,
|
||||
ET_EVENT_RX_SCTP_EVENT,
|
||||
ET_EVENT_RX_S1AP,
|
||||
ET_EVENT_RX_PACKET_TIME_OUT,
|
||||
ET_EVENT_TX_TIMED_PACKET,
|
||||
ET_EVENT_TICK,
|
||||
ET_EVENT_END
|
||||
} et_event_code_t;
|
||||
|
||||
typedef struct et_event_init_s {
|
||||
et_scenario_t *scenario;
|
||||
} et_event_init_t;
|
||||
|
||||
typedef struct et_event_s1ap_data_ind_s {
|
||||
sctp_datahdr_t sctp_datahdr;
|
||||
} et_event_s1ap_data_ind_t;
|
||||
|
||||
typedef struct et_event_s1ap_data_req_s {
|
||||
|
||||
} et_event_s1ap_data_req_t;
|
||||
|
||||
typedef struct et_event_s {
|
||||
et_event_code_t code;
|
||||
union {
|
||||
et_event_init_t init;
|
||||
et_event_s1ap_data_ind_t s1ap_data_ind;
|
||||
et_packet_t *tx_timed_packet;
|
||||
et_packet_t *rx_packet_time_out;
|
||||
} u;
|
||||
} et_event_t;
|
||||
|
||||
inline void et_free_pointer(void *p) {if (NULL != p) {free(p); p=NULL;}};
|
||||
|
||||
//-------------------------
|
||||
void et_free_packet(et_packet_t* packet);
|
||||
void et_free_scenario(et_scenario_t* scenario);
|
||||
//-------------------------
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap);
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp);
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp);
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp);
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp);
|
||||
void et_display_packet_ip(const et_ip_hdr_t * const ip);
|
||||
void et_display_packet(const et_packet_t * const packet);
|
||||
void et_display_scenario(const et_scenario_t * const scenario);
|
||||
//-------------------------
|
||||
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p);
|
||||
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p);
|
||||
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p);
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length);
|
||||
void et_decode_s1ap(et_s1ap_t * const s1ap);
|
||||
//-------------------------
|
||||
int et_s1ap_eNB_compare_assoc_id( struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2);
|
||||
uint32_t et_s1ap_generate_eNB_id(void);
|
||||
uint16_t et_s1ap_eNB_fetch_add_global_cnx_id(void);
|
||||
void et_s1ap_eNB_prepare_internal_data(void);
|
||||
void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
|
||||
struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id);
|
||||
s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance);
|
||||
void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream);
|
||||
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet);
|
||||
asn_comp_rval_t* et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints);
|
||||
et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind);
|
||||
int et_scenario_set_packet_received(et_packet_t * const packet);
|
||||
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const sctp_data_ind);
|
||||
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind);
|
||||
void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
net_ip_address_t *mme_ip_address,
|
||||
net_ip_address_t *local_ip_addr,
|
||||
uint16_t in_streams,
|
||||
uint16_t out_streams);
|
||||
void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown);
|
||||
void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB);
|
||||
void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
||||
void * et_s1ap_eNB_task(void *arg);
|
||||
//-------------------------
|
||||
int et_generate_xml_scenario(
|
||||
const char const * xml_in_dir_name,
|
||||
const char const * xml_in_scenario_filename,
|
||||
const char const * enb_config_filename,
|
||||
char const * tsml_out_scenario_filename);
|
||||
//-------------------------
|
||||
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b);
|
||||
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b);
|
||||
void et_scenario_wait_rx_packet(et_packet_t * const packet);
|
||||
void et_scenario_schedule_tx_packet(et_packet_t * packet);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event);
|
||||
//-------------------------
|
||||
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap);
|
||||
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t * const sctp_hdr);
|
||||
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t * const sctp_hdr);
|
||||
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t * const sctp_hdr);
|
||||
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t * const sctp_hdr);
|
||||
et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
|
||||
et_scenario_t* et_generate_scenario(const char * const et_scenario_filename);
|
||||
//-------------------------
|
||||
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints);
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
//-------------------------
|
||||
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints);
|
||||
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints);
|
||||
//------------------------------------------------------------------------------
|
||||
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num);
|
||||
int et_is_file_exists ( const char const * file_nameP, const char const *file_roleP);
|
||||
int et_strip_extension( char *in_filename);
|
||||
void et_get_shift_arg( char * line_argument, shift_packet_t * const shift);
|
||||
int et_split_path ( char * pathP, char *** resP);
|
||||
void et_display_node ( xmlNodePtr node, unsigned int indent);
|
||||
void et_display_tree ( xmlNodePtr node, unsigned int indent);
|
||||
char * et_ip2ip_str(const et_ip_t * const ip);
|
||||
int et_compare_et_ip_to_net_ip_address(const et_ip_t * const ip, const net_ip_address_t * const net_ip);
|
||||
int et_hex2data(unsigned char * const data, const unsigned char * const hexstring, const unsigned int len);
|
||||
sctp_cid_t et_chunk_type_str2cid(const xmlChar * const chunk_type_str);
|
||||
const char * const et_chunk_type_cid2str(const sctp_cid_t chunk_type);
|
||||
const char * const et_error_match2str(const int err);
|
||||
et_packet_action_t et_action_str2et_action_t(const xmlChar * const action);
|
||||
void et_ip_str2et_ip(const xmlChar * const ip_str, et_ip_t * const ip);
|
||||
void et_enb_config_init(const char const * lib_config_file_name_pP);
|
||||
const Enb_properties_array_t *et_enb_config_get(void);
|
||||
void et_eNB_app_register(const Enb_properties_array_t *enb_properties);
|
||||
void *et_eNB_app_task(void *args_p);
|
||||
int et_play_scenario(et_scenario_t* const scenario, const struct shift_packet_s *shifts);
|
||||
|
||||
#endif /* PLAY_SCENARIO_H_ */
|
||||
@@ -0,0 +1,214 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
play_scenario_decode.c
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
#include "assertions.h"
|
||||
#include "play_scenario.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
DevAssert(initiating_p != NULL);
|
||||
|
||||
message->procedureCode = initiating_p->procedureCode;
|
||||
message->criticality = initiating_p->criticality;
|
||||
|
||||
switch(initiating_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport:
|
||||
ret = s1ap_decode_s1ap_downlinknastransporties(&message->msg.s1ap_DownlinkNASTransportIEs,&initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_decode_s1ap_initialcontextsetuprequesties(&message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
ret = s1ap_decode_s1ap_uecontextreleasecommandies(&message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Paging:
|
||||
ret = s1ap_decode_s1ap_pagingies(&message->msg.s1ap_PagingIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport:
|
||||
ret = s1ap_decode_s1ap_uplinknastransporties (&message->msg.s1ap_UplinkNASTransportIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_decode_s1ap_s1setuprequesties (&message->msg.s1ap_S1SetupRequestIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_initialUEMessage:
|
||||
ret = s1ap_decode_s1ap_initialuemessageies (&message->msg.s1ap_InitialUEMessageIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
|
||||
ret = s1ap_decode_s1ap_uecontextreleaserequesties (&message->msg.s1ap_UEContextReleaseRequestIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
|
||||
ret = s1ap_decode_s1ap_uecapabilityinfoindicationies (&message->msg.s1ap_UECapabilityInfoIndicationIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
|
||||
ret = s1ap_decode_s1ap_nasnondeliveryindication_ies (&message->msg.s1ap_NASNonDeliveryIndication_IEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)initiating_p->procedureCode);
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
DevAssert(successfullOutcome_p != NULL);
|
||||
|
||||
message->procedureCode = successfullOutcome_p->procedureCode;
|
||||
message->criticality = successfullOutcome_p->criticality;
|
||||
|
||||
switch(successfullOutcome_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_decode_s1ap_s1setupresponseies(
|
||||
&message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_decode_s1ap_initialcontextsetupresponseies (&message->msg.s1ap_InitialContextSetupResponseIEs, &successfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
ret = s1ap_decode_s1ap_uecontextreleasecompleteies (&message->msg.s1ap_UEContextReleaseCompleteIEs, &successfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)successfullOutcome_p->procedureCode);
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
DevAssert(unSuccessfullOutcome_p != NULL);
|
||||
|
||||
message->procedureCode = unSuccessfullOutcome_p->procedureCode;
|
||||
message->criticality = unSuccessfullOutcome_p->criticality;
|
||||
|
||||
switch(unSuccessfullOutcome_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_decode_s1ap_s1setupfailureies(&message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_decode_s1ap_initialcontextsetupfailureies (&message->msg.s1ap_InitialContextSetupFailureIEs, &unSuccessfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)unSuccessfullOutcome_p->procedureCode);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length)
|
||||
{
|
||||
asn_dec_rval_t dec_ret;
|
||||
|
||||
DevAssert(buffer != NULL);
|
||||
|
||||
memset((void *)pdu, 0, sizeof(S1AP_PDU_t));
|
||||
|
||||
dec_ret = aper_decode(NULL,
|
||||
&asn_DEF_S1AP_PDU,
|
||||
(void **)&pdu,
|
||||
buffer,
|
||||
length,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (dec_ret.code != RC_OK) {
|
||||
S1AP_ERROR("Failed to decode pdu\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
message->direction = pdu->present;
|
||||
|
||||
switch(pdu->present) {
|
||||
case S1AP_PDU_PR_initiatingMessage:
|
||||
return et_s1ap_decode_initiating_message(message,
|
||||
&pdu->choice.initiatingMessage);
|
||||
|
||||
case S1AP_PDU_PR_successfulOutcome:
|
||||
return et_s1ap_decode_successful_outcome(message,
|
||||
&pdu->choice.successfulOutcome);
|
||||
|
||||
case S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
return et_s1ap_decode_unsuccessful_outcome(message,
|
||||
&pdu->choice.unsuccessfulOutcome);
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_decode_s1ap(et_s1ap_t * const s1ap)
|
||||
{
|
||||
if (NULL != s1ap) {
|
||||
if (et_s1ap_decode_pdu(&s1ap->pdu, &s1ap->message, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) {
|
||||
AssertFatal (0, "ERROR %s() Cannot decode S1AP message!\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
play_scenario_display.c
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
#include "play_scenario.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num)
|
||||
{
|
||||
unsigned long octet_index = 0;
|
||||
|
||||
if (byte_stream == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stdout, "+-----+-------------------------------------------------+\n");
|
||||
fprintf(stdout, "| | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
|
||||
fprintf(stdout, "+-----+-------------------------------------------------+\n");
|
||||
|
||||
for (octet_index = 0; octet_index < num; octet_index++) {
|
||||
if ((octet_index % 16) == 0) {
|
||||
if (octet_index != 0) {
|
||||
fprintf(stdout, " |\n");
|
||||
}
|
||||
|
||||
fprintf(stdout, " %04ld |", octet_index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print every single octet in hexadecimal form
|
||||
*/
|
||||
fprintf(stdout, " %02x", byte_stream[octet_index]);
|
||||
/*
|
||||
* Align newline and pipes according to the octets in groups of 2
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Append enough spaces and put final pipe
|
||||
*/
|
||||
unsigned char index;
|
||||
|
||||
for (index = octet_index; index < 16; ++index) {
|
||||
fprintf(stdout, " ");
|
||||
}
|
||||
|
||||
fprintf(stdout, " |\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_node(xmlNodePtr node, unsigned int indent)
|
||||
{
|
||||
int i = 0;
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
xmlChar *path = xmlGetNodePath(node);
|
||||
for (i=0; i<indent; i++) {
|
||||
printf(" ");
|
||||
}
|
||||
if (node->children != NULL && node->children->type == XML_TEXT_NODE) {
|
||||
xmlChar *content = xmlNodeGetContent(node);
|
||||
printf("%s -> %s\n", path, content);
|
||||
xmlFree(content);
|
||||
} else {
|
||||
printf("%s\n", path);
|
||||
}
|
||||
xmlFree(path);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_tree(xmlNodePtr node, unsigned int indent)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
|
||||
for (cur_node = node; cur_node; cur_node = cur_node->next) {
|
||||
if (cur_node->type == XML_ELEMENT_NODE) {
|
||||
et_display_node(cur_node, indent);
|
||||
}
|
||||
et_display_tree(cur_node->children, indent++);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap)
|
||||
{
|
||||
char *message_string = NULL;
|
||||
|
||||
if (s1ap) {
|
||||
message_string = calloc(20000, sizeof(char));
|
||||
AssertFatal (NULL != message_string, "ERROR malloc()failed!\n");
|
||||
s1ap_string_total_size = 0;
|
||||
switch(s1ap->pdu.present) {
|
||||
case S1AP_PDU_PR_initiatingMessage:
|
||||
switch(s1ap->pdu.choice.initiatingMessage.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
default:
|
||||
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)s1ap->pdu.choice.initiatingMessage.procedureCode);
|
||||
}
|
||||
break;
|
||||
case S1AP_PDU_PR_successfulOutcome:
|
||||
switch(s1ap->pdu.choice.successfulOutcome.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.successfulOutcome.procedureCode);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
default:
|
||||
et_free_pointer(message_string);
|
||||
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present);
|
||||
break;
|
||||
}
|
||||
fprintf(stdout, "\t\tSCTP.data XML dump:\n%s\n", message_string);
|
||||
et_free_pointer(message_string);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp)
|
||||
{
|
||||
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.init.init_tag : %u\n", sctp->init_tag);
|
||||
fprintf(stdout, "\t\tSCTP.init.a_rwnd : %u\n", sctp->a_rwnd);
|
||||
fprintf(stdout, "\t\tSCTP.init.num_inbound_streams : %u\n", sctp->num_inbound_streams);
|
||||
fprintf(stdout, "\t\tSCTP.init.num_outbound_streams : %u\n", sctp->num_outbound_streams);
|
||||
fprintf(stdout, "\t\tSCTP.init.initial_tsn : %u\n", sctp->initial_tsn);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp)
|
||||
{
|
||||
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.initack.init_tag : %u\n", sctp->init_tag);
|
||||
fprintf(stdout, "\t\tSCTP.initack.a_rwnd : %u\n", sctp->a_rwnd);
|
||||
fprintf(stdout, "\t\tSCTP.initack.num_inbound_streams : %u\n", sctp->num_inbound_streams);
|
||||
fprintf(stdout, "\t\tSCTP.initack.num_outbound_streams : %u\n", sctp->num_outbound_streams);
|
||||
fprintf(stdout, "\t\tSCTP.initack.initial_tsn : %u\n", sctp->initial_tsn);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp)
|
||||
{
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.data.tsn : %u\n", sctp->tsn);
|
||||
fprintf(stdout, "\t\tSCTP.data.stream : %u\n", sctp->stream);
|
||||
fprintf(stdout, "\t\tSCTP.data.ssn : %u\n", sctp->ssn);
|
||||
fprintf(stdout, "\t\tSCTP.data.ppid : %u\n", sctp->ppid);
|
||||
if (sctp->ppid == 18) {
|
||||
et_display_packet_s1ap_data(&sctp->payload);
|
||||
}
|
||||
fprintf(stdout, "\t\tSCTP.data.binary_stream_allocated_size : %u\n", sctp->payload.binary_stream_allocated_size);
|
||||
if (NULL != sctp->payload.binary_stream) {
|
||||
fprintf(stdout, "\t\tSCTP.data.binary_stream :\n");
|
||||
et_print_hex_octets(sctp->payload.binary_stream, sctp->payload.binary_stream_allocated_size);
|
||||
} else {
|
||||
fprintf(stdout, "\t\tSCTP.data.binary_stream : NULL\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp)
|
||||
{
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.src_port : %u\n", sctp->src_port);
|
||||
fprintf(stdout, "\t\tSCTP.dst_port : %u\n", sctp->dst_port);
|
||||
fprintf(stdout, "\t\tSCTP.chunk_type : %s\n", et_chunk_type_cid2str(sctp->chunk_type));
|
||||
switch (sctp->chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
et_display_packet_sctp_data(&sctp->u.data_hdr);
|
||||
break;
|
||||
case SCTP_CID_INIT:
|
||||
et_display_packet_sctp_initack(&sctp->u.init_hdr);
|
||||
break;
|
||||
case SCTP_CID_INIT_ACK:
|
||||
et_display_packet_sctp_initack(&sctp->u.init_ack_hdr);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_ip(const et_ip_hdr_t * const ip)
|
||||
{
|
||||
if (ip) {
|
||||
fprintf(stdout, "\t\tSource address : %s\n", et_ip2ip_str(&ip->src));
|
||||
fprintf(stdout, "\t\tDestination address : %s\n", et_ip2ip_str(&ip->dst));
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet(const et_packet_t * const packet)
|
||||
{
|
||||
if (packet) {
|
||||
fprintf(stdout, "-------------------------------------------------------------------------------\n");
|
||||
fprintf(stdout, "\tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to 1st packet %ld.%06lu\n",
|
||||
packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to last tx packet %ld.%06lu\n",
|
||||
packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to last_received packet %ld.%06lu\n",
|
||||
packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec);
|
||||
|
||||
switch(packet->action) {
|
||||
case ET_PACKET_ACTION_S1C_SEND:
|
||||
fprintf(stdout, "\tPacket:\tAction SEND\n");
|
||||
break;
|
||||
case ET_PACKET_ACTION_S1C_RECEIVE:
|
||||
fprintf(stdout, "\tPacket:\tAction RECEIVE\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tAction UNKNOWN\n");
|
||||
}
|
||||
switch(packet->status) {
|
||||
case ET_PACKET_STATUS_NONE:
|
||||
fprintf(stdout, "\tPacket:\tStatus NONE\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT:
|
||||
fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SENT:
|
||||
fprintf(stdout, "\tPacket:\tStatus SENT\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_RECEIVED:
|
||||
fprintf(stdout, "\tPacket:\tStatus RECEIVED\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n");
|
||||
}
|
||||
et_display_packet_ip(&packet->ip_hdr);
|
||||
et_display_packet_sctp(&packet->sctp_hdr);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_scenario(const et_scenario_t * const scenario)
|
||||
{
|
||||
et_packet_t *packet = NULL;
|
||||
if (scenario) {
|
||||
fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char*)scenario->name:"UNKNOWN NAME");
|
||||
packet = scenario->list_packet;
|
||||
while (packet) {
|
||||
et_display_packet(packet);
|
||||
packet = packet->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,567 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
play_scenario_fsm.c
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "play_scenario.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "play_scenario_s1ap_eNB_defs.h"
|
||||
#include "timer.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
extern int g_max_speed;
|
||||
//------------------------------------------------------------------------------
|
||||
et_scenario_t *g_scenario = NULL;
|
||||
pthread_mutex_t g_fsm_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
et_fsm_state_t g_fsm_state = ET_FSM_STATE_NULL;
|
||||
uint32_t g_constraints = ET_BIT_MASK_MATCH_SCTP_STREAM | ET_BIT_MASK_MATCH_SCTP_SSN;
|
||||
//------------------------------------------------------------------------------
|
||||
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
|
||||
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b)
|
||||
{
|
||||
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
|
||||
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
|
||||
// may happen overflows but were are not dealing with very large timings
|
||||
long long int r = a->tv_usec + b->tv_usec + (a->tv_sec + b->tv_sec) * 1000000;
|
||||
result->tv_sec = r / (long long int)1000000;
|
||||
result->tv_usec = r % (long long int)1000000;
|
||||
if ((result != a) && (result != b)) {
|
||||
LOG_D(ENB_APP, "timeval_add(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
|
||||
// return true if result is positive
|
||||
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b)
|
||||
{
|
||||
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
|
||||
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
|
||||
// may happen overflows but were are not dealing with very large timings
|
||||
long long int r = a->tv_usec - b->tv_usec + (a->tv_sec - b->tv_sec) * 1000000;
|
||||
result->tv_sec = r / (long long int)1000000;
|
||||
result->tv_usec = r % (long long int)1000000;
|
||||
if ((result != a) && (result != b)) {
|
||||
LOG_D(ENB_APP, "timeval_subtract(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
|
||||
}
|
||||
return (result->tv_sec >= 0) && (result->tv_usec >= 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_scenario_wait_rx_packet(et_packet_t * const packet)
|
||||
{
|
||||
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING;
|
||||
g_fsm_state = ET_FSM_STATE_WAITING_RX_EVENT;
|
||||
if (timer_setup (ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC, 0, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
|
||||
packet, &packet->timer_id) < 0) {
|
||||
AssertFatal(0, " Can not start waiting RX event timer\n");
|
||||
}
|
||||
g_scenario->timer_count++;
|
||||
LOG_D(ENB_APP, "Waiting RX packet num %d original frame number %u\n", packet->packet_number, packet->original_frame_number);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
{
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance = NULL;
|
||||
struct timeval now = { .tv_sec = 0, .tv_usec = 0 };
|
||||
struct timeval offset_last_tx_packet = { .tv_sec = 0, .tv_usec = 0 };
|
||||
struct timeval offset_last_rx_packet = { .tv_sec = 0, .tv_usec = 0 };
|
||||
struct timeval offset_tx_rx = { .tv_sec = 0, .tv_usec = 0 };
|
||||
struct timeval offset = { .tv_sec = 0, .tv_usec = 0 };
|
||||
int last_packet_was_rx = 0;
|
||||
int we_are_too_late = 0;
|
||||
int original_frame_number = -1;
|
||||
|
||||
AssertFatal(NULL != packet, "packet argument is NULL");
|
||||
s1ap_eNB_instance = et_s1ap_eNB_get_instance(packet->enb_instance);
|
||||
AssertFatal(NULL != s1ap_eNB_instance, "Cannot get s1ap_eNB_instance_t for eNB instance %d", packet->enb_instance);
|
||||
|
||||
LOG_D(ENB_APP, "%s\n", __FUNCTION__);
|
||||
g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
|
||||
|
||||
switch (packet->sctp_hdr.chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
// check if we can send it now
|
||||
// TODO: BUG we have to discard in scenario all packets that cannot be processed (SACK, COOKIEs, etc)
|
||||
AssertFatal(gettimeofday(&now, NULL) == 0, "gettimeofday failed");
|
||||
timeval_subtract(&offset_last_tx_packet,&now,&g_scenario->time_last_tx_packet);
|
||||
timeval_subtract(&offset_last_rx_packet,&now,&g_scenario->time_last_rx_packet);
|
||||
LOG_D(ENB_APP, "offset_last_tx_packet=%ld.%06d\n", offset_last_tx_packet.tv_sec, offset_last_tx_packet.tv_usec);
|
||||
LOG_D(ENB_APP, "offset_last_rx_packet=%ld.%06d\n", offset_last_rx_packet.tv_sec, offset_last_rx_packet.tv_usec);
|
||||
|
||||
last_packet_was_rx = timeval_subtract(&offset_tx_rx,&offset_last_tx_packet,&offset_last_rx_packet);
|
||||
if (last_packet_was_rx) {
|
||||
LOG_D(ENB_APP, "last_packet_was_rx\n");
|
||||
we_are_too_late = timeval_subtract(&offset,&offset_last_rx_packet,&packet->time_relative_to_last_received_packet);
|
||||
LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec);
|
||||
} else {
|
||||
LOG_D(ENB_APP, "last_packet_was_tx\n");
|
||||
we_are_too_late = timeval_subtract(&offset,&offset_last_tx_packet,&packet->time_relative_to_last_sent_packet);
|
||||
LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec);
|
||||
}
|
||||
if ((0 == we_are_too_late) && (0 == g_max_speed)){
|
||||
// set timer
|
||||
if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)){
|
||||
offset.tv_sec = -offset.tv_sec;
|
||||
offset.tv_usec = -offset.tv_usec;
|
||||
}
|
||||
|
||||
LOG_D(ENB_APP, "Send packet num %u original frame number %u in %ld.%06d sec\n",
|
||||
packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec);
|
||||
|
||||
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_SENDING;
|
||||
if (timer_setup (offset.tv_sec, offset.tv_usec, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,packet, &packet->timer_id) < 0) {
|
||||
AssertFatal(0, " Can not start TX event timer\n");
|
||||
}
|
||||
g_scenario->timer_count++;
|
||||
// Done g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
|
||||
} else {
|
||||
// send immediately
|
||||
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
|
||||
original_frame_number = packet->original_frame_number;
|
||||
do {
|
||||
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
|
||||
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
|
||||
|
||||
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
|
||||
et_s1ap_eNB_itti_send_sctp_data_req(
|
||||
packet->enb_instance,
|
||||
packet->sctp_hdr.u.data_hdr.assoc_id,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
|
||||
packet->sctp_hdr.u.data_hdr.stream);
|
||||
packet->status = ET_PACKET_STATUS_SENT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
packet = packet->next;
|
||||
} while ((NULL != packet) && (packet->original_frame_number == original_frame_number));
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
}
|
||||
break;
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
AssertFatal(0, "Invalid case TX packet SCTP_CID_INIT or SCTP_CID_INIT_ACK");
|
||||
break;
|
||||
default:
|
||||
AssertFatal(0, "Invalid case TX packet SCTP_CID %d", packet->sctp_hdr.chunk_type);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
{
|
||||
|
||||
switch (event.code){
|
||||
case ET_EVENT_TICK:
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Considering packet num %d original frame number %u\n", g_scenario->next_packet->packet_number, g_scenario->next_packet->original_frame_number);
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
case SCTP_CID_DATA :
|
||||
// no init in this scenario, may be sub-scenario
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->status != ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) {
|
||||
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
|
||||
}
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
|
||||
}
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
case SCTP_CID_HEARTBEAT:
|
||||
case SCTP_CID_HEARTBEAT_ACK:
|
||||
case SCTP_CID_COOKIE_ECHO:
|
||||
case SCTP_CID_COOKIE_ACK:
|
||||
case SCTP_CID_ECN_ECNE:
|
||||
case SCTP_CID_ECN_CWR:
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
break;
|
||||
|
||||
case SCTP_CID_ABORT:
|
||||
case SCTP_CID_SHUTDOWN:
|
||||
case SCTP_CID_SHUTDOWN_ACK:
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
if (0 == g_scenario->timer_count) {
|
||||
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
//exit(0);
|
||||
}
|
||||
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
case ET_EVENT_RX_PACKET_TIME_OUT:
|
||||
AssertFatal(0, "Event ET_EVENT_RX_PACKET_TIME_OUT not handled in FSM state ET_FSM_STATE_RUNNING");
|
||||
break;
|
||||
case ET_EVENT_TX_TIMED_PACKET:
|
||||
AssertFatal(0, "Event ET_EVENT_TX_TIMED_PACKET not handled in FSM state ET_FSM_STATE_RUNNING");
|
||||
break;
|
||||
case ET_EVENT_RX_S1AP:
|
||||
et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_RUNNING", event.code);
|
||||
}
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
{
|
||||
int rv = 0;
|
||||
int original_frame_number = -1;
|
||||
et_packet_t *packet = NULL;
|
||||
|
||||
switch (event.code){
|
||||
case ET_EVENT_TICK:
|
||||
fprintf(stdout, "EVENT_TICK: waiting for tx event\n");
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_S1AP:
|
||||
rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
|
||||
break;
|
||||
|
||||
case ET_EVENT_TX_TIMED_PACKET:
|
||||
// send immediately
|
||||
packet = event.u.tx_timed_packet;
|
||||
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
|
||||
|
||||
original_frame_number = packet->original_frame_number;
|
||||
do {
|
||||
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
|
||||
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
|
||||
|
||||
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
|
||||
et_s1ap_eNB_itti_send_sctp_data_req(
|
||||
packet->enb_instance,
|
||||
packet->sctp_hdr.u.data_hdr.assoc_id,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
|
||||
packet->sctp_hdr.u.data_hdr.stream);
|
||||
packet->status = ET_PACKET_STATUS_SENT;
|
||||
packet = packet->next;
|
||||
g_scenario->next_packet = packet;
|
||||
} while ( (NULL != packet) && (packet->original_frame_number == original_frame_number));
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_PACKET_TIME_OUT:
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_TX", event.code);
|
||||
}
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
|
||||
{
|
||||
int rv = 0;
|
||||
switch (event.code){
|
||||
case ET_EVENT_TICK:
|
||||
fprintf(stdout, "EVENT_TICK: waiting for rx event\n");
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_PACKET_TIME_OUT:
|
||||
fprintf(stderr, "Error The following packet is not received:\n");
|
||||
//et_display_packet(event.u.rx_packet_time_out);
|
||||
AssertFatal(0, "Waited packet not received");
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_S1AP:
|
||||
rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
|
||||
// waited packet
|
||||
if (rv == 0) {
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
}
|
||||
break;
|
||||
|
||||
case ET_EVENT_TX_TIMED_PACKET:
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_RX", event.code);
|
||||
}
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event)
|
||||
{
|
||||
|
||||
switch (event.code){
|
||||
case ET_EVENT_TICK:
|
||||
break;
|
||||
|
||||
case ET_EVENT_S1C_CONNECTED:
|
||||
// hack simulate we have been able to get the right timing values for STCP connect
|
||||
AssertFatal(gettimeofday(&g_scenario->time_last_rx_packet, NULL) == 0, "gettimeofday failed");
|
||||
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
case SCTP_CID_DATA :
|
||||
// no init in this scenario, may be sub-scenario
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->last_rx_packet = g_scenario->next_packet;
|
||||
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
|
||||
}
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
case SCTP_CID_HEARTBEAT:
|
||||
case SCTP_CID_HEARTBEAT_ACK:
|
||||
case SCTP_CID_COOKIE_ECHO:
|
||||
case SCTP_CID_COOKIE_ACK:
|
||||
case SCTP_CID_ECN_ECNE:
|
||||
case SCTP_CID_ECN_CWR:
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
break;
|
||||
|
||||
case SCTP_CID_ABORT:
|
||||
case SCTP_CID_SHUTDOWN:
|
||||
case SCTP_CID_SHUTDOWN_ACK:
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
if (0 == g_scenario->timer_count) {
|
||||
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_CONNECTING_S1C", event.code);
|
||||
}
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
{
|
||||
switch (event.code){
|
||||
case ET_EVENT_TICK:
|
||||
break;
|
||||
|
||||
case ET_EVENT_INIT:
|
||||
AssertFatal(NULL == g_scenario, "Current scenario not ended");
|
||||
g_scenario = event.u.init.scenario;
|
||||
g_scenario->next_packet = g_scenario->list_packet;
|
||||
g_scenario->last_rx_packet = NULL;
|
||||
g_scenario->last_tx_packet = NULL;
|
||||
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
|
||||
case SCTP_CID_DATA :
|
||||
// no init in this scenario, may be sub-scenario, ...
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->last_rx_packet = g_scenario->next_packet;
|
||||
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
|
||||
}
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
g_scenario->enb_properties = (Enb_properties_array_t *)et_enb_config_get();
|
||||
g_scenario->hash_old_ue_mme_id2ue_mme_id = hashtable_create (256,NULL,NULL);
|
||||
g_scenario->hash_mme2association_id = hashtable_create (256,NULL,NULL);
|
||||
// Try to register each eNB
|
||||
g_scenario->registered_enb = 0;
|
||||
g_fsm_state = ET_FSM_STATE_CONNECTING_S1C;
|
||||
AssertFatal(gettimeofday(&g_scenario->time_last_tx_packet, NULL) == 0, "gettimeofday failed");
|
||||
et_eNB_app_register (g_scenario->enb_properties);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
|
||||
case SCTP_CID_HEARTBEAT:
|
||||
case SCTP_CID_HEARTBEAT_ACK:
|
||||
case SCTP_CID_COOKIE_ECHO:
|
||||
case SCTP_CID_COOKIE_ACK:
|
||||
case SCTP_CID_ECN_ECNE:
|
||||
case SCTP_CID_ECN_CWR:
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
break;
|
||||
|
||||
case SCTP_CID_ABORT:
|
||||
case SCTP_CID_SHUTDOWN:
|
||||
case SCTP_CID_SHUTDOWN_ACK:
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "No Useful packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_NULL", event.code);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event)
|
||||
{
|
||||
AssertFatal((event.code >= ET_EVENT_START) && (event.code < ET_EVENT_END), "Unknown et_event_t.code %d", event.code);
|
||||
|
||||
pthread_mutex_lock(&g_fsm_lock);
|
||||
switch (g_fsm_state){
|
||||
case ET_FSM_STATE_NULL: return et_scenario_fsm_notify_event_state_null(event); break;
|
||||
case ET_FSM_STATE_CONNECTING_S1C: return et_scenario_fsm_notify_event_state_connecting_s1c(event); break;
|
||||
case ET_FSM_STATE_WAITING_TX_EVENT: return et_scenario_fsm_notify_event_state_waiting_tx(event); break;
|
||||
case ET_FSM_STATE_WAITING_RX_EVENT: return et_scenario_fsm_notify_event_state_waiting_rx(event); break;
|
||||
case ET_FSM_STATE_RUNNING: return et_scenario_fsm_notify_event_state_running(event); break;
|
||||
default:
|
||||
AssertFatal(0, "Case fsm_state %d not handled", g_fsm_state);
|
||||
}
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
}
|
||||
@@ -0,0 +1,600 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
play_scenario_parse.c
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/DOCBparser.h>
|
||||
#include <libxml/xinclude.h>
|
||||
#include <libxml/catalog.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/xsltInternals.h>
|
||||
#include <libxslt/transform.h>
|
||||
#include <libxslt/xsltutils.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "play_scenario.h"
|
||||
//------------------------------------------------------------------------------
|
||||
#define ENB_CONFIG_MAX_XSLT_PARAMS 32
|
||||
//------------------------------------------------------------------------------
|
||||
extern Enb_properties_array_t g_enb_properties;
|
||||
//------------------------------------------------------------------------------
|
||||
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap)
|
||||
{
|
||||
xmlNodePtr cur_node = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
xmlChar *xml_char2 = NULL;
|
||||
unsigned int size = 0;
|
||||
int rc = 0;
|
||||
unsigned int go_deeper_in_tree = 1;
|
||||
|
||||
if ((NULL != s1ap_node) && (NULL != s1ap)) {
|
||||
// see http://www.xmlsoft.org/html/libxml-tree.html#xmlCopyNode
|
||||
if (NULL == s1ap->doc) {
|
||||
xmlUnlinkNode(s1ap_node);
|
||||
//cur_node = xmlCopyNodeList(s1ap_node);
|
||||
// arg2: if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable)
|
||||
//cur_node = xmlCopyNode(s1ap_node, 1);
|
||||
//AssertFatal(NULL != cur_node, "xmlCopyNode Failed");
|
||||
s1ap->doc = xmlNewDoc(BAD_CAST "1.0");
|
||||
xmlDocSetRootElement(s1ap->doc, s1ap_node);
|
||||
}
|
||||
|
||||
for (cur_node = (xmlNode *)s1ap_node; cur_node; cur_node = cur_node->next) {
|
||||
go_deeper_in_tree = 1;
|
||||
if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) {
|
||||
// do not get hidden fields
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"hide");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"yes"))) {
|
||||
go_deeper_in_tree = 0;
|
||||
}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
if (0 < go_deeper_in_tree) {
|
||||
// first get size
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"size");
|
||||
if (NULL != xml_char) {
|
||||
size = strtoul((const char *)xml_char, NULL, 0);
|
||||
xmlFree(xml_char);
|
||||
// second: try to get value (always hex)
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"name");
|
||||
fprintf(stdout, "s1ap %p field name %s size %d value %s\n",s1ap, xml_char2, size, xml_char);
|
||||
xmlFree(xml_char2);
|
||||
// if success to get value, do not parse children
|
||||
//AssertFatal ((xmlStrlen(xml_char) == size), "ERROR %s() mismatch in size %d and strlen %d\n", __FUNCTION__, size, xmlStrlen(xml_char));
|
||||
//if (xmlStrlen(xml_char) == size) {
|
||||
AssertFatal ((s1ap->binary_stream_pos+xmlStrlen(xml_char)/2) <= s1ap->binary_stream_allocated_size,
|
||||
"ERROR in buffer size: binary_stream_pos %d xmlStrlen(xml_char)/2=%d\n", s1ap->binary_stream_pos, xmlStrlen(xml_char)/2);
|
||||
rc = et_hex2data( &s1ap->binary_stream[s1ap->binary_stream_pos], xml_char, xmlStrlen(xml_char));
|
||||
s1ap->binary_stream_pos += xmlStrlen(xml_char)/2;
|
||||
//et_display_node(cur_node, 0);
|
||||
AssertFatal (rc >= 0, "ERROR in converting hex string %s len %d size %d rc %d\n", xml_char, xmlStrlen(xml_char), size, rc);
|
||||
go_deeper_in_tree = 0;
|
||||
//}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 < go_deeper_in_tree) {
|
||||
et_parse_s1ap(doc, cur_node->children, s1ap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t * const sctp_hdr)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
xmlChar *xml_char2 = NULL;
|
||||
|
||||
if ((NULL != sctp_node) && (NULL != sctp_hdr)) {
|
||||
xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_payload_proto_id"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->ppid = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_sid"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->stream = strtoul((const char *)xml_char2, NULL, 16);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_tsn"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->tsn = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_ssn"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->ssn = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) {
|
||||
et_parse_sctp_data_chunk(doc, cur_node, sctp_hdr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t * const sctp_hdr)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
xmlChar *xml_char2 = NULL;
|
||||
|
||||
if ((NULL != sctp_node) && (NULL != sctp_hdr)) {
|
||||
xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_nr_out_streams"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->num_outbound_streams = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_nr_in_streams"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->num_inbound_streams = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_credit"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->a_rwnd = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_initial_tsn"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->initial_tsn = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_initiate_tag"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->init_tag = strtoul((const char *)xml_char2, NULL, 16);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) {
|
||||
et_parse_sctp_init_chunk(doc, cur_node, sctp_hdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t * const sctp_hdr)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
xmlChar *xml_char2 = NULL;
|
||||
|
||||
if ((NULL != sctp_node) && (NULL != sctp_hdr)) {
|
||||
xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_nr_out_streams"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->num_outbound_streams = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_nr_in_streams"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)(xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->num_inbound_streams = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_credit"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->a_rwnd = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_initial_tsn"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->initial_tsn = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_initiate_tag"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->init_tag = strtoul((const char *)xml_char2, NULL, 16);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) {
|
||||
et_parse_sctp_init_ack_chunk(doc, cur_node, sctp_hdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t * const sctp_hdr)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
xmlChar *xml_char2 = NULL;
|
||||
|
||||
if ((NULL != sctp_node) && (NULL != sctp_hdr)) {
|
||||
if ((!xmlStrcmp(sctp_node->name, (const xmlChar *)"proto"))) {
|
||||
xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"s1ap"))) {
|
||||
xmlFree(xml_char);
|
||||
xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"pos");
|
||||
if (NULL != xml_char) {
|
||||
sctp_hdr->u.data_hdr.payload.xml_stream_pos_offset = strtoul((const char *)xml_char, NULL, 0);
|
||||
xmlFree(xml_char);
|
||||
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"size");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->u.data_hdr.payload.binary_stream_allocated_size = strtoul((const char *)xml_char2, NULL, 0);
|
||||
sctp_hdr->u.data_hdr.payload.binary_stream = calloc(1, sctp_hdr->u.data_hdr.payload.binary_stream_allocated_size);
|
||||
sctp_hdr->u.data_hdr.payload.binary_stream_pos = 0;
|
||||
fprintf(stdout, "Allocating payload of sctp_hdr %p %u bytes\n", sctp_hdr, sctp_hdr->u.data_hdr.payload.binary_stream_allocated_size);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
et_parse_s1ap(doc, sctp_node, &sctp_hdr->u.data_hdr.payload);
|
||||
et_decode_s1ap(&sctp_hdr->u.data_hdr.payload);
|
||||
return;
|
||||
}
|
||||
}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
}
|
||||
//if ((cur_node->type == XML_ATTRIBUTE_NODE) || (cur_node->type == XML_ELEMENT_NODE)) {
|
||||
xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.srcport"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->src_port = strtoul((const char *)xml_char2, NULL, 16);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.dstport"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->dst_port = strtoul((const char *)xml_char2, NULL, 16);
|
||||
xmlFree(xml_char2);
|
||||
}
|
||||
} else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.chunk_type"))) {
|
||||
xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value");
|
||||
if (NULL != xml_char2) {
|
||||
sctp_hdr->chunk_type = strtoul((const char *)xml_char2, NULL, 0);
|
||||
xmlFree(xml_char2);
|
||||
switch (sctp_hdr->chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
et_parse_sctp_data_chunk(doc, sctp_node->parent, &sctp_hdr->u.data_hdr);
|
||||
break;
|
||||
case SCTP_CID_INIT:
|
||||
et_parse_sctp_init_chunk(doc, sctp_node->parent, &sctp_hdr->u.init_hdr);
|
||||
break;
|
||||
case SCTP_CID_INIT_ACK:
|
||||
et_parse_sctp_init_ack_chunk(doc, sctp_node->parent, &sctp_hdr->u.init_ack_hdr);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) {
|
||||
et_parse_sctp(doc, cur_node, sctp_hdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_packet_shift_timing(et_packet_t * const packet, const struct timeval * const shift)
|
||||
{
|
||||
timeval_add(&packet->time_relative_to_first_packet, &packet->time_relative_to_first_packet, shift);
|
||||
AssertFatal((packet->time_relative_to_first_packet.tv_sec >= 0) && (packet->time_relative_to_first_packet.tv_usec >= 0),
|
||||
"Bad timing result time_relative_to_first_packet=%d.%d packet num %u, original frame number %u",
|
||||
packet->time_relative_to_first_packet.tv_sec,
|
||||
packet->time_relative_to_first_packet.tv_usec,
|
||||
packet->packet_number,
|
||||
packet->original_frame_number);
|
||||
|
||||
timeval_add(&packet->time_relative_to_last_received_packet, &packet->time_relative_to_last_received_packet, shift);
|
||||
AssertFatal((packet->time_relative_to_last_received_packet.tv_sec >= 0) && (packet->time_relative_to_last_received_packet.tv_usec >= 0),
|
||||
"Bad timing result time_relative_to_last_received_packet=%d.%d packet num %u, original frame number %u",
|
||||
packet->time_relative_to_last_received_packet.tv_sec,
|
||||
packet->time_relative_to_last_received_packet.tv_usec,
|
||||
packet->packet_number,
|
||||
packet->original_frame_number);
|
||||
|
||||
timeval_add(&packet->time_relative_to_last_sent_packet, &packet->time_relative_to_last_sent_packet, shift);
|
||||
AssertFatal((packet->time_relative_to_last_sent_packet.tv_sec >= 0) && (packet->time_relative_to_last_sent_packet.tv_usec >= 0),
|
||||
"Bad timing result time_relative_to_last_sent_packet=%d.%d packet num %u, original frame number %u",
|
||||
packet->time_relative_to_last_sent_packet.tv_sec,
|
||||
packet->time_relative_to_last_sent_packet.tv_usec,
|
||||
packet->packet_number,
|
||||
packet->original_frame_number);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node)
|
||||
{
|
||||
|
||||
et_packet_t *packet = NULL;
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
float afloat = (float)0.0;
|
||||
static struct timeval initial_time = { .tv_sec = 0, .tv_usec = 0 };
|
||||
static struct timeval relative_last_sent_packet = { .tv_sec = 0, .tv_usec = 0 };
|
||||
static struct timeval relative_last_received_packet = { .tv_sec = 0, .tv_usec = 0 };
|
||||
static char first_packet = 1;
|
||||
static char first_sent_packet = 1;
|
||||
static char first_received_packet = 1;
|
||||
static unsigned int packet_number = 1;
|
||||
|
||||
|
||||
if (NULL != node) {
|
||||
packet = calloc(1, sizeof(*packet));
|
||||
|
||||
xml_char = xmlGetProp(node, (const xmlChar *)"action");
|
||||
packet->action = et_action_str2et_action_t(xml_char);
|
||||
packet->status = ET_PACKET_STATUS_NONE;
|
||||
xmlFree(xml_char);
|
||||
packet->packet_number = packet_number++;
|
||||
|
||||
for (cur_node = node->children; cur_node; cur_node = cur_node->next) {
|
||||
//if (cur_node->type == XML_ELEMENT_NODE) {
|
||||
if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"frame.time_relative"))) {
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value");
|
||||
afloat = atof((const char*)xml_char);
|
||||
xmlFree(xml_char);
|
||||
fprintf(stdout, "Parsing packet frame.time_relative: %f\n", afloat);
|
||||
packet->time_relative_to_first_packet.tv_sec = (int)afloat;
|
||||
packet->time_relative_to_first_packet.tv_usec = (int)((afloat - packet->time_relative_to_first_packet.tv_sec)*1000000.0);
|
||||
|
||||
if (first_packet > 0) {
|
||||
initial_time = packet->time_relative_to_first_packet;
|
||||
packet->time_relative_to_first_packet.tv_sec = 0;
|
||||
packet->time_relative_to_first_packet.tv_usec = 0;
|
||||
first_packet = 0;
|
||||
} else {
|
||||
timersub(&packet->time_relative_to_first_packet, &initial_time,
|
||||
&packet->time_relative_to_first_packet);
|
||||
}
|
||||
} else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"frame.number"))) {
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value");
|
||||
packet->original_frame_number = strtoul((const char *)xml_char, NULL, 0);
|
||||
fprintf(stdout, "Parsing packet frame.number: %u\n", packet->original_frame_number);
|
||||
xmlFree(xml_char);
|
||||
} else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"ip.src"))) {
|
||||
xml_char = xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1);
|
||||
et_ip_str2et_ip(xml_char, &packet->ip_hdr.src);
|
||||
xmlFree(xml_char);
|
||||
} else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"ip.dst"))) {
|
||||
xml_char = xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1);
|
||||
et_ip_str2et_ip(xml_char, &packet->ip_hdr.dst);
|
||||
xmlFree(xml_char);
|
||||
} else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"proto"))) {
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"name");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp"))) {
|
||||
et_parse_sctp(doc, cur_node, &packet->sctp_hdr);
|
||||
}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
} else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"eNB.instance"))) {
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value");
|
||||
packet->enb_instance = strtoul((const char *)xml_char, NULL, 0);
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
et_scenario_t* et_generate_scenario(
|
||||
const char * const tsml_out_scenario_filename)
|
||||
{
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr root = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
et_scenario_t *scenario = NULL;
|
||||
et_packet_t *last_packet = NULL;
|
||||
et_packet_t *packet = NULL;
|
||||
et_packet_t **next_packet = NULL;
|
||||
|
||||
doc = xmlParseFile(tsml_out_scenario_filename);
|
||||
if (NULL == doc) {
|
||||
AssertFatal (0, "Could not parse scenario xml file %s!\n", tsml_out_scenario_filename);
|
||||
} else {
|
||||
fprintf(stdout, "Test scenario file to play: %s\n", tsml_out_scenario_filename);
|
||||
//xmlDebugDumpDocument(NULL, doc);
|
||||
}
|
||||
|
||||
// Get root
|
||||
root = xmlDocGetRootElement(doc);
|
||||
if (NULL != root) {
|
||||
if ((!xmlStrcmp(root->name, (const xmlChar *)"scenario"))) {
|
||||
xml_char = xmlGetProp(root, (const xmlChar *)"name");
|
||||
printf("scenario name: %s\n", xml_char);
|
||||
scenario = calloc(1, sizeof(*scenario));
|
||||
scenario->name = xml_char; // nodup nofree
|
||||
|
||||
next_packet = &scenario->list_packet;
|
||||
for (node = root->children; node != NULL; node = node->next) {
|
||||
if ((!xmlStrcmp(node->name, (const xmlChar *)"packet"))) {
|
||||
packet = et_parse_xml_packet(doc, node);
|
||||
if (NULL != packet) {
|
||||
// special case: S1AP same frame for 2 packets
|
||||
if (NULL != last_packet) {
|
||||
if (last_packet->original_frame_number == packet->original_frame_number) {
|
||||
// updating because these informations are not in 2nd sctp header (same IP packet)
|
||||
packet->sctp_hdr.dst_port = last_packet->sctp_hdr.dst_port;
|
||||
packet->sctp_hdr.src_port = last_packet->sctp_hdr.src_port;
|
||||
}
|
||||
}
|
||||
*next_packet = packet;
|
||||
next_packet = &packet->next;
|
||||
} else {
|
||||
fprintf(stdout, "WARNING omitted packet\n");
|
||||
}
|
||||
}
|
||||
last_packet = packet;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Empty xml document\n");
|
||||
}
|
||||
xmlFreeDoc(doc);
|
||||
xmlCleanupParser();
|
||||
return scenario;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
int et_generate_xml_scenario(
|
||||
const char const * xml_in_dir_name,
|
||||
const char const * xml_in_scenario_filename,
|
||||
const char const * enb_config_filename,
|
||||
char const * tsml_out_scenario_filename)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
//int fd_pdml_in;
|
||||
xsltStylesheetPtr cur = NULL;
|
||||
xmlDocPtr doc, res;
|
||||
FILE *play_scenario_file = NULL;
|
||||
const char *params[2*ENB_CONFIG_MAX_XSLT_PARAMS];
|
||||
int nb_params = 0;
|
||||
int i,j;
|
||||
char astring[1024];
|
||||
struct in_addr addr;
|
||||
int ret = 0;
|
||||
|
||||
memset(astring, 0, sizeof(astring));
|
||||
if (getcwd(astring, sizeof(astring)) != NULL) {
|
||||
fprintf(stdout, "working in %s directory\n", astring);
|
||||
} else {
|
||||
perror("getcwd() ERROR");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
xmlLoadExtDtdDefaultValue = 1;
|
||||
cur = xsltParseStylesheetFile((const xmlChar *)"/usr/share/oai/xsl/play_scenario.xsl");
|
||||
if (NULL == cur) {
|
||||
AssertFatal (0, "Could not parse stylesheet file /usr/share/oai/xsl/play_scenario.xsl!\n");
|
||||
} else {
|
||||
fprintf(stdout, "XSLT style sheet: /usr/share/oai/xsl/play_scenario.xsl\n");
|
||||
}
|
||||
|
||||
doc = xmlParseFile(xml_in_scenario_filename);
|
||||
if (NULL == doc) {
|
||||
AssertFatal (0, "Could not parse scenario xml file %s!\n", xml_in_scenario_filename);
|
||||
} else {
|
||||
fprintf(stdout, "Test scenario file: %s\n", xml_in_scenario_filename);
|
||||
}
|
||||
|
||||
for (i = 0; i < g_enb_properties.number; i++) {
|
||||
// eNB S1-C IPv4 address
|
||||
sprintf(astring, "enb%d_s1c", i);
|
||||
params[nb_params++] = strdup(astring);
|
||||
addr.s_addr = g_enb_properties.properties[i]->enb_ipv4_address_for_S1_MME;
|
||||
sprintf(astring, "\"%s\"", inet_ntoa(addr));
|
||||
params[nb_params++] = strdup(astring);
|
||||
|
||||
// MME S1-C IPv4 address
|
||||
for (j = 0; j < g_enb_properties.properties[i]->nb_mme; j++) {
|
||||
sprintf(astring, "mme%d_s1c_%d", i, j);
|
||||
params[nb_params++] = strdup(astring);
|
||||
AssertFatal (g_enb_properties.properties[i]->mme_ip_address[j].ipv4_address,
|
||||
"Only support MME IPv4 address\n");
|
||||
sprintf(astring, "\"%s\"", g_enb_properties.properties[i]->mme_ip_address[j].ipv4_address);
|
||||
params[nb_params++] = strdup(astring);
|
||||
}
|
||||
}
|
||||
params[nb_params] = NULL;
|
||||
res = xsltApplyStylesheet(cur, doc, params);
|
||||
if (NULL != res) {
|
||||
sprintf((char *)tsml_out_scenario_filename,"%s",xml_in_scenario_filename);
|
||||
if (et_strip_extension((char *)tsml_out_scenario_filename) > 0) {
|
||||
strcat((char *)tsml_out_scenario_filename, ".tsml");
|
||||
play_scenario_file = fopen( tsml_out_scenario_filename, "w+");
|
||||
if (NULL != play_scenario_file) {
|
||||
xsltSaveResultToFile(play_scenario_file, res, cur);
|
||||
fclose(play_scenario_file);
|
||||
fprintf(stdout, "Wrote test scenario to %s\n", tsml_out_scenario_filename);
|
||||
} else {
|
||||
fprintf(stderr, "ERROR in fopen(%s)\n", tsml_out_scenario_filename);
|
||||
ret = -1;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "ERROR in strip_extension()\n");
|
||||
ret = -1;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "ERROR in xsltApplyStylesheet()\n");
|
||||
ret = -1;
|
||||
}
|
||||
xsltFreeStylesheet(cur);
|
||||
xmlFreeDoc(doc);
|
||||
xmlFreeDoc(res);
|
||||
|
||||
xsltCleanupGlobals();
|
||||
xmlCleanupParser();
|
||||
return ret;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,634 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
play_scenario_s1ap_compare_ie.c
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <crypt.h>
|
||||
#include <errno.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include "tree.h"
|
||||
#include "queue.h"
|
||||
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "timer.h"
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "conversions.h"
|
||||
#include "s1ap_common.h"
|
||||
#include "play_scenario_s1ap_eNB_defs.h"
|
||||
#include "play_scenario.h"
|
||||
#include "msc.h"
|
||||
//------------------------------------------------------------------------------
|
||||
extern et_scenario_t *g_scenario;
|
||||
extern uint32_t g_constraints;
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints)
|
||||
{
|
||||
asn_comp_rval_t *ret = NULL;
|
||||
AssertFatal(m1 != NULL, "bad parameter m1");
|
||||
AssertFatal(m2 != NULL, "bad parameter m2");
|
||||
AssertFatal((present == S1AP_PDU_PR_initiatingMessage) ||
|
||||
(present == S1AP_PDU_PR_successfulOutcome) ||
|
||||
(present == S1AP_PDU_PR_unsuccessfulOutcome) , "Bad parameter S1AP_PDU_PR present ");
|
||||
AssertFatal( m1->procedureCode == m2->procedureCode, "Bad parameters: no matching procedure codes");
|
||||
|
||||
|
||||
// some cases can never occur since uplink only.
|
||||
switch (m1->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_HandoverPreparation:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_handoverrequiredies(
|
||||
&m1->msg.s1ap_HandoverRequiredIEs,
|
||||
&m2->msg.s1ap_HandoverRequiredIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_handovercommandies(
|
||||
&m1->msg.s1ap_HandoverCommandIEs,
|
||||
&m2->msg.s1ap_HandoverCommandIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_HandoverResourceAllocation:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_handoverrequesties(
|
||||
&m1->msg.s1ap_HandoverRequestIEs,
|
||||
&m2->msg.s1ap_HandoverRequestIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_handoverrequestacknowledgeies(
|
||||
&m1->msg.s1ap_HandoverRequestAcknowledgeIEs,
|
||||
&m2->msg.s1ap_HandoverRequestAcknowledgeIEs);
|
||||
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_handoverfailureies(
|
||||
&m1->msg.s1ap_HandoverFailureIEs,
|
||||
&m2->msg.s1ap_HandoverFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_HandoverNotification:
|
||||
ret = s1ap_compare_s1ap_handovernotifyies(
|
||||
&m1->msg.s1ap_HandoverNotifyIEs,
|
||||
&m2->msg.s1ap_HandoverNotifyIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_PathSwitchRequest:
|
||||
ret = s1ap_compare_s1ap_pathswitchrequesties(
|
||||
&m1->msg.s1ap_PathSwitchRequestIEs,
|
||||
&m2->msg.s1ap_PathSwitchRequestIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_HandoverCancel:
|
||||
ret = s1ap_compare_s1ap_handovercancelies(
|
||||
&m1->msg.s1ap_HandoverCancelIEs,
|
||||
&m2->msg.s1ap_HandoverCancelIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABSetup:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_e_rabsetuprequesties(
|
||||
&m1->msg.s1ap_E_RABSetupRequestIEs,
|
||||
&m2->msg.s1ap_E_RABSetupRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_e_rabsetupresponseies(
|
||||
&m1->msg.s1ap_E_RABSetupResponseIEs,
|
||||
&m2->msg.s1ap_E_RABSetupResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABModify:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_e_rabmodifyrequesties(
|
||||
&m1->msg.s1ap_E_RABModifyRequestIEs,
|
||||
&m2->msg.s1ap_E_RABModifyRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_e_rabmodifyresponseies(
|
||||
&m1->msg.s1ap_E_RABModifyResponseIEs,
|
||||
&m2->msg.s1ap_E_RABModifyResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABRelease:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_e_rabreleasecommandies(
|
||||
&m1->msg.s1ap_E_RABReleaseCommandIEs,
|
||||
&m2->msg.s1ap_E_RABReleaseCommandIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_e_rabreleaseresponseies(
|
||||
&m1->msg.s1ap_E_RABReleaseResponseIEs,
|
||||
&m2->msg.s1ap_E_RABReleaseResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABReleaseIndication:
|
||||
ret = s1ap_compare_s1ap_e_rabreleaseindicationies(
|
||||
&m1->msg.s1ap_E_RABReleaseIndicationIEs,
|
||||
&m2->msg.s1ap_E_RABReleaseIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_initialcontextsetuprequesties(
|
||||
&m1->msg.s1ap_InitialContextSetupRequestIEs,
|
||||
&m2->msg.s1ap_InitialContextSetupRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_initialcontextsetupresponseies(
|
||||
&m1->msg.s1ap_InitialContextSetupResponseIEs,
|
||||
&m2->msg.s1ap_InitialContextSetupResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Paging:
|
||||
ret = s1ap_compare_s1ap_pagingies(
|
||||
&m1->msg.s1ap_PagingIEs,
|
||||
&m2->msg.s1ap_PagingIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport:
|
||||
ret = s1ap_compare_s1ap_downlinknastransporties(
|
||||
&m1->msg.s1ap_DownlinkNASTransportIEs,
|
||||
&m2->msg.s1ap_DownlinkNASTransportIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_initialUEMessage:
|
||||
ret = s1ap_compare_s1ap_initialuemessageies(
|
||||
&m1->msg.s1ap_InitialUEMessageIEs,
|
||||
&m2->msg.s1ap_InitialUEMessageIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport:
|
||||
ret = s1ap_compare_s1ap_uplinknastransporties(
|
||||
&m1->msg.s1ap_UplinkNASTransportIEs,
|
||||
&m2->msg.s1ap_UplinkNASTransportIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Reset:
|
||||
ret = s1ap_compare_s1ap_reseties(
|
||||
&m1->msg.s1ap_ResetIEs,
|
||||
&m2->msg.s1ap_ResetIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_ErrorIndication:
|
||||
ret = s1ap_compare_s1ap_errorindicationies(
|
||||
&m1->msg.s1ap_ErrorIndicationIEs,
|
||||
&m2->msg.s1ap_ErrorIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
|
||||
ret = s1ap_compare_s1ap_nasnondeliveryindication_ies(
|
||||
&m1->msg.s1ap_NASNonDeliveryIndication_IEs,
|
||||
&m2->msg.s1ap_NASNonDeliveryIndication_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_s1setuprequesties(
|
||||
&m1->msg.s1ap_S1SetupRequestIEs,
|
||||
&m2->msg.s1ap_S1SetupRequestIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_s1setupresponseies(
|
||||
&m1->msg.s1ap_S1SetupResponseIEs,
|
||||
&m2->msg.s1ap_S1SetupResponseIEs);
|
||||
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_s1setupfailureies(
|
||||
&m1->msg.s1ap_S1SetupFailureIEs,
|
||||
&m2->msg.s1ap_S1SetupFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
|
||||
ret = s1ap_compare_s1ap_uecontextreleaserequesties(
|
||||
&m1->msg.s1ap_UEContextReleaseRequestIEs,
|
||||
&m2->msg.s1ap_UEContextReleaseRequestIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_DownlinkS1cdma2000tunneling:
|
||||
ret = s1ap_compare_s1ap_downlinks1cdma2000tunnelingies(
|
||||
&m1->msg.s1ap_DownlinkS1cdma2000tunnelingIEs,
|
||||
&m2->msg.s1ap_DownlinkS1cdma2000tunnelingIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UplinkS1cdma2000tunneling:
|
||||
ret = s1ap_compare_s1ap_uplinks1cdma2000tunnelingies(
|
||||
&m1->msg.s1ap_UplinkS1cdma2000tunnelingIEs,
|
||||
&m2->msg.s1ap_UplinkS1cdma2000tunnelingIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextModification:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_uecontextmodificationrequesties(
|
||||
&m1->msg.s1ap_UEContextModificationRequestIEs,
|
||||
&m2->msg.s1ap_UEContextModificationRequestIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_uecontextmodificationresponseies(
|
||||
&m1->msg.s1ap_UEContextModificationResponseIEs,
|
||||
&m2->msg.s1ap_UEContextModificationResponseIEs);
|
||||
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_uecontextmodificationfailureies(
|
||||
&m1->msg.s1ap_UEContextModificationFailureIEs,
|
||||
&m2->msg.s1ap_UEContextModificationFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
|
||||
ret = s1ap_compare_s1ap_uecapabilityinfoindicationies(
|
||||
&m1->msg.s1ap_UECapabilityInfoIndicationIEs,
|
||||
&m2->msg.s1ap_UECapabilityInfoIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_uecontextreleasecommandies(
|
||||
&m1->msg.s1ap_UEContextReleaseCommandIEs,
|
||||
&m2->msg.s1ap_UEContextReleaseCommandIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_uecontextreleasecompleteies(
|
||||
&m1->msg.s1ap_UEContextReleaseCompleteIEs,
|
||||
&m2->msg.s1ap_UEContextReleaseCompleteIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_eNBStatusTransfer:
|
||||
ret = s1ap_compare_s1ap_enbstatustransferies(
|
||||
&m1->msg.s1ap_ENBStatusTransferIEs,
|
||||
&m2->msg.s1ap_ENBStatusTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_MMEStatusTransfer:
|
||||
ret = s1ap_compare_s1ap_mmestatustransferies(
|
||||
&m1->msg.s1ap_MMEStatusTransferIEs,
|
||||
&m2->msg.s1ap_MMEStatusTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_DeactivateTrace:
|
||||
ret = s1ap_compare_s1ap_deactivatetraceies(
|
||||
&m1->msg.s1ap_DeactivateTraceIEs,
|
||||
&m2->msg.s1ap_DeactivateTraceIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_TraceStart:
|
||||
ret = s1ap_compare_s1ap_tracestarties(
|
||||
&m1->msg.s1ap_TraceStartIEs,
|
||||
&m2->msg.s1ap_TraceStartIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_TraceFailureIndication:
|
||||
ret = s1ap_compare_s1ap_tracefailureindicationies(
|
||||
&m1->msg.s1ap_TraceFailureIndicationIEs,
|
||||
&m2->msg.s1ap_TraceFailureIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_ENBConfigurationUpdate:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_enbconfigurationupdateies(
|
||||
&m1->msg.s1ap_ENBConfigurationUpdateIEs,
|
||||
&m2->msg.s1ap_ENBConfigurationUpdateIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_enbconfigurationupdateacknowledgeies(
|
||||
&m1->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs,
|
||||
&m2->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_enbconfigurationupdatefailureies(
|
||||
&m1->msg.s1ap_ENBConfigurationUpdateFailureIEs,
|
||||
&m2->msg.s1ap_ENBConfigurationUpdateFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_MMEConfigurationUpdate:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_mmeconfigurationupdateies(
|
||||
&m1->msg.s1ap_MMEConfigurationUpdateIEs,
|
||||
&m2->msg.s1ap_MMEConfigurationUpdateIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_mmeconfigurationupdateacknowledgeies(
|
||||
&m1->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs,
|
||||
&m2->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_mmeconfigurationupdatefailureies(
|
||||
&m1->msg.s1ap_MMEConfigurationUpdateFailureIEs,
|
||||
&m2->msg.s1ap_MMEConfigurationUpdateFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_LocationReportingControl:
|
||||
ret = s1ap_compare_s1ap_locationreportingcontrolies(
|
||||
&m1->msg.s1ap_LocationReportingControlIEs,
|
||||
&m2->msg.s1ap_LocationReportingControlIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_LocationReportingFailureIndication:
|
||||
ret = s1ap_compare_s1ap_locationreportingfailureindicationies(
|
||||
&m1->msg.s1ap_LocationReportingFailureIndicationIEs,
|
||||
&m2->msg.s1ap_LocationReportingFailureIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_LocationReport:
|
||||
ret = s1ap_compare_s1ap_locationreporties(
|
||||
&m1->msg.s1ap_LocationReportIEs,
|
||||
&m2->msg.s1ap_LocationReportIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_OverloadStart:
|
||||
ret = s1ap_compare_s1ap_overloadstarties(
|
||||
&m1->msg.s1ap_OverloadStartIEs,
|
||||
&m2->msg.s1ap_OverloadStartIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_OverloadStop:
|
||||
ret = s1ap_compare_s1ap_overloadstopies(
|
||||
&m1->msg.s1ap_OverloadStopIEs,
|
||||
&m2->msg.s1ap_OverloadStopIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_WriteReplaceWarning:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_writereplacewarningrequesties(
|
||||
&m1->msg.s1ap_WriteReplaceWarningRequestIEs,
|
||||
&m2->msg.s1ap_WriteReplaceWarningRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_writereplacewarningresponseies(
|
||||
&m1->msg.s1ap_WriteReplaceWarningResponseIEs,
|
||||
&m2->msg.s1ap_WriteReplaceWarningResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_eNBDirectInformationTransfer:
|
||||
ret = s1ap_compare_s1ap_enbdirectinformationtransferies(
|
||||
&m1->msg.s1ap_ENBDirectInformationTransferIEs,
|
||||
&m2->msg.s1ap_ENBDirectInformationTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_MMEDirectInformationTransfer:
|
||||
|
||||
ret = s1ap_compare_s1ap_mmedirectinformationtransferies(
|
||||
&m1->msg.s1ap_MMEDirectInformationTransferIEs,
|
||||
&m2->msg.s1ap_MMEDirectInformationTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_PrivateMessage:
|
||||
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
case S1ap_ProcedureCode_id_MMEConfigurationTransfer:
|
||||
AssertFatal(0, "TODO");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_CellTrafficTrace:
|
||||
ret = s1ap_compare_s1ap_celltraffictraceies(
|
||||
&m1->msg.s1ap_CellTrafficTraceIEs,
|
||||
&m2->msg.s1ap_CellTrafficTraceIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Kill:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_killrequesties(
|
||||
&m1->msg.s1ap_KillRequestIEs,
|
||||
&m2->msg.s1ap_KillRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_killresponseies(
|
||||
&m1->msg.s1ap_KillResponseIEs,
|
||||
&m2->msg.s1ap_KillResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_downlinkUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_downlinkueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_uplinkueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_downlinknonueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_uplinknonueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure code %ld", m1->procedureCode);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlAttrPtr attr = NULL;
|
||||
xmlChar *xml_char = NULL;
|
||||
int size = 0;
|
||||
int pos = 0;
|
||||
int go_deeper_in_tree = 1;
|
||||
//S1AP_INFO("%s() mme_ue_s1ap_id %u\n", __FUNCTION__, new_id);
|
||||
|
||||
// modify
|
||||
for (cur_node = (xmlNode *)node; cur_node; cur_node = cur_node->next) {
|
||||
go_deeper_in_tree = 1;
|
||||
if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) {
|
||||
// do not get hidden fields
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"hide");
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"yes"))) {
|
||||
go_deeper_in_tree = 0;
|
||||
}
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
if (0 < go_deeper_in_tree) {
|
||||
// first get size
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"pos");
|
||||
if (NULL != xml_char) {
|
||||
pos = strtoul((const char *)xml_char, NULL, 0);
|
||||
pos -= s1ap->xml_stream_pos_offset;
|
||||
AssertFatal(pos >= 0, "Bad pos %d xml_stream_pos_offset %d", pos, s1ap->xml_stream_pos_offset);
|
||||
xmlFree(xml_char);
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"size");
|
||||
if (NULL != xml_char) {
|
||||
const xmlChar value_d[32];
|
||||
const xmlChar value_h[20];
|
||||
const xmlChar showname[64];
|
||||
int ret = 0;
|
||||
int pos2 = 0;
|
||||
unsigned long int uli = 0;
|
||||
char hex[3] = {0,0,0};
|
||||
char *end_ptr = NULL;
|
||||
|
||||
size = strtoul((const char *)xml_char, NULL, 0);
|
||||
xmlFree(xml_char);
|
||||
// second: try to set value (always hex)
|
||||
ret = snprintf((char *)value_d, 32, "%ld", new_id);
|
||||
AssertFatal((ret > 0) && (ret < 32), "Could not convert int to dec str");
|
||||
ret = snprintf((char *)value_h, 20, "C0%08X", new_id);
|
||||
AssertFatal((ret > 0) && (ret < 20), "Could not convert int to hex str");
|
||||
ret = snprintf((char *)showname, 64, "MME-UE-S1AP-ID: %d", new_id);
|
||||
AssertFatal((ret > 0) && (ret < 64), "Could not convert int to dec str");
|
||||
|
||||
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"value", value_h);
|
||||
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"show", value_d);
|
||||
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"showname", showname);
|
||||
//TODO update s1ap->binary_stream @pos with new_id_hex, size
|
||||
AssertFatal((pos+size) < s1ap->binary_stream_allocated_size, "Rewrite of mme_ue_s1ap_id out of bounds of binary_stream");
|
||||
//avoid endianess issues
|
||||
do {
|
||||
hex[0] = value_h[pos2++];
|
||||
hex[1] = value_h[pos2++];
|
||||
hex[2] = '\0';
|
||||
end_ptr = hex;
|
||||
uli = strtoul(hex, &end_ptr, 16);
|
||||
AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %ld errno %d", hex, uli, errno);
|
||||
s1ap->binary_stream[pos++] = (unsigned char)uli;
|
||||
} while (pos2 < (2*5));
|
||||
// update ASN1
|
||||
et_decode_s1ap(s1ap);
|
||||
//S1AP_INFO("Updated ASN1 for %s\n", showname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 < go_deeper_in_tree) {
|
||||
update_xpath_node_mme_ue_s1ap_id(s1ap, cur_node->children, new_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update_xpath_nodes:
|
||||
* @nodes: the nodes set.
|
||||
* @value: the new value for the node(s)
|
||||
*
|
||||
* Prints the @nodes content to @output.
|
||||
* From http://www.xmlsoft.org/examples/#xpath2.c
|
||||
*/
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id)
|
||||
{
|
||||
int size = 0;
|
||||
int i = 0;
|
||||
xmlNode *s1ap_node = NULL;
|
||||
|
||||
size = (nodes) ? nodes->nodeNr : 0;
|
||||
//S1AP_DEBUG("%s() num nodes %u\n", __FUNCTION__, size);
|
||||
|
||||
/*
|
||||
* NOTE: the nodes are processed in reverse order, i.e. reverse document
|
||||
* order because xmlNodeSetContent can actually free up descendant
|
||||
* of the node and such nodes may have been selected too ! Handling
|
||||
* in reverse order ensure that descendant are accessed first, before
|
||||
* they get removed. Mixing XPath and modifications on a tree must be
|
||||
* done carefully !
|
||||
*/
|
||||
for(i = size - 1; i >= 0; i--) {
|
||||
s1ap_node = nodes->nodeTab[i];
|
||||
AssertFatal(NULL != s1ap_node, "One element of resultset of XPATH expression is NULL\n");
|
||||
update_xpath_node_mme_ue_s1ap_id(s1ap_payload, s1ap_node, new_id);
|
||||
/*
|
||||
* All the elements returned by an XPath query are pointers to
|
||||
* elements from the tree *except* namespace nodes where the XPath
|
||||
* semantic is different from the implementation in libxml2 tree.
|
||||
* As a result when a returned node set is freed when
|
||||
* xmlXPathFreeObject() is called, that routine must check the
|
||||
* element type. But node from the returned set may have been removed
|
||||
* by xmlNodeSetContent() resulting in access to freed data.
|
||||
* This can be exercised by running valgrind
|
||||
* There is 2 ways around it:
|
||||
* - make a copy of the pointers to the nodes from the result set
|
||||
* then call xmlXPathFreeObject() and then modify the nodes
|
||||
* or
|
||||
* - remove the reference to the modified nodes from the node set
|
||||
* as they are processed, if they are not namespace nodes.
|
||||
*/
|
||||
if (nodes->nodeTab[i]->type != XML_NAMESPACE_DECL) {
|
||||
nodes->nodeTab[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id)
|
||||
{
|
||||
|
||||
|
||||
xmlChar xpath_expression[ET_XPATH_EXPRESSION_MAX_LENGTH];
|
||||
int ret = 0;
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlXPathContextPtr xpath_ctx = NULL;
|
||||
xmlXPathObjectPtr xpath_obj = NULL;
|
||||
|
||||
//S1AP_DEBUG("%s() packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n", __FUNCTION__, packet->packet_number, packet->original_frame_number, old_id, new_id);
|
||||
|
||||
ret = snprintf(xpath_expression, ET_XPATH_EXPRESSION_MAX_LENGTH, "//field[@name=\"s1ap.MME_UE_S1AP_ID\"][@show=\"%u\"]", old_id);
|
||||
AssertFatal((ret > 0) && (ret < ET_XPATH_EXPRESSION_MAX_LENGTH), "Could not build XPATH expression err=%d", ret);
|
||||
|
||||
doc = packet->sctp_hdr.u.data_hdr.payload.doc;
|
||||
// Create xpath evaluation context
|
||||
xpath_ctx = xmlXPathNewContext(doc);
|
||||
if(xpath_ctx == NULL) {
|
||||
fprintf(stderr,"Error: unable to create new XPath context\n");
|
||||
xmlFreeDoc(doc);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Evaluate xpath expression
|
||||
xpath_obj = xmlXPathEvalExpression(xpath_expression, xpath_ctx);
|
||||
xmlXPathFreeContext(xpath_ctx);
|
||||
AssertFatal(xpath_obj != NULL, "Unable to evaluate XPATH expression \"%s\"\n", xpath_expression);
|
||||
|
||||
if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)){
|
||||
xmlXPathFreeObject(xpath_obj);
|
||||
S1AP_DEBUG("%s() No match \"%s\"packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n",
|
||||
__FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id);
|
||||
return -1;
|
||||
}
|
||||
// update selected nodes
|
||||
update_xpath_nodes_mme_ue_s1ap_id(&packet->sctp_hdr.u.data_hdr.payload, xpath_obj->nodesetval, new_id);
|
||||
|
||||
// Cleanup of XPath data
|
||||
xmlXPathFreeObject(xpath_obj);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "queue.h"
|
||||
#include "tree.h"
|
||||
|
||||
#include "sctp_eNB_defs.h"
|
||||
|
||||
#ifndef PLAY_SCENARIO_S1AP_ENB_DEFS_H_
|
||||
#define PLAY_SCENARIO_S1AP_ENB_DEFS_H_
|
||||
|
||||
#define ENB_TAC (1)
|
||||
#define ENB_MCC (208)
|
||||
#define ENB_MNC (92)
|
||||
|
||||
#define ENB_NAME "Eurecom ENB"
|
||||
#define ENB_NAME_FORMAT (ENB_NAME" %u")
|
||||
|
||||
#define S1AP_PORT_NUMBER (36412)
|
||||
#define S1AP_SCTP_PPID (18)
|
||||
|
||||
#define X2AP_PORT_NUMBER (36422)
|
||||
#define X2AP_SCTP_PPID (27)
|
||||
|
||||
#define S1AP_ENB_NAME_LENGTH_MAX (150)
|
||||
|
||||
typedef enum {
|
||||
/* Disconnected state: initial state for any association. */
|
||||
S1AP_ENB_STATE_DISCONNECTED = 0x0,
|
||||
/* State waiting for S1 Setup response message if eNB is MME accepted or
|
||||
* S1 Setup failure if MME rejects the eNB.
|
||||
*/
|
||||
S1AP_ENB_STATE_WAITING = 0x1,
|
||||
/* The eNB is successfully connected to MME, UE contexts can be created. */
|
||||
S1AP_ENB_STATE_CONNECTED = 0x2,
|
||||
/* The MME has sent an overload start message. Once the MME disables the
|
||||
* OVERLOAD marker, the state of the association will be
|
||||
* S1AP_ENB_STATE_CONNECTED.
|
||||
*/
|
||||
S1AP_ENB_OVERLOAD = 0x3,
|
||||
/* Max number of states available */
|
||||
S1AP_ENB_STATE_MAX,
|
||||
} s1ap_eNB_state_t;
|
||||
|
||||
|
||||
/* If the Overload Action IE in the OVERLOAD START message is set to
|
||||
* - “reject all RRC connection establishments for non-emergency mobile
|
||||
* originated data transfer “ (i.e. reject traffic corresponding to RRC cause
|
||||
* “mo-data “ (TS 36.331 [16])), or
|
||||
* - “reject all RRC connection establishments for signalling “ (i.e. reject
|
||||
* traffic corresponding to RRC cause “modata” and “mo-signalling”
|
||||
* (TS 36.331 [16])),or
|
||||
* - “only permit RRC connection establishments for emergency sessions and
|
||||
* mobile terminated services” (i.e. only permit traffic corresponding to RRC
|
||||
* cause “emergency” and “mt-Access” (TS 36.331 [16])).
|
||||
*
|
||||
* NOTE: When the Overload Action IE is set to “only permit RRC connection
|
||||
* establishments for emergency sessions and mobile terminated services”,
|
||||
* emergency calls with RRC cause “highPriorityAcess” from high priority users
|
||||
* are rejected (TS 24.301 [24]).
|
||||
*/
|
||||
typedef enum {
|
||||
S1AP_OVERLOAD_REJECT_MO_DATA = 0x0,
|
||||
S1AP_OVERLOAD_REJECT_ALL_SIGNALLING = 0x1,
|
||||
S1AP_OVERLOAD_ONLY_EMERGENCY_AND_MT = 0x2,
|
||||
S1AP_NO_OVERLOAD = 0x3,
|
||||
S1AP_OVERLOAD_MAX,
|
||||
} s1ap_overload_state_t;
|
||||
|
||||
/* Served PLMN identity element */
|
||||
struct plmn_identity_s {
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_digit_length;
|
||||
STAILQ_ENTRY(plmn_identity_s) next;
|
||||
};
|
||||
|
||||
/* Served group id element */
|
||||
struct served_group_id_s {
|
||||
uint16_t mme_group_id;
|
||||
STAILQ_ENTRY(served_group_id_s) next;
|
||||
};
|
||||
|
||||
/* Served mme code for a particular MME */
|
||||
struct mme_code_s {
|
||||
uint8_t mme_code;
|
||||
STAILQ_ENTRY(mme_code_s) next;
|
||||
};
|
||||
|
||||
/* Served gummei element */
|
||||
struct served_gummei_s {
|
||||
/* Number of MME served PLMNs */
|
||||
uint8_t nb_served_plmns;
|
||||
/* List of served PLMNs by MME */
|
||||
STAILQ_HEAD(served_plmns_s, plmn_identity_s) served_plmns;
|
||||
|
||||
/* Number of group id in list */
|
||||
uint8_t nb_group_id;
|
||||
/* Served group id list */
|
||||
STAILQ_HEAD(served_group_ids_s, served_group_id_s) served_group_ids;
|
||||
|
||||
/* Number of MME code */
|
||||
uint8_t nb_mme_code;
|
||||
/* MME Code to uniquely identify an MME within an MME pool area */
|
||||
STAILQ_HEAD(mme_codes_s, mme_code_s) mme_codes;
|
||||
|
||||
/* Next GUMMEI element */
|
||||
STAILQ_ENTRY(served_gummei_s) next;
|
||||
};
|
||||
|
||||
struct s1ap_eNB_instance_s;
|
||||
|
||||
/* This structure describes association of a eNB to a MME */
|
||||
typedef struct s1ap_eNB_mme_data_s {
|
||||
/* MME descriptors tree, ordered by sctp assoc id */
|
||||
RB_ENTRY(s1ap_eNB_mme_data_s) entry;
|
||||
|
||||
/* This is the optional name provided by the MME */
|
||||
char *mme_name;
|
||||
net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets
|
||||
|
||||
/* List of served GUMMEI per MME. There is one GUMMEI per RAT with a max
|
||||
* number of 8 RATs but in our case only one is used. The LTE related pool
|
||||
* configuration is included on the first place in the list.
|
||||
*/
|
||||
STAILQ_HEAD(served_gummeis_s, served_gummei_s) served_gummei;
|
||||
|
||||
/* Relative processing capacity of an MME with respect to the other MMEs
|
||||
* in the pool in order to load-balance MMEs within a pool as defined
|
||||
* in TS 23.401.
|
||||
*/
|
||||
uint8_t relative_mme_capacity;
|
||||
|
||||
/* Current MME overload information (if any). */
|
||||
s1ap_overload_state_t overload_state;
|
||||
/* Current eNB->MME S1AP association state */
|
||||
s1ap_eNB_state_t state;
|
||||
|
||||
/* Next usable stream for UE signalling */
|
||||
int32_t nextstream;
|
||||
|
||||
/* Number of input/ouput streams */
|
||||
uint16_t in_streams;
|
||||
uint16_t out_streams;
|
||||
|
||||
/* Connexion id used between SCTP/S1AP */
|
||||
uint16_t cnx_id;
|
||||
|
||||
/* SCTP association id */
|
||||
int32_t assoc_id;
|
||||
|
||||
/* Only meaningfull in virtual mode */
|
||||
struct s1ap_eNB_instance_s *s1ap_eNB_instance;
|
||||
} s1ap_eNB_mme_data_t;
|
||||
|
||||
typedef struct s1ap_eNB_instance_s {
|
||||
/* Next s1ap eNB association.
|
||||
* Only used for virtual mode.
|
||||
*/
|
||||
STAILQ_ENTRY(s1ap_eNB_instance_s) s1ap_eNB_entries;
|
||||
|
||||
/* Number of MME requested by eNB (tree size) */
|
||||
uint32_t s1ap_mme_nb;
|
||||
/* Number of MME for which association is pending */
|
||||
uint32_t s1ap_mme_pending_nb;
|
||||
/* Number of MME successfully associated to eNB */
|
||||
uint32_t s1ap_mme_associated_nb;
|
||||
/* Tree of S1AP MME associations ordered by association ID */
|
||||
RB_HEAD(s1ap_mme_map, s1ap_eNB_mme_data_s) s1ap_mme_head;
|
||||
|
||||
/* TODO: add a map ordered by relative MME capacity */
|
||||
|
||||
/* Tree of UE ordered by eNB_ue_s1ap_id's */
|
||||
RB_HEAD(s1ap_ue_map, s1ap_eNB_ue_context_s) s1ap_ue_head;
|
||||
|
||||
/* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */
|
||||
instance_t instance;
|
||||
|
||||
/* Displayable name of eNB */
|
||||
char *eNB_name;
|
||||
net_ip_address_t s1c_net_ip_address;
|
||||
|
||||
/* Unique eNB_id to identify the eNB within EPC.
|
||||
* In our case the eNB is a macro eNB so the id will be 20 bits long.
|
||||
* For Home eNB id, this field should be 28 bits long.
|
||||
*/
|
||||
uint32_t eNB_id;
|
||||
/* The type of the cell */
|
||||
enum cell_type_e cell_type;
|
||||
|
||||
/* Tracking area code */
|
||||
uint16_t tac;
|
||||
|
||||
/* Mobile Country Code
|
||||
* Mobile Network Code
|
||||
*/
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_digit_length;
|
||||
|
||||
} s1ap_eNB_instance_t;
|
||||
|
||||
typedef struct {
|
||||
/* List of served eNBs
|
||||
* Only used for virtual mode
|
||||
*/
|
||||
STAILQ_HEAD(s1ap_eNB_instances_head_s, s1ap_eNB_instance_s) s1ap_eNB_instances_head;
|
||||
/* Nb of registered eNBs */
|
||||
uint8_t nb_registered_eNBs;
|
||||
|
||||
/* Generate a unique connexion id used between S1AP and SCTP */
|
||||
uint16_t global_cnx_id;
|
||||
} s1ap_eNB_internal_data_t;
|
||||
|
||||
int s1ap_eNB_compare_assoc_id(
|
||||
struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2);
|
||||
|
||||
/* Generate the tree management functions */
|
||||
RB_PROTOTYPE(s1ap_mme_map, s1ap_eNB_mme_data_s, entry,
|
||||
s1ap_eNB_compare_assoc_id);
|
||||
|
||||
#endif /* PLAY_SCENARIO_S1AP_ENB_DEFS_H_ */
|
||||
@@ -0,0 +1,112 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
OpenAirInterface is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
play_scenario_sctp.c
|
||||
-------------------
|
||||
AUTHOR : Lionel GAUTHIER
|
||||
COMPANY : EURECOM
|
||||
EMAIL : Lionel.Gauthier@eurecom.fr
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "play_scenario.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints)
|
||||
{
|
||||
asn_comp_rval_t *rv = NULL;
|
||||
// no comparison for ports
|
||||
if (sctp1->ppid != sctp2->ppid) {
|
||||
S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID;
|
||||
return rv;
|
||||
}
|
||||
if (sctp1->assoc_id != sctp2->assoc_id) {
|
||||
S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID;
|
||||
return rv;
|
||||
}
|
||||
if (sctp1->stream != sctp2->stream) {
|
||||
if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) {
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID;
|
||||
return rv;
|
||||
} else {
|
||||
S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream);
|
||||
}
|
||||
}
|
||||
// We do not have SSN from lower layers
|
||||
// if (sctp1->ssn != sctp2->ssn) {
|
||||
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
|
||||
// rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
|
||||
// return rv;
|
||||
// } else {
|
||||
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
|
||||
// }
|
||||
// }
|
||||
return et_s1ap_is_matching(&sctp1->payload, &sctp2->payload, constraints);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints)
|
||||
{
|
||||
// no comparison for ports
|
||||
asn_comp_rval_t *rv = NULL;
|
||||
if (sctp1->chunk_type != sctp2->chunk_type){
|
||||
S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE;
|
||||
return rv;
|
||||
}
|
||||
switch (sctp1->chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints);
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
AssertFatal(0, "Not needed now");
|
||||
break;
|
||||
case SCTP_CID_INIT_ACK:
|
||||
AssertFatal(0, "Not needed now");
|
||||
break;
|
||||
default:
|
||||
AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -275,7 +275,6 @@ do { \
|
||||
(bITsTRING)->size = 3; \
|
||||
(bITsTRING)->bits_unused = 4; \
|
||||
} while(0)
|
||||
/*
|
||||
/* TS 36.413 v10.9.0 section 9.2.1.38:
|
||||
* E-UTRAN CGI/Cell Identity
|
||||
* The leftmost bits of the Cell
|
||||
|
||||
@@ -412,7 +412,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_LMS_DCOFF_I,offIold);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
|
||||
switch (i&3) {
|
||||
@@ -438,7 +438,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_LMS_DCOFF_I,offI);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
switch (i&3) {
|
||||
@@ -474,7 +474,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
switch (i&3) {
|
||||
@@ -503,7 +503,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_LMS_DCOFF_Q,offQold);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on fs/4
|
||||
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -530,7 +530,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_LMS_DCOFF_Q,offQ);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
switch (i&3) {
|
||||
@@ -568,7 +568,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
switch (i&3) {
|
||||
@@ -601,7 +601,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_FPGA_PHASE,offphaseold);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on fs/8 (Image of TX signal in +ve frequencies)
|
||||
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -618,7 +618,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_FPGA_PHASE,offphase);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on fs/8 (Image of TX signal in +ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -648,7 +648,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on fs/8 (Image of TX signal in +ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -670,7 +670,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_FPGA_GAIN,offgainold);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on fs/8 (Image of TX signal in +ve frequencies)
|
||||
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -687,7 +687,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_TX,BLADERF_CORR_FPGA_GAIN,offgain);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on fs/8 (Image of TX signal in +ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -716,7 +716,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on fs/8 (Image of TX signal in +ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -741,7 +741,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_RX,BLADERF_CORR_FPGA_PHASE,offphaseold);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on -3fs/8 (Image of TX signal in -ve frequencies)
|
||||
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -758,7 +758,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_RX,BLADERF_CORR_FPGA_PHASE,offphase);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on -3fs/8 (Image of TX signal in -ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -788,7 +788,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on -3fs/8 (Image of TX signal in -ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -810,7 +810,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_RX,BLADERF_CORR_FPGA_GAIN,offgainold);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0,0);
|
||||
}
|
||||
// project on -3fs/8 (Image of TX signal in +ve frequencies)
|
||||
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -827,7 +827,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
bladerf_set_correction(brf->dev,BLADERF_MODULE_RX,BLADERF_CORR_FPGA_GAIN,offgain);
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on 3fs/8 (Image of TX signal in -ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -856,7 +856,7 @@ void calibrate_rf(openair0_device *device) {
|
||||
|
||||
for (i=0;i<10;i++) {
|
||||
trx_brf_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0);
|
||||
trx_brf_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
|
||||
}
|
||||
// project on -3fs/8 (Image of TX signal in -ve frequencies)
|
||||
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
|
||||
@@ -1068,7 +1068,6 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
bladerf_log_set_verbosity(get_brf_log_level(openair0_cfg->log_level));
|
||||
|
||||
printf("BLADERF: Initializing openair0_device\n");
|
||||
device->priv = brf;
|
||||
device->Mod_id = num_devices++;
|
||||
device->type = BLADERF_DEV;
|
||||
device->trx_start_func = trx_brf_start;
|
||||
@@ -1081,6 +1080,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
device->trx_set_freq_func = trx_brf_set_freq;
|
||||
device->trx_set_gains_func = trx_brf_set_gains;
|
||||
device->openair0_cfg = openair0_cfg;
|
||||
device->priv = (void *)brf;
|
||||
|
||||
calibrate_rf(device);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,171 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "93";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
frame_type = "FDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 13;
|
||||
downlink_frequency = 751000000L;
|
||||
uplink_frequency_offset = 31000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 50;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 125;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -20;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -90;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -96;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -108;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.11";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,171 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "93";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
frame_type = "FDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 13;
|
||||
downlink_frequency = 751000000L;
|
||||
uplink_frequency_offset = 31000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 107;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -17;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -90;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -96;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -108;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.11";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -31,12 +31,12 @@ eNBs =
|
||||
downlink_frequency = 751000000L;
|
||||
uplink_frequency_offset = 31000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
N_RB_DL = 50;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 100;
|
||||
rx_gain = 110;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
@@ -64,7 +64,7 @@ eNBs =
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -86;
|
||||
pusch_p0_Nominal = -90;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -96;
|
||||
msg3_delta_Preamble = 6;
|
||||
@@ -82,7 +82,7 @@ eNBs =
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -108;
|
||||
rach_preambleInitialReceivedTargetPower = -100;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
@@ -133,7 +133,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.62";
|
||||
mme_ip_address = ( { ipv4 = "172.27.8.52";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -142,11 +142,11 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth4";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.242/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "172.27.8.51/23";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth4";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.242/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "172.27.8.51/23";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
@@ -168,4 +168,4 @@ eNBs =
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
}
|
||||
);
|
||||
);
|
||||
@@ -0,0 +1,146 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "10";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
frame_type = "TDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 38;
|
||||
downlink_frequency = 2580000000L;
|
||||
uplink_frequency_offset = 0;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 25;
|
||||
rx_gain = 20;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = 0;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 0;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -108;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -108;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 2;
|
||||
rach_preambleInitialReceivedTargetPower = -100;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
}
|
||||
);
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "0.0.0.0";
|
||||
ipv6 = "0::0";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "none";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "none";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="trace";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="trace";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="trace";
|
||||
mac_log_verbosity ="medium";
|
||||
rlc_log_level ="trace";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="trace";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="trace";
|
||||
rrc_log_verbosity ="medium";
|
||||
gtpu_log_level ="debug";
|
||||
gtpu_log_verbosity ="medium";
|
||||
udp_log_level ="debug";
|
||||
udp_log_verbosity ="medium";
|
||||
osa_log_level ="debug";
|
||||
osa_log_verbosity ="low";
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
@@ -17,7 +17,7 @@ eNBs =
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "93";
|
||||
mobile_network_code = "95";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
@@ -132,7 +132,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.171";
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.62";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
|
||||
@@ -150,7 +150,7 @@ rrh_gw_config = (
|
||||
rrh_gw_active = "yes";
|
||||
tr_preference = "raw";
|
||||
rf_preference = "usrp_b200";
|
||||
iq_txshift = 5;
|
||||
iq_txshift = 4;
|
||||
tx_sample_advance = 113;
|
||||
tx_scheduling_advance = 9;
|
||||
|
||||
@@ -163,8 +163,6 @@ rrh_gw_config = (
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth4";
|
||||
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
@@ -140,10 +140,10 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.213/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.215/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.213/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.215/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
|
||||
@@ -145,14 +145,14 @@ rrh_gw_config = (
|
||||
local_if_name = "eth0";
|
||||
#remote_address = "169.254.10.158";
|
||||
#local_address = "169.254.8.15";
|
||||
remote_address = "74:d4:35:cc:88:d1"; #bourdon
|
||||
local_address = "74:d4:35:cc:8d:15"; #papillon
|
||||
remote_address = "74:d4:35:cc:88:e3";
|
||||
local_address = "74:d4:35:cc:88:d1";
|
||||
local_port = 50000; #for raw option local port must be the same to remote
|
||||
remote_port = 50000;
|
||||
rrh_gw_active = "yes";
|
||||
tr_preference = "raw";
|
||||
rf_preference = "usrp_b200";
|
||||
iq_txshift = 5;
|
||||
iq_txshift = 4;
|
||||
tx_sample_advance = 70;
|
||||
tx_scheduling_advance = 9;
|
||||
|
||||
@@ -161,12 +161,10 @@ rrh_gw_config = (
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.215/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth3";
|
||||
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.215/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ eNBs =
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "93";
|
||||
mobile_network_code = "95";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
@@ -28,7 +28,7 @@ eNBs =
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 7;
|
||||
downlink_frequency = 2660000000L;
|
||||
downlink_frequency = 2685000000L;
|
||||
uplink_frequency_offset = -120000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
@@ -133,7 +133,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.11";
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.211";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
|
||||
@@ -130,10 +130,12 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( {ipv4 = "192.170.0.1";
|
||||
ipv6="192:168:30::17";
|
||||
active="yes";
|
||||
preference="ipv4";});
|
||||
mme_ip_address = ( { ipv4 = "192.170.0.1";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
@@ -141,6 +143,7 @@ eNBs =
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.170.0.2/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0:4";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.170.1.2/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.170.0.2/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user