Commit d209fe5d authored by Aikaterini's avatar Aikaterini

merge develop into branch

parents 064c8880 acd607fa
job1:
script:
- echo $PWD
- echo $USER
- echo $OAI_USER
- echo $OAI_EXTRA_ARGS
- echo $NFS_SHARE_DIR
- echo $EXTERNAL_SHARE_DIR
- echo $SHELL
- git rev-parse --abbrev-ref HEAD
- git_head=`git rev-parse HEAD`
- echo $git_head
- tmp=`git show-ref --head | grep $git_head`
- tmp=(${tmp///// })
- git_branch=${tmp[@]:(-1)}
- echo $git_branch
- source oaienv
- echo $OPENAIR_DIR
- NFS_TEST_RESULTS_DIR=$NFS_SHARE_DIR/$git_branch/$git_head
- EXTERNAL_SHARE_RESULTS_DIR=$EXTERNAL_SHARE_DIR/$git_branch/$git_head
- echo $NFS_TEST_RESULTS_DIR
- echo $EXTERNAL_SHARE_RESULTS_DIR
- 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
- 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
- sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $EXTERNAL_SHARE_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$EXTERNAL_SHARE_DIR
- cat $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml
......@@ -133,9 +133,6 @@ else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
if (CPUINFO MATCHES "avx2")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx2")
endif()
if (CPUINFO MATCHES "sse4_2")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.2")
endif()
if (CPUINFO MATCHES "sse4_1")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.1")
endif()
......@@ -149,8 +146,8 @@ set(C_FLAGS_PROCESSOR " ${C_FLAGS_PROCESSOR} ${CFLAGS_PROCESSOR_USER}")
Message("C_FLAGS_PROCESSOR is ${C_FLAGS_PROCESSOR}")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
if ( (NOT( C_FLAGS_PROCESSOR MATCHES "ssse3")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.1")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.2")) )
Message(FATAL_ERROR "For x86 Architecture, you must have following flags: -mssse3 -msse4.1 -msse4.2. The current detected flags are: ${C_FLAGS_PROCESSOR}. You can pass the flags manually in build script, for example: ./build_oai --cflags_processor \"-mssse3 -msse4.1 -msse4.2\" ")
if ( (NOT( C_FLAGS_PROCESSOR MATCHES "ssse3")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.1")) )
Message(FATAL_ERROR "For x86 Architecture, you must have following flags: -mssse3 -msse4.1. The current detected flags are: ${C_FLAGS_PROCESSOR}. You can pass the flags manually in build script, for example: ./build_oai --cflags_processor \"-mssse3 -msse4.1\" ")
endif()
endif()
......@@ -252,6 +249,9 @@ endif (${RTAI})
set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1")
set(asn1_generated_dir ${OPENAIR_BIN_DIR})
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
# RRC
######
add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA")
......@@ -491,6 +491,7 @@ elseif (${RF_BOARD} STREQUAL "CPRIGW") #to ask
endif (${RF_BOARD} STREQUAL "EXMIMO")
if (${TRANSP_PRO} STREQUAL "ETHERNET")
include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB")
......@@ -501,12 +502,15 @@ if (${TRANSP_PRO} STREQUAL "ETHERNET")
)
set(option_TP_lib "-rdynamic -ldl")
set(LOWLATENCY True)
endif (${TRANSP_PRO} STREQUAL "ETHERNET")
##########################################################
include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
Message("LOWLATENCY flag is ${LOWLATENCY}")
##############################################################
# ???!!! TO BE DOCUMENTED OPTIONS !!!???
##############################################################
......@@ -514,6 +518,7 @@ add_boolean_option(ENABLE_SECURITY True "Enable LTE integrity and ciphe
add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB")
add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
add_boolean_option(USER_MODE True "????")
add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer")
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
add_boolean_option(DISABLE_USE_NAS False "???")
......@@ -527,6 +532,9 @@ add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name")
add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequence diagrams")
add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams")
add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams")
add_boolean_option(ENB_AGENT True "enable eNB agent to inteface with a SDN contrller")
########################
# Include order
##########################
......@@ -741,6 +749,56 @@ include_directories("${OPENAIR_DIR}")
# Utilities Library
################
if (ENB_AGENT)
# set the version of protobuf messages, V3 not supported yet
add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3)
if (${PRPT_VERSION} STREQUAL "V2")
set (PRPTDIR V2)
elseif (${PRPT_VERSION} STREQUAL "V3")
set (PRPTDIR V3)
endif(${PRPT_VERSION} STREQUAL "V2")
set(PRPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${PRPTDIR} )
set(PRPT_MSG_FILES
${PRPT_MSG_DIR}/header.proto
${PRPT_MSG_DIR}/progran.proto
${PRPT_MSG_DIR}/stats_common.proto
${PRPT_MSG_DIR}/stats_messages.proto
)
set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR})
message("calling ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}")
execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES})
file(GLOB PRPT_source ${PRPT_C_DIR}/*.c)
set(PRPT_OAI_generated
${PRPT_C_DIR}/header.pb-c.c
${PRPT_C_DIR}/progran.pb-c.c
${PRPT_C_DIR}/stats_common.pb-c.c
${PRPT_C_DIR}/stats_messages.pb-c.c
)
file(GLOB prpt_h ${PRPT_C_DIR}/*.h)
set(prpt_h ${prpt_h} )
add_library(PRPT_MSG
${PRPT_OAI_generated}
${PRPT_source}
)
include_directories ("${PRPT_C_DIR}")
add_library(ASYNC_IF
${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
)
set(ASYNC_IF_LIB ASYNC_IF)
include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
endif()
add_library(HASHTABLE
${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c
${OPENAIR_DIR}/common/utils/collection/hashtable/obj_hashtable.c
......@@ -1648,7 +1706,7 @@ add_executable(oaisim_nos1
target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim_nos1
-Wl,--start-group
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${ASYNC_IF_LIB}
-Wl,--end-group )
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
......
This diff is collapsed.
This diff is collapsed.
#******************************************************************************
# Eurecom OpenAirInterface
# Copyright(c) 1999 - 2013 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,
# version 2, as published by the Free Software Foundation.
# This program is distributed in the hope 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
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
# Contact Information
# Openair Admin: openair_admin@eurecom.fr
# Openair Tech : openair_tech@eurecom.fr
# Forums : http://forums.eurecom.fsr/openairinterface
# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France
#*****************************************************************************
# \file log.py
# \brief provides primitives and defines how the logs and statistics are generated
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import sys
import re
import time
import datetime
import array
import xml.etree.ElementTree as ET
debug = False
docfile = ''
start_time = time.time()
testcase_starttime = start_time
debug = 0
stats = {'passed':0, 'failed':0, 'skipped':0, 'internal_errors':0, 'cmd':0}
# xml result (jUnit like)
xUnitTestsuites = ET.Element( 'testsuites' )
xUnitTestsuite = ET.SubElement( xUnitTestsuites, 'testsuite' )
xUnitTestsuite.set( 'name', 'OAI' )
xUnitTestsuite.set( 'timestamp', datetime.datetime.fromtimestamp(start_time).strftime('%Y-%m-%dT%H:%M:%S') )
xUnitTestsuite.set( 'hostname', 'localhost' )
#xUnitSystemOut = ET.SubElement( xUnitTestsuite, 'system-out' )
class bcolors:
header = '\033[95m'
okblue = '\033[94m'
okgreen = '\033[92m'
warning = '\033[93m'
fail = '\033[91m'
normal = '\033[0m'
def __init__(self):
if not sys.stdout.isatty():
self.disable()
def disable(self):
self.header = ''
self.okblue = ''
self.okgreen = ''
self.warning = ''
self.fail = ''
self.normal = ''
class err(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def writefile(logfile, message):
F_testlog = open(logfile, 'a')
F_testlog.write(message + '\n')
F_testlog.close()
def sleep(seconds):
time.sleep(seconds)
def start():
"""Start the timer for the following testcase."""
global testcase_starttime
testcase_starttime = time.time()
def set_debug_level(level):
debug = level
def statistics(logfile):
global start_time
#if stats['passed'] == 0:
# print "no test executed...exiting"
# sys.exit()
total_tests = stats['passed'] + stats['failed'] + stats['skipped']
total_ex_tests = stats['passed'] + stats['failed']
elapsed_time = time.gmtime(time.time() - start_time)
print '\n'
log_record('info', '===============================================')
log_record('info', 'Total tests performed ' + repr(total_tests))
log_record('info', 'Tests passed ' + repr(stats['passed']))
log_record('info', 'Tests failed ' + repr(stats['failed']))
log_record('info', 'Tests skipped ' + repr(stats['skipped']))
log_record('info', '')
log_record('info', 'Total commands sent ' + repr(stats['cmd']))
log_record('info', 'Total elapsed time (h:m:s) ' + time.strftime('%H:%M:%S', elapsed_time))
log_record('info', '===============================================')
log_record('info', 'Testing pass rate ' + repr((stats['passed'] * 100) / total_tests) + '%')
log_record('info', '===============================================')
writefile(logfile, '\n=====================Results===================')
writefile(logfile, 'Total tests performed ' + repr(total_tests))
writefile(logfile, 'Tests passed ' + repr(stats['passed']))
writefile(logfile, 'Tests failed ' + repr(stats['failed']))
writefile(logfile, 'Tests skipped ' + repr(stats['skipped']))
writefile(logfile, '')
writefile(logfile, 'Total commands sent ' + repr(stats['cmd']))
writefile(logfile, 'Total elapsed time (h:m:s) ' + time.strftime('%H:%M:%S', elapsed_time))
writefile(logfile, '===============================================')
writefile(logfile, 'Testing pass rate ' + repr((stats['passed'] * 100) / total_tests) + '%')
writefile(logfile, '===============================================\n')
xUnitTestsuite.set( 'tests', repr(total_tests) )
xUnitTestsuite.set( 'failures', repr(stats['failed']) )
xUnitTestsuite.set( 'skipped', repr(stats['skipped']) )
xUnitTestsuite.set( 'errors', '0' )
time_delta = datetime.datetime.now() - datetime.datetime.fromtimestamp(start_time)
xUnitTestsuite.set( 'time', repr(time_delta.total_seconds()) )
writefile( logfile + '.xml', ET.tostring( xUnitTestsuites, encoding="utf-8", method="xml" ) )
def log_record(level, message):
ts = time.strftime('%d %b %Y %H:%M')
message = ts + ' [' + level + '] ' + message
if level == 'passed' :
print bcolors.okgreen + message + bcolors.normal
elif level == 'failed' :
print bcolors.fail + message + bcolors.normal
elif level == 'skipped' :
print bcolors.warning + message + bcolors.normal
else :
print message
def fail(case, testnum, testname, conf, message, diag, output,trace):
# report(case, testnum, testname, conf, 'failed', output, diag, message)
report(case, testnum, testname, conf, 'failed', output, diag)
log_record('failed', case + testnum + ' : ' + testname + ' ('+ conf+')')
if message :
log_record('failed', "Output follows:\n" + message )
if trace :
log_record('failed', "trace file can be found in " + trace + "\n" )
stats['failed'] += 1
def failquiet(case, testnum, testname, conf):
log_record('failed', case + testnum + ' :' + testname + ' ('+ conf+')')
stats['failed'] += 1
def ok(case, testnum, testname, conf, message, output):
report(case, testnum, testname, conf, 'passed', output)
log_record('passed', case + testnum + ' : ' + testname + ' ('+ conf+')')
if message :
print bcolors.okgreen + message + bcolors.normal
stats['passed'] += 1
def skip(case, testnum, testname, conf, message=None, diag=None, output=None):
log_record('skipped', case + testnum + ' :' + testname + ' ('+ conf+')')
report(case, testnum, testname, conf, 'skipped', output, diag)
if message :
log_record('skipped', "Output follows:\n" + message )
if diag :
log_record('skipped', "Diagnostic: \n" + diag )
stats['skipped'] += 1
def report(case, test, name, conf, status, output, diag=None, desc=None):
writefile (output, '[' +status+ '] ' + case + test + ' : ' + name + ' ('+ conf+')')
if diag :
writefile (output, '-------> ' + diag)
if desc:
writefile(output, desc)
#log_record('report', + case + test + ' documented')
e = ET.SubElement( xUnitTestsuite, 'testcase' )
e.set( 'name', case + '_' + test + '_' + name )
e.set( 'classname', 'shellscript' )
e.set( 'time', repr( time.time() - testcase_starttime ) )
if status == 'failed':
e = ET.SubElement( e, 'failure' )
e.set( 'message', 'failed' )
e.text = diag
if status == 'skipped':
e = ET.SubElement( e, 'skipped' )
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/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)
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(2,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 ('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='BandRich, Inc. 4G LTE adapter'
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 usb_dir
cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 5" )
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 5" )
def read_file(filename):
try:
file = open(filename, 'r')
return file.read()
except Exception, e:
#error = ' Filename ' + filename
#error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
#error = error + traceback.format_exc()
#print error
return ''
def find_usb_path(idVendor, idProduct):
for root, dirs, files in os.walk("/sys/bus/usb/devices", topdown=False):
for name in dirs:
tmpdir= os.path.join(root, name)
tmpidVendor = read_file(tmpdir+'/idVendor').replace("\n","")
tmpidProduct = read_file(tmpdir+'/idProduct').replace("\n","")
#print "tmpdir = " + tmpdir + " tmpidVendor = " + tmpidVendor + " tmpidProduct = " + tmpidProduct
if tmpidVendor == idVendor and tmpidProduct == idProduct:
return tmpdir
return ''
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
#!/bin/bash
#arg1 idVendor
#arg2 idProduct
argIdVendor=$1
argIdProduct=$2
echo $1
echo $2
for X in /sys/bus/usb/devices/*; do
#echo "$X"
idVendor=`cat "$X/idVendor" 2>/dev/null`
idProduct=`cat "$X/idProduct" 2>/dev/null`
if [ "$argIdVendor" == "$idVendor" ] && [ "$argIdProduct" == "$idProduct" ]
then
echo "$X"
fi
done
#!/bin/bash
#arg1 timeout to wait before running the script
#arg2 interface
#arg3 iperf arguments
args=($*)
timeout=${args[0]}
iface=${args[1]}
iperf_args=(${args[@]:2})
#array=${1:-1}
echo "args = ${args[@]}"
echo "timeout = $timeout"
echo "iface = $iface"
echo "iperf_args = ${iperf_args[@]}"
sleep $timeout
while true; do var=`ifconfig $iface` ;sleep 1; if [ "$var" != "" ]; then break; fi ; done ; sleep 5
iperf ${iperf_args[@]}
#!/usr/bin/python
import sys
import re
#Arg 1 name of file
#Arg 2 keyword
#arg 3 replacement text
#Note that these should be seperated by spaces
if len(sys.argv) != 4:
print "search_repl.py: Wrong number of arguments. This program needs 3 arguments"
sys.exit()
filename = sys.argv[1]
keyword = sys.argv[2]
replacement_text = sys.argv[3]
file = open(filename, 'r')
string = file.read()
file.close()
if keyword == 'mme_ip_address':
replacement_text = keyword + ' = ( { ' + replacement_text + ' } ) ; '
string = re.sub(r"mme_ip_address\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
elif keyword == 'IPV4_LIST':
replacement_text = keyword + ' = ( ' + replacement_text + ' ) ; '
string = re.sub(r"IPV4_LIST\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)
#else :
# replacement_text = keyword + ' =\"' + replacement_text + '\" ; '
# string = re.sub(r"%s\s*=\s*\"([^\$]+?)\"\s*;" % keyword , replacement_text, string, re.M)
file = open(filename, 'w')
file.write(string)
file.close()
[Dialer Defaults]
Modem = /dev/ttyUSB0
ISDN = off
Modem Type = Analog Modem
Baud = 9600
Init = ATZ
Init2 = AT+CPIN?
Init3 = AT+CGREG?
Init4 = AT+COPS?
Init5 = AT+CSQ
Init6 =
Init7 = AT+CGATT=1
Init8 =
Init9 =
Phone = *99***1#
Phone1 =
Phone2 =
Phone3 =
Phone4 =
Dial Prefix =
Dial Attempts = 1
Dial Command = ATM1L3DT
Ask Password = off
Password = ''
Username = ImaginLab
Auto Reconnect = off
Abort on Busy = off
Carrier Check = on
Check Def Route = on
Abort on No Dialtone = on
Stupid Mode = on
Idle Seconds = 0
Auto DNS = on
;Minimize = off
;Dock = off
;Do NOT edit this file by hand!
......@@ -45,8 +45,10 @@ MSC_GEN="False"
XFORMS="False"
PRINT_STATS="False"
VCD_TIMING="False"
LOWLATENCY_FLAG_USER="False"
FORCE_LOWLATENCY_FLAG_USER=""
REL="Rel10"
HW="NO_VALUE"
HW="EXMIMO"
TP="NO_VALUE"
NOS1=0
EPC=0
......@@ -55,6 +57,8 @@ CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0
TEST_CASE_GROUP=""
trap handle_ctrl_c INT
function print_help() {
echo_info '
This program installs OpenAirInterface Software
......@@ -81,15 +85,13 @@ Options
Makes the LTE softmodem
--UE
Makes the UE specific parts (ue_ip, usim, nvram)
--EPC
Makes the EPC (MME-SPGW, HSS)
--RRH
Makes the RRH
-r | --3gpp-release
default is Rel10,
Rel8 limits the implementation to 3GPP Release 8 version
-w | --hardware
EXMIMO, USRP, BLADERF
EXMIMO (Default), USRP, BLADERF, None
Adds this RF board support (in external packages installation and in compilation)
-t | --transport protocol
ETHERNET , None
......@@ -117,11 +119,14 @@ Options
Shows detailed compilation instructions in makefile
--cflags_processor
Manually Add CFLAGS of processor if they are not detected correctly by script. Only add these flags if you know your processor supports them. Example flags: -msse3 -msse4.1 -msse4.2 -mavx2
--disable-deadline
Disables deadline scheduler of Linux kernel (>=3.14.x).
--enable-deadline
Disables deadline scheduler of Linux kernel (>=3.14.x).
Usage (first build):
oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files
NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files
NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB -x --install-system-files -w USRP
Usage (Regular):
oaisim : ./build_oai --oaisim -x
Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x
......@@ -163,10 +168,6 @@ function main() {
UE=1
echo_info "Will compile UE"
shift;;
--EPC)
EPC=1
echo_info "Will compile EPC"
shift;;
--RRH)
RRH=1
echo_info "Will compile RRH"
......@@ -237,6 +238,15 @@ function main() {
CFLAGS_PROCESSOR_USER=$2
echo_info "Setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER"
shift 2;;
--disable-deadline)
FORCE_LOWLATENCY_FLAG_USER="False"
echo_info "Disabling the usage of deadline scheduler"
shift 1;;
--enable-deadline)
FORCE_LOWLATENCY_FLAG_USER="True"
echo_info "Enabling the usage of deadline scheduler"
shift 1;;
-h | --help)
print_help
exit 1;;
......@@ -250,7 +260,7 @@ function main() {
############################################
# check validity of HW and TP parameters for RRH and eNB
#############################################
# to be discussed
if [ "$eNB" = "1" ] ; then
if [ "$HW" = "NO_VALUE" -a "$TP" = "NO_VALUE" ] ; then
echo_fatal "A hardware target or a transport protocol must be defined!!"
......@@ -275,15 +285,32 @@ function main() {
fi
fi
if [ "$oaisim" = "1" ] ; then
# there is no RF device and no transport protocol
HW="NO_VALUE"
TP="NO_VALUE"
if [ "$XFORMS" == "True" ] ; then
PRINT_STATS="True"
fi
#Now we set flags to enable deadline scheduler settings
#By default: USRP: disable,
#By default: BLADERF: enable,
#By default: EXMIMO: enable
if [ "$FORCE_LOWLATENCY_FLAG_USER" = "" ]; then
if [ "$HW" = "EXMIMO" ] ; then
LOWLATENCY_FLAG_USER="True"
elif [ "$HW" = "ETHERNET" ] ; then
LOWLATENCY_FLAG_USER="True"
elif [ "$HW" = "OAI_USRP" ] ; then
LOWLATENCY_FLAG_USER="False"
elif [ "$HW" = "OAI_BLADERF" ] ; then
LOWLATENCY_FLAG_USER="False"
elif [ "$HW" = "None" ] ; then
LOWLATENCY_FLAG_USER="False"
else
echo_error "Unknown HW type $HW. Exiting now..."
exit
fi
else
LOWLATENCY_FLAG_USER=$FORCE_LOWLATENCY_FLAG_USER
fi
echo_info "Flags for Deadline scheduler: $LOWLATENCY_FLAG_USER"
############################################
# setting and printing OAI envs, we should check here
############################################
......@@ -332,7 +359,17 @@ function main() {
check_install_additional_tools
fi
if [ "$oaisim" = "1" ] ; then
#to be discussed
# there is no RF device and no transport protocol
HW="NO_VALUE"
TP="NO_VALUE"
if [ "$XFORMS" == "True" ] ; then
PRINT_STATS="True"
fi
fi
echo_info "3. building the compilation directives ..."
......@@ -363,6 +400,7 @@ function main() {
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file
echo "set(PACKAGE_NAME \"${lte_exec}\")" >> $cmake_file
echo "set (LOWLATENCY \"${LOWLATENCY_FLAG_USER}\" )" >>$cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$lte_build_dir/build
cmake ..
......@@ -454,7 +492,7 @@ function main() {
# EXMIMO drivers & firmware loader
###############
if [ "$HW" = "EXMIMO" -a "$EPC" = "0" ] ; then
if [ "$HW" = "EXMIMO" ] ; then
echo_info "Compiling Express MIMO 2 board drivers"
compilations \
......@@ -569,6 +607,7 @@ function main() {
# RRH compilation
#####################
if [ "$RRH" = "1" ] ; then
rrh_exec=rrh_gw
rrh_build_dir=rrh_gw
......@@ -589,6 +628,7 @@ function main() {
compilations \
rrh_gw rrh_gw \
rrh_gw $dbin/rrh_gw
fi
# build RF device and transport protocol libraries
......@@ -654,42 +694,29 @@ function main() {
fi
# EPC compilation
##################
if [ "$EPC" = "1" ] ; then
echo_info "Compiling EPC"
# Example HSS and EPC run on the same host
if [ "$CLEAN" = "1" ]; then
$OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
$OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
else
$OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
$OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
fi
# if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then
# if [ -f $dbin/hss.conf ] ; then
# sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace
# source $dconf/hss.conf.nospace
# rm -f $dconf/hss.conf.nospace
# create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db"
# else
# echo_warning "not created HSS database: config not found"
# fi
# fi
fi
# Auto-tests
#####################
if [ "$OAI_TEST" = "1" ]; then
echo_info "10. Running OAI pre commit tests (pre-ci) ..."
echo_error "These scripts ASSUME that user is in /etc/sudoers and can execute commands without PASSWORD prompt"
echo_error "Add the following lines in /etc/sudoers file to make your __user_name__ sudo without password prompt"
echo_error " __your_user_name__ ALL = (ALL:ALL) NOPASSWD: ALL"
echo_error " __your_user_name__ ALL = (ALL) NOPASSWD: ALL "
echo_info "The log file for the autotest script for debugging is located here: $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log "
echo_info "The results of autotests results is located here: $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml "
echo_info "You can hit CTRL-C any time to terminate the autotests..."
echo "Current User Name: $USER"
read -s -p "Enter Password: " mypassword
echo -e "\n"
rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
if [ "$RUN_GROUP" -eq "1" ]; then
$SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP"
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
else
$SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
fi
wait
else
echo_info "10. Bypassing the Tests ..."
fi
......
......@@ -111,7 +111,12 @@ compilations() {
cd $OPENAIR_DIR/cmake_targets/$1/build
{
rm -f $3
make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE
if [ "$VERBOSE_COMPILE" == "1" ]; then
make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE
else
make -j`nproc` $2
fi
} > $dlog/$2.$REL.txt 2>&1
echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt"
if [ -s $3 ] ; then
......@@ -158,18 +163,23 @@ install_gnutls_from_source(){
check_install_usrp_uhd_driver(){
#first we remove old installation
$SUDO apt-get remove uhd libuhd-dev libuhd003 uhd-host -y
v=$(lsb_release -cs)
$SUDO apt-add-repository "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
$SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
#The new USRP repository
$SUDO add-apt-repository ppa:ettusresearch/uhd -y
$SUDO apt-get update
$SUDO apt-get -y install python python-tk libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y install -t `lsb_release -cs` uhd --force-yes
$SUDO apt-get -y install libuhd-dev libuhd003 uhd-host
$SUDO uhd_images_downloader
}
check_install_bladerf_driver(){
$SUDO add-apt-repository -y ppa:bladerf/bladerf
$SUDO apt-get update
$SUDO apt-get install -y bladerf libbladerf-dev
$SUDO apt-get install bladerf-firmware-fx3
$SUDO apt-get install bladerf-fpga-hostedx40
$SUDO apt-get install -y bladerf-firmware-fx3
$SUDO apt-get install -y bladerf-fpga-hostedx40
bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img
}
......@@ -183,7 +193,6 @@ check_install_additional_tools (){
libboost-all-dev \
libpthread-stubs0-dev \
openvpn \
phpmyadmin \
pkg-config \
python-dev \
python-pexpect \
......@@ -194,27 +203,27 @@ check_install_additional_tools (){
unzip \
valgrind \
vlan \
ctags
ctags \
ntpdate
}
check_install_oai_software() {
$SUDO apt-get update
$SUDO apt-get install -y \
autoconf \
autoconf \
automake \
bison \
build-essential \
cmake \
cmake-curses-gui \
doxygen \
doxygen-gui\
texlive-latex-base\
doxygen-gui \
texlive-latex-base \
ethtool \
flex \
gccxml \
gdb \
git \
gccxml \
gdb \
git \
graphviz \
gtkwave \
guile-2.0-dev \
......@@ -233,7 +242,7 @@ check_install_oai_software() {
libgmp-dev \
libgtk-3-dev \
libidn2-0-dev \
libidn11-dev \
libidn11-dev \
libmysqlclient-dev \
liboctave-dev \
libpgm-5.1 \
......@@ -255,7 +264,12 @@ check_install_oai_software() {
openssl \
python \
subversion \
xmlstarlet
xmlstarlet \
python-pip \
pydb \
wvdial \
python-numpy \
sshpass
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
if [ `lsb_release -rs` = '12.04' ] ; then
install_nettle_from_source
......@@ -263,20 +277,28 @@ check_install_oai_software() {
else
$SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin
fi
$SUDO pip install paramiko
$SUDO pip install pyroute2
install_asn1c_from_source
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
}
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
mkdir -p /tmp/asn1c-r1516
cd /tmp/asn1c-r1516
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
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
./configure
make > /tmp/log_compile_asn1c 2>&1
make -j`nproc`
$SUDO make install
) > $asn1_install_dir 2>&1
}
#################################################
......@@ -319,3 +341,42 @@ set_openair_env(){
export OPENAIR_TARGETS=$openair_path/targets
}
################################
# Function to killall the subprocesses when Ctrl-C Key is hit
###############################
function handle_ctrl_c(){
CURPID=$$
ppid=$$
arraycounter=1
echo_info "** Trapped CTRL-C. Killing all subprocesses now..."
while true
do
FORLOOP=FALSE
# Get all the child process id
for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
do
if [ $i -ne $CURPID ] ; then
procid[$arraycounter]=$i
arraycounter=`expr $arraycounter + 1`
ppid=$i
FORLOOP=TRUE
fi
done
if [ "$FORLOOP" = "FALSE" ] ; then
arraycounter=`expr $arraycounter - 1`
## We want to kill child process id first and then parent id's
while [ $arraycounter -ne 0 ]
do
echo "first we send ctrl-c to program"
$SUDO kill -INT "${procid[$arraycounter]}"
sleep 5
echo "Now we force kill if that didn't work"
$SUDO kill -9 "${procid[$arraycounter]}" >/dev/null
arraycounter=`expr $arraycounter - 1`
done
exit
fi
done
}
n=oarf_get_num_detected_cards;
for i=n-1:0
oarf_stop(i);
end
File mode changed from 100644 to 100755
......@@ -68,7 +68,7 @@ declare MAX_RATE=1000
# set paths to the required binaries and check if the required binaries are available
ENB_CONFIG=$OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf
OAISIM_EXEC=$OPENAIR_DIR/targets/bin/oaisim_nos1
OAISIM_EXEC=$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1
BYPASSE_ITTI=0
OTGPLOT="$OPENAIR2_DIR/UTIL/OTG/OTGplot"
PS2PDF="ps2pdf"
......@@ -301,8 +301,8 @@ oaisim_otg_stats(){
sync
if [ ! -f $OAISIM_EXEC ]; then
echo_info "3.1 compiling OAISIM ($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c)"
($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c >> results/perf_log.txt 2>&1 )
echo_info "3.1 compiling OAISIM ($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1)"
($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1 >> results/perf_log.txt 2>&1 )
build_stats=$?
if [ $build_stats != 0 ] ; then
echo_error "$OAISIM_EXEC cannot be built, check results/perf_log.txt file"
......
#!/bin/bash
echo "This script stops exmimo2 as it might be transmitting signal by itself if lte-softmodem terminates incorrectly"
if [ "$OPENAIR_DIR" == "" ]; then
echo "Is the OPENAIR_DIR path set correctly? Exiting now"
exit
fi
sudo -E bash -c 'echo 3 > /proc/sys/vm/drop_caches'
#load the module
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
......@@ -24,15 +24,18 @@ xUnit_start() {
# \param $1 classname
# \param $2 testcase name
# \param $3 testcase result
# \param $4 run index
# \param $4 run result
# \param $5 XML file local to test case for storing its own results
xUnit_fail() {
class=$1
test_case=$2
result=$3
run_index=$4
run_result=$4
xmlfile_testcase=$5
currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l)
xml="<testcase classname='$class' name='$test_case' run='$run_index' time='$time' RESULT='$result'></testcase>"
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
echo -e $xml >> $xmlfile_testcase
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_FAILED=$((XUNIT_FAILED+1))
}
......@@ -43,15 +46,18 @@ xUnit_fail() {
# \param $1 classname
# \param $2 testcase name
# \param $3 testcase result
# \param $4 run index
# \param $4 run result
# \param $5 XML file local to test case for storing its own results
xUnit_success() {
class=$1
test_case=$2
result=$3
run_index=$4
run_result=$4
xmlfile_testcase=$5
currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l)
xml="<testcase classname='$class' name='$test_case' run='$run_index' time='$time' RESULT='$result'></testcase>"
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
echo -e $xml >> $xmlfile_testcase
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_SUCCESS=$((XUNIT_SUCCESS+1))
}
......
......@@ -5,7 +5,8 @@ export OPENAIR1_DIR=$OPENAIR_HOME/openair1
export OPENAIR2_DIR=$OPENAIR_HOME/openair2
export OPENAIR3_DIR=$OPENAIR_HOME/openair3
export OPENAIR_TARGETS=$OPENAIR_HOME/targets
export OPENAIRITS_DIR=$OPENAIR_HOME/openairITS
export PATH=$PATH:$OPENAIR_TARGETS/bin
alias oai='cd $OPENAIR_HOME'
alias oai0='cd $OPENAIR0_DIR'
......
......@@ -36,6 +36,7 @@
#include <stdlib.h>
#endif
#include "PHY/defs.h"
#include "assertions.h"
//#define cmin(a,b) ((a)<(b) ? (a) : (b))
......@@ -515,16 +516,14 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
// if (rvidx==3)
// for (cnt=0;cnt<Ncb;cnt++)
// counter_buffer[rvidx][cnt]=0;
if (Ncb<(3*(RTC<<5))) {
msg("Exiting, RM condition (Nir %d, Nsoft %d, Kw %d\n",Nir,Nsoft,3*(RTC<<5));
return(0);
}
AssertFatal(Ncb>=(3*RTC<<5),"Exiting, RM condition (Ncb %d, Nir/C %d, Nsoft %d, Kw %d\n",Ncb,Nir/C,Nsoft,3*(RTC<<5));
Gp = G/Nl/Qm;
GpmodC = Gp%C;
#ifdef RM_DEBUG
printf("lte_rate_matching_turbo: Kw %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",3*(RTC<<5),rvidx, G, Qm,Nl,r);
printf("lte_rate_matching_turbo: Ncb %d, Kw %d, Nir/C %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",Ncb,3*(RTC<<5),Nir/C,rvidx, G, Qm,Nl,r);
#endif
if (r < (C-(GpmodC)))
......
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <execinfo.h>
#include <signal.h>
#include "SIMULATION/TOOLS/defs.h"
#include "PHY/types.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
extern PHY_VARS_eNB *PHY_vars_eNB;
extern PHY_VARS_UE *PHY_vars_UE;
void lte_param_init(unsigned char N_tx,
unsigned char N_rx,
unsigned char transmission_mode,
uint8_t extended_prefix_flag,
frame_t frame_type,
uint16_t Nid_cell,
uint8_t tdd_config,
uint8_t N_RB_DL,
uint8_t threequarter_fs,
uint8_t osf,
uint32_t perfect_ce)
{
LTE_DL_FRAME_PARMS *lte_frame_parms;
int i;
printf("Start lte_param_init\n");
PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
srand(0);
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms);
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->threequarter_fs = threequarter_fs;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Nid_cell = Nid_cell;
lte_frame_parms->nushift = Nid_cell%6;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
lte_frame_parms->nb_antennas_tx_eNB = N_tx;
lte_frame_parms->phich_config_common.phich_resource = one;
lte_frame_parms->tdd_config = tdd_config;
lte_frame_parms->frame_type = frame_type;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;44
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
// phy_init_top(lte_frame_parms); //allocation
PHY_vars_UE->is_secondary_ue = 0;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
PHY_vars_eNB->lte_frame_parms = *lte_frame_parms;
phy_init_lte_top(lte_frame_parms);
dump_frame_parms(lte_frame_parms);
PHY_vars_UE->PHY_measurements.n_adj_cells=0;
PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
for (i=0; i<3; i++)
lte_gold(lte_frame_parms,PHY_vars_UE->lte_gold_table[i],Nid_cell+i);
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
generate_pcfich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
generate_phich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
// DL power control init
if (transmission_mode == 1) {
PHY_vars_eNB->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_eNB->lte_frame_parms).pdsch_config_common).p_b = 0;
PHY_vars_UE->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_UE->lte_frame_parms).pdsch_config_common).p_b = 0;
} else { // rho_a = rhob
PHY_vars_eNB->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_eNB->lte_frame_parms).pdsch_config_common).p_b = 1;
PHY_vars_UE->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_UE->lte_frame_parms).pdsch_config_common).p_b = 1;
}
PHY_vars_UE->perfect_ce = perfect_ce;
printf("Done lte_param_init\n");
}
......@@ -68,33 +68,57 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
default:
msg("Illegal oversampling %d\n",osf);
printf("Illegal oversampling %d\n",osf);
return(-1);
}
switch (frame_parms->N_RB_DL) {
case 100:
if (osf>1) {
msg("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 2048;
frame_parms->log2_symbol_size = 11;
frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 2048-600;
if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-600;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
}
else {
frame_parms->ofdm_symbol_size = 2048;
frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 2048-600;
}
frame_parms->N_RBGS = 4;
frame_parms->N_RBG = 25;
break;
case 75:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-450;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
frame_parms->N_RBGS = 4;
frame_parms->N_RBG = 25;
break;
case 50:
if (osf>1) {
msg("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1024*osf;
frame_parms->log2_symbol_size = 10+log2_osf;
frame_parms->samples_per_tti = 15360*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300;
frame_parms->nb_prefix_samples>>=(1-log2_osf);
......@@ -105,13 +129,13 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 25:
if (osf>2) {
msg("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 512*osf;
frame_parms->log2_symbol_size = 9+log2_osf;
frame_parms->samples_per_tti = 7680*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150;
frame_parms->nb_prefix_samples>>=(2-log2_osf);
......@@ -124,7 +148,6 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 15:
frame_parms->ofdm_symbol_size = 256*osf;
frame_parms->log2_symbol_size = 8+log2_osf;
frame_parms->samples_per_tti = 3840*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90;
frame_parms->nb_prefix_samples>>=(3-log2_osf);
......@@ -135,7 +158,6 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 6:
frame_parms->ofdm_symbol_size = 128*osf;
frame_parms->log2_symbol_size = 7+log2_osf;
frame_parms->samples_per_tti = 1920*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36;
frame_parms->nb_prefix_samples>>=(4-log2_osf);
......@@ -145,7 +167,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
default:
msg("init_frame_parms: Error: Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
printf("init_frame_parms: Error: Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
return(-1);
break;
}
......@@ -159,23 +181,22 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
{
msg("frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL);
msg("frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL);
msg("frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell);
msg("frame_parms->Ncp=%d\n",frame_parms->Ncp);
msg("frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL);
msg("frame_parms->nushift=%d\n",frame_parms->nushift);
msg("frame_parms->frame_type=%d\n",frame_parms->frame_type);
msg("frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
msg("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S);
msg("frame_parms->mode1_flag=%d\n",frame_parms->mode1_flag);
msg("frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx);
msg("frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx);
msg("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size);
msg("frame_parms->log2_symbol_size=%d\n",frame_parms->log2_symbol_size);
msg("frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);
msg("frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0);
msg("frame_parms->first_carrier_offset=%d\n",frame_parms->first_carrier_offset);
msg("frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
msg("frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
printf("frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL);
printf("frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL);
printf("frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell);
printf("frame_parms->Ncp=%d\n",frame_parms->Ncp);
printf("frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL);
printf("frame_parms->nushift=%d\n",frame_parms->nushift);
printf("frame_parms->frame_type=%d\n",frame_parms->frame_type);
printf("frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
printf("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S);
printf("frame_parms->mode1_flag=%d\n",frame_parms->mode1_flag);
printf("frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx);
printf("frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx);
printf("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size);
printf("frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);
printf("frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0);
printf("frame_parms->first_carrier_offset=%d\n",frame_parms->first_carrier_offset);
printf("frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
printf("frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
}
......@@ -243,15 +243,16 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,module_id_t UE_id,uint8_t subframe);
void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNb,
void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNB,
int subframe,
module_id_t eNB_id,
unsigned char clear);
void lte_eNB_I0_measurements_emul(PHY_VARS_eNB *phy_vars_eNb,
void lte_eNB_I0_measurements_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t sect_id);
void lte_eNB_srs_measurements(PHY_VARS_eNB *phy_vars_eNb,
void lte_eNB_srs_measurements(PHY_VARS_eNB *phy_vars_eNBy,
module_id_t eNB_id,
module_id_t UE_id,
unsigned char init_averaging);
......
......@@ -703,24 +703,28 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
void (*idft)(int16_t *,int16_t *, int);
switch (phy_vars_ue->lte_frame_parms.log2_symbol_size) {
case 7:
switch (phy_vars_ue->lte_frame_parms.ofdm_symbol_size) {
case 128:
idft = idft128;
break;
case 8:
case 256:
idft = idft256;
break;
case 9:
case 512:
idft = idft512;
break;
case 10:
case 1024:
idft = idft1024;
break;
case 11:
case 1536:
idft = idft1536;
break;
case 2048:
idft = idft2048;
break;
......
......@@ -39,57 +39,36 @@
int32_t rx_power_avg_eNB[3][3];
void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNb,
void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNB,
int subframe,
unsigned char eNB_id,
unsigned char clear)
{
LTE_eNB_COMMON *eNB_common_vars = &phy_vars_eNb->lte_eNB_common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNb->lte_frame_parms;
PHY_MEASUREMENTS_eNB *phy_measurements = &phy_vars_eNb->PHY_measurements_eNB[eNB_id];
LTE_eNB_COMMON *eNB_common_vars = &phy_vars_eNB->lte_eNB_common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
PHY_MEASUREMENTS_eNB *phy_measurements = &phy_vars_eNB->PHY_measurements_eNB[eNB_id];
int32_t *rb_mask = phy_vars_eNB->rb_mask_ul;
uint32_t aarx,rx_power_correction;
uint32_t rb;
int32_t *ul_ch;
int32_t n0_power_tot;
int len;
int offset;
int Nsymb = (frame_parms->Ncp==NORMAL)?14:12;
// noise measurements
// for the moment we measure the noise on the 7th OFDM symbol (in S subframe)
phy_measurements->n0_power_tot = 0;
/* printf("rxdataF0 %p, rxdataF1 %p\n",
(&eNB_common_vars->rxdataF[0][0][(frame_parms->ofdm_symbol_size + frame_parms->first_carrier_offset)<<1 ]),
(&eNB_common_vars->rxdataF[0][1][(frame_parms->ofdm_symbol_size + frame_parms->first_carrier_offset)<<1 ]));
*/
/*
for (i=0;i<512;i++)
printf("sector 0 antenna 0 : %d,%d\n",((short *)&eNB_common_vars->rxdataF[0][0][(19*frame_parms->ofdm_symbol_size)<<1])[i<<1],
((short *)&eNB_common_vars->rxdataF[0][0][(19*frame_parms->ofdm_symbol_size)<<1])[1+(i<<1)]);
for (i=0;i<12;i++)
// printf("sector 0 antenna 1 : %d,%d\n",((short *)&eNB_common_vars->rxdataF[0][1][(19*frame_parms->ofdm_symbol_size)<<1])[i<<1],
((short *)&eNB_common_vars->rxdataF[0][1][(19*frame_parms->ofdm_symbol_size)<<1])[1+(i<<1)]);
*/
if ( (frame_parms->ofdm_symbol_size == 128) ||
(frame_parms->ofdm_symbol_size == 512) )
rx_power_correction = 2;
else
rx_power_correction = 1;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
if (clear == 1)
phy_measurements->n0_power[aarx]=0;
#ifdef USER_MODE
phy_measurements->n0_power[aarx] = ((k1*signal_energy(&eNB_common_vars->rxdata[eNB_id][aarx][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size)) + k2*phy_measurements->n0_power[aarx])>>10;
#else
phy_measurements->n0_power[aarx] = ((k1*signal_energy(&eNB_common_vars->rxdata[eNB_id][aarx][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size))+k2*phy_measurements->n0_power[aarx])>>10;
#endif
phy_measurements->n0_power[aarx] = (phy_measurements->n0_power[aarx] * 12*frame_parms->N_RB_DL)/(frame_parms->ofdm_symbol_size);
phy_measurements->n0_power_dB[aarx] = (unsigned short) dB_fixed(phy_measurements->n0_power[aarx]);
phy_measurements->n0_power_tot += phy_measurements->n0_power[aarx];
......@@ -97,52 +76,49 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNb,
phy_measurements->n0_power_tot_dB = (unsigned short) dB_fixed(phy_measurements->n0_power_tot);
phy_measurements->n0_power_tot_dBm = phy_measurements->n0_power_tot_dB - phy_vars_eNb->rx_total_gain_eNB_dB;
phy_measurements->n0_power_tot_dBm = phy_measurements->n0_power_tot_dB - phy_vars_eNB->rx_total_gain_eNB_dB;
// printf("n0_power %d\n",phy_measurements->n0_power_tot_dB);
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
n0_power_tot=0;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
if (rb < 12)
// ul_ch = &eNB_common_vars->rxdataF[eNB_id][aarx][((19*(frame_parms->ofdm_symbol_size)) + frame_parms->first_carrier_offset + (rb*12))<<1];
ul_ch = &eNB_common_vars->rxdataF[eNB_id][aarx][((7*frame_parms->ofdm_symbol_size) + frame_parms->first_carrier_offset + (rb*12))<<1];
else if (rb>12)
ul_ch = &eNB_common_vars->rxdataF[eNB_id][aarx][((7*frame_parms->ofdm_symbol_size) + 6 + (rb-13)*12)<<1];
else {
ul_ch = NULL;
}
if (clear == 1)
phy_measurements->n0_subband_power[aarx][rb]=0;
if (ul_ch) {
// for (i=0;i<24;i+=2)
// printf("re %d => %d\n",i/2,ul_ch[i]);
phy_measurements->n0_subband_power[aarx][rb] = ((k1*(signal_energy_nodc(ul_ch,
24))*rx_power_correction) + (k2*phy_measurements->n0_subband_power[aarx][rb]))>>11; // 11 and 24 to compensate for repeated signal format
phy_measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(phy_measurements->n0_subband_power[aarx][rb]);
// printf("eNb %d, aarx %d, rb %d : energy %d (%d dB)\n",eNB_id,aarx,rb,signal_energy_nodc(ul_ch,24), phy_measurements->n0_subband_power_dB[aarx][rb]);
n0_power_tot += phy_measurements->n0_subband_power[aarx][rb];
} else {
phy_measurements->n0_subband_power[aarx][rb] = 1;
phy_measurements->n0_subband_power_dB[aarx][rb] = -99;
n0_power_tot = 1;
if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
// select the 7th symbol in an uplink subframe
offset = (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
offset += (7*frame_parms->ofdm_symbol_size);//(((Nsymb*subframe)+7)*frame_parms->ofdm_symbol_size);
ul_ch = &eNB_common_vars->rxdataF[eNB_id][aarx][offset];
len = 12;
// just do first half of middle PRB for odd number of PRBs
if (((frame_parms->N_RB_UL&1) == 1) &&
(rb==(frame_parms->N_RB_UL>>1))) {
len=6;
}
if (clear == 1)
phy_measurements->n0_subband_power[aarx][rb]=0;
AssertFatal(ul_ch, "RX signal buffer (freq) problem");
phy_measurements->n0_subband_power[aarx][rb] = signal_energy_nodc(ul_ch,len);
//((k1*(signal_energy_nodc(ul_ch,len)))
// + (k2*phy_measurements->n0_subband_power[aarx][rb]));
phy_measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(phy_measurements->n0_subband_power[aarx][rb]);
// printf("subframe %d (%d): eNb %d, aarx %d, rb %d len %d: energy %d (%d dB)\n",subframe,offset,eNB_id,aarx,rb,len,signal_energy_nodc(ul_ch,len),
// phy_measurements->n0_subband_power_dB[aarx][rb]);
n0_power_tot += phy_measurements->n0_subband_power[aarx][rb];
}
phy_measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot);
phy_measurements->n0_subband_power_tot_dBm[rb] = phy_measurements->n0_subband_power_tot_dB[rb] - phy_vars_eNB->rx_total_gain_eNB_dB - dB_fixed(frame_parms->N_RB_UL);
}
phy_measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot);
phy_measurements->n0_subband_power_tot_dBm[rb] = phy_measurements->n0_subband_power_tot_dB[rb] - phy_vars_eNb->rx_total_gain_eNB_dB - 14;
}
}
void lte_eNB_srs_measurements(PHY_VARS_eNB *phy_vars_eNb,
unsigned char eNB_id,
unsigned char UE_id,
......
......@@ -61,7 +61,6 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
{
int i,k;
//unsigned short ds = frame_parms->log2_symbol_size - 7;
sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
......@@ -184,13 +183,6 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
break;
}
/*
frame_parms->twiddle_ifft, /// complex twiddle factors
frame_parms->rev, /// bit reversed permutation vector
frame_parms->log2_symbol_size,/// log2(FFT_SIZE)
(frame_parms->log2_symbol_size/2),
0); /// 0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format)
*/
for (i=0; i<frame_parms->ofdm_symbol_size; i++)
((int32_t*)primary_synch0_time)[i] = sync_tmp[i];
......
......@@ -432,7 +432,7 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
in_fft_ptr_0 = &temp_in_fft_0[0];
in_fft_ptr_1 = &temp_in_fft_1[0];
for(j=0; j<(1<<(frame_parms->log2_symbol_size))/12; j++) {
for(j=0; j<(frame_parms->ofdm_symbol_size)/12; j++) {
if (j>19) {
((int16_t*)in_fft_ptr_0)[-40+(2*j)] = ((int16_t*)temp_out_ifft_0)[-80+(2*j)]*rx_power_correction;
((int16_t*)in_fft_ptr_0)[-40+(2*j)+1] = ((int16_t*)temp_out_ifft_0)[-80+(2*j+1)]*rx_power_correction;
......
......@@ -72,7 +72,7 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB,
else if ((p==1) && (l>0))
nu = 0;
else {
msg("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
printf("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
return(-1);
}
......@@ -94,9 +94,9 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB,
output[k] = qpsk[(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
//output[k] = (lte_gold_table[eNB_offset][Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
#ifdef DEBUG_DL_CELL_SPEC
msg("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
printf("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
Ns,l,m,mprime_dword,mprime_qpsk_symb);
msg("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
printf("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
#endif
mprime++;
......@@ -151,7 +151,7 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
else if ((p==1) && (l>0))
nu = 0;
else {
msg("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
printf("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
return(-1);
}
......@@ -177,9 +177,9 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
output[k] = qpsk[(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
//output[k] = (lte_gold_table[eNB_offset][Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
#ifdef DEBUG_DL_CELL_SPEC
msg("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
printf("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
Ns,l,m,mprime_dword,mprime_qpsk_symb);
msg("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
printf("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
#endif
mprime++;
......
......@@ -2108,14 +2108,14 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
if (dci_alloc[i].L == (uint8_t)L) {
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY,"Generating common DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x)\n",i,num_common_dci,dci_alloc[i].nCCE,dci_alloc[i].dci_length,1<<dci_alloc[i].L,
LOG_I(PHY,"Generating common DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x)\n",i,num_common_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,1<<dci_alloc[i].L,
*(unsigned int*)dci_alloc[i].dci_pdu);
dump_dci(frame_parms,&dci_alloc[i]);
#endif
if (dci_alloc[i].nCCE>=0) {
if (dci_alloc[i].firstCCE>=0) {
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
e+(72*dci_alloc[i].nCCE),
e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length,
dci_alloc[i].L,
dci_alloc[i].rnti);
......@@ -2133,9 +2133,9 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
dump_dci(frame_parms,&dci_alloc[i]);
#endif
if (dci_alloc[i].nCCE >= 0) {
if (dci_alloc[i].firstCCE >= 0) {
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
e+(72*dci_alloc[i].nCCE),
e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length,
dci_alloc[i].L,
dci_alloc[i].rnti);
......@@ -2537,13 +2537,116 @@ uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uin
return(Nreg - 4 - (3*Ngroup_PHICH));
}
uint16_t get_nCCE_max(uint8_t Mod_id,uint8_t CC_id)
uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe)
{
// check for eNB only !
return(get_nCCE(3,&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,1)); // 5, 15,21
return(get_nCCE(num_pdcch_symbols,
&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,
get_mi(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,subframe)));
}
int get_nCCE_offset_l1(int *CCE_table,
const unsigned char L,
const int nCCE,
const int common_dci,
const unsigned short rnti,
const unsigned char subframe)
{
int search_space_free,m,nb_candidates = 0,l,i;
unsigned int Yk;
/*
printf("CCE Allocation: ");
for (i=0;i<nCCE;i++)
printf("%d.",CCE_table[i]);
printf("\n");
*/
if (common_dci == 1) {
// check CCE(0 ... L-1)
nb_candidates = (L==4) ? 4 : 2;
nb_candidates = min(nb_candidates,nCCE/L);
// printf("Common DCI nb_candidates %d, L %d\n",nb_candidates,L);
for (m = nb_candidates-1 ; m >=0 ; m--) {
search_space_free = 1;
for (l=0; l<L; l++) {
// printf("CCE_table[%d] %d\n",(m*L)+l,CCE_table[(m*L)+l]);
if (CCE_table[(m*L) + l] == 1) {
search_space_free = 0;
break;
}
}
if (search_space_free == 1) {
// printf("returning %d\n",m*L);
for (l=0; l<L; l++)
CCE_table[(m*L)+l]=1;
return(m*L);
}
}
return(-1);
} else { // Find first available in ue specific search space
// according to procedure in Section 9.1.1 of 36.213 (v. 8.6)
// compute Yk
Yk = (unsigned int)rnti;
for (i=0; i<=subframe; i++)
Yk = (Yk*39827)%65537;
Yk = Yk % (nCCE/L);
switch (L) {
case 1:
case 2:
nb_candidates = 6;
break;
case 4:
case 8:
nb_candidates = 2;
break;
default:
DevParam(L, nCCE, rnti);
break;
}
LOG_D(MAC,"rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",rnti,Yk,nCCE,nCCE/L,nb_candidates);
for (m = 0 ; m < nb_candidates ; m++) {
search_space_free = 1;
for (l=0; l<L; l++) {
if (CCE_table[(((Yk+m)%(nCCE/L))*L) + l] == 1) {
search_space_free = 0;
break;
}
}
if (search_space_free == 1) {
for (l=0; l<L; l++)
CCE_table[(((Yk+m)%(nCCE/L))*L)+l]=1;
return(((Yk+m)%(nCCE/L))*L);
}
}
return(-1);
}
}
void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,
int do_common,
uint8_t subframe,
......@@ -2691,7 +2794,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,
dci_alloc[*dci_cnt].dci_length = sizeof_bits;
dci_alloc[*dci_cnt].rnti = crc;
dci_alloc[*dci_cnt].L = L;
dci_alloc[*dci_cnt].nCCE = CCEind;
dci_alloc[*dci_cnt].firstCCE = CCEind;
if (sizeof_bytes<=4) {
dci_alloc[*dci_cnt].dci_pdu[3] = dci_decoded_output[0];
......
This diff is collapsed.
......@@ -258,6 +258,13 @@ typedef struct {
uint8_t error_threshold;
/// Pointers to 8 HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_processes[8];
/// circular list of free harq PIDs (the oldest come first)
/// (10 is arbitrary value, must be > to max number of DL HARQ processes in LTE)
int harq_pid_freelist[10];
/// the head position of the free list (if list is free then head=tail)
int head_freelist;
/// the tail position of the free list
int tail_freelist;
/// Number of soft channel bits
uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
......@@ -266,6 +273,8 @@ typedef struct {
uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
......@@ -576,13 +585,13 @@ typedef struct {
/// UL RSSI per receive antenna
int32_t UL_rssi[NB_ANTENNAS_RX];
/// PUCCH1a/b power (digital linear)
int32_t Po_PUCCH;
uint32_t Po_PUCCH;
/// PUCCH1a/b power (dBm)
int32_t Po_PUCCH_dBm;
/// PUCCH1 power (digital linear), conditioned on below threshold
int32_t Po_PUCCH1_below;
uint32_t Po_PUCCH1_below;
/// PUCCH1 power (digital linear), conditioned on above threshold
int32_t Po_PUCCH1_above;
uint32_t Po_PUCCH1_above;
/// Indicator that Po_PUCCH has been updated by PHY
int32_t Po_PUCCH_update;
/// DL Wideband CQI index (2 TBs)
......@@ -693,6 +702,8 @@ typedef struct {
uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// Maximum number of Turbo iterations
uint8_t max_turbo_iterations;
/// accumulated tx power adjustment for PUCCH
......@@ -737,7 +748,7 @@ typedef struct {
/// Aggregation level
uint8_t L;
/// Position of first CCE of the dci
int nCCE;
int firstCCE;
/// flag to indicate that this is a RA response
boolean_t ra_flag;
/// rnti
......
......@@ -117,7 +117,7 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
}
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigned char N_RB_DL, uint8_t abstraction_flag)
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag)
{
LTE_eNB_DLSCH_t *dlsch;
......@@ -148,10 +148,14 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
bzero(dlsch,sizeof(LTE_eNB_DLSCH_t));
dlsch->Kmimo = Kmimo;
dlsch->Mdlharq = Mdlharq;
dlsch->Nsoft = Nsoft;
for (i=0; i<10; i++)
dlsch->harq_ids[i] = Mdlharq;
dlsch->head_freelist = 0;
dlsch->tail_freelist = 0;
for (i=0; i<Mdlharq; i++) {
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
......@@ -192,6 +196,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
msg("Can't get harq_p %d\n",i);
exit_flag=3;
}
put_harq_pid_in_freelist(dlsch, i);
}
if (exit_flag==0) {
......@@ -395,7 +401,7 @@ int dlsch_encoding(unsigned char *a,
dlsch->harq_processes[harq_pid]->w[r],
dlsch->harq_processes[harq_pid]->e+r_offset,
dlsch->harq_processes[harq_pid]->C, // C
NSOFT, // Nsoft,
dlsch->Nsoft, // Nsoft,
dlsch->Mdlharq,
dlsch->Kmimo,
dlsch->harq_processes[harq_pid]->rvidx,
......
......@@ -81,7 +81,7 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
}
}
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
{
LTE_UE_DLSCH_t *dlsch;
......@@ -113,6 +113,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t max_turbo_ite
memset(dlsch,0,sizeof(LTE_UE_DLSCH_t));
dlsch->Kmimo = Kmimo;
dlsch->Mdlharq = Mdlharq;
dlsch->Nsoft = Nsoft;
dlsch->max_turbo_iterations = max_turbo_iterations;
for (i=0; i<Mdlharq; i++) {
......@@ -353,7 +354,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
(uint8_t*)&dummy_w[r][0],
dlsch_llr+r_offset,
harq_process->C,
NSOFT,
dlsch->Nsoft,
dlsch->Mdlharq,
dlsch->Kmimo,
harq_process->rvidx,
......
......@@ -336,7 +336,9 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
#else
#ifndef OAI_USRP
#ifndef OAI_BLADERF
phy_adjust_gain(phy_vars_ue,0);
#endif
#endif
#endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment