Commit 1ff2c0d3 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'develop' into feature-38-bladerf

Conflicts:
	targets/RT/USER/lte-softmodem.c
parents 8da8de72 244699fc
...@@ -133,9 +133,6 @@ else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") ...@@ -133,9 +133,6 @@ else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
if (CPUINFO MATCHES "avx2") if (CPUINFO MATCHES "avx2")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx2") set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx2")
endif() endif()
if (CPUINFO MATCHES "sse4_2")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.2")
endif()
if (CPUINFO MATCHES "sse4_1") if (CPUINFO MATCHES "sse4_1")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.1") set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.1")
endif() endif()
...@@ -149,8 +146,8 @@ set(C_FLAGS_PROCESSOR " ${C_FLAGS_PROCESSOR} ${CFLAGS_PROCESSOR_USER}") ...@@ -149,8 +146,8 @@ set(C_FLAGS_PROCESSOR " ${C_FLAGS_PROCESSOR} ${CFLAGS_PROCESSOR_USER}")
Message("C_FLAGS_PROCESSOR is ${C_FLAGS_PROCESSOR}") Message("C_FLAGS_PROCESSOR is ${C_FLAGS_PROCESSOR}")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86") 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")) ) 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 -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\" ") 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()
endif() endif()
......
...@@ -6,41 +6,50 @@ Obj.# Case# Test# Description ...@@ -6,41 +6,50 @@ Obj.# Case# Test# Description
01 pre-commit test case 01 pre-commit test case
01 01 Build OAI 01 01 Build OAI
01 01 01 Build oaisim.Rel8 01 01 01 Build oaisim.Rel8
01 01 02 Build oaisim.Rel8 + network device driver(nasmesh_fix) 01 01 02 Build oaisim.Rel10
01 01 03 Build (lte-softmodem.Rel8.EXMIMO + lte-softmodem.Rel10.EXMIMO + lte-softmodem.Rel10.USRP) 01 01 03 Build oaisim_noS1.Rel10
01 01 04 Build (dlsim.Rel10 + ulsim.Rel10 + pucchsim.Rel10 + prachsim.Rel10 + pdcchsim.Rel10 + pbchsim.Rel10 + mbmssim.Rel10 01 01 10 Build lte-softmodem_noS1.USRP.Rel10
01 01 11 Build lte-softmodem_noS1.EXMIMO.Rel10
01 01 12 Build lte-softmodem_noS1.BLADERF.Rel10
01 01 13 Build lte-softmodem_noS1.ETHERNET.Rel10
01 01 20 Build lte-softmodem.USRP.Rel10
01 01 21 Build lte-softmodem.EXMIMO.Rel10
01 01 22 Build lte-softmodem.BLADERF.Rel10
01 01 23 Build lte-softmodem.ETHERNET.Rel10
01 01 30 Build (dlsim.Rel10 + ulsim.Rel10 + pucchsim.Rel10 + prachsim.Rel10 + pdcchsim.Rel10 + pbchsim.Rel10 + mbmssim.Rel10
secu_knas_encrypt_eia1.Rel10 secu_kenb.Rel10 aes128_ctr_encrypt.Rel10 aes128_ctr_decrypt.Rel10 secu_knas_encrypt_eea2.Rel10 secu_knas_encrypt_eia1.Rel10 secu_kenb.Rel10 aes128_ctr_encrypt.Rel10 aes128_ctr_decrypt.Rel10 secu_knas_encrypt_eea2.Rel10
secu_knas.Rel10 secu_knas_encrypt_eea1.Rel10 kdf.Rel10 aes128_cmac_encrypt.Rel10 secu_knas_encrypt_eia2.Rel10) secu_knas.Rel10 secu_knas_encrypt_eea1.Rel10 kdf.Rel10 aes128_cmac_encrypt.Rel10 secu_knas_encrypt_eia2.Rel10)
01 01 06 Build oaisim.Rel8 + ITTI
01 01 07 Build oaisim.Rel10 01 01 40 Build RRH Gateway for USRP (Rel 10)
01 01 08 Build oaisim.Rel10 + ITTI 01 01 41 Build RRH Gateway for EXMIMO (Rel 10)
01 01 20 Build Nasmesh 01 01 42 Build RRH Gateway for BLADERF (Rel 10)
01 01 30 Build RRH Gateway
01 02 Run OAISIM Rel10 (TDD + 5MHz/10MHz/20MHz + TM 1,2,5,6), and check the operation 01 02 Run OAISIM-NOS1 Rel10 (TDD + 5MHz/10MHz/20MHz + TM 1,2), and check the operation
01 02 00 Run OAISIM Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit 01 02 00 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2) and search for errors, segmentation fault or exit
01 02 01 Run OAISIM Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors 01 02 01 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2) in PHY_ABSTRACTION mode and search for errors
01 02 02 Run OAISIM Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit 01 02 02 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2) and search for errors, segmentation fault or exit
01 02 03 Run OAISIM Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors 01 02 03 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2) in PHY_ABSTRACTION mode and search for errors
01 02 04 Run OAI Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) without PHY_ABSTRACTION mode, ping from from eNB to UE, 01 02 04 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2) without PHY_ABSTRACTION mode, ping from from eNB to UE,
and for check for no packet losses and for check for no packet losses
01 02 05 Run OAI Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode, send ping from from eNB to UE, 01 02 05 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2) in PHY_ABSTRACTION mode, send ping from from eNB to UE,
and check for no packet losses and check for no packet losses
01 03 Run OAISIM Rel10 (FDD + 5MHz/10MHz/20MHz + TM 1,2,5,6), and check the operation 01 03 Run OAISIM-NOS1 Rel10 (FDD + 5MHz/10MHz/20MHz + TM 1,2), and check the operation
01 03 00 Run OAISIM Rel10 FDD, 1 eNB + 1 UE 1 eNB (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit 01 03 00 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE 1 eNB (5 MHz/10MHz/20MHz), (TM 1,2) and search for errors, segmentation fault or exit
01 03 01 Run OAISIM Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors 01 03 01 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2) in PHY_ABSTRACTION mode and search for errors
01 03 02 Run OAISIM Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit 01 03 02 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2) and search for errors, segmentation fault or exit
01 03 03 Run OAISIM Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors 01 03 03 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2) in PHY_ABSTRACTION mode and search for errors
01 03 04 Run OAI Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) without PHY_ABSTRACTION mode, ping from from eNB to UE, 01 03 04 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2) without PHY_ABSTRACTION mode, ping from from eNB to UE,
and for check for no packet losses and for check for no packet losses
01 03 05 Run OAI Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode, send ping from from eNB to UE, 01 03 05 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2) in PHY_ABSTRACTION mode, send ping from from eNB to UE,
and check for no packet losses and check for no packet losses
01 04 MBSFN Tests 01 04 OAISIM-NOS1 MBSFN Tests
01 04 00 Check if eMBMS procedure is not finished completely, make sure that the SIB13/MCCH have been correclty received by UEs 01 04 00 Check if eMBMS procedure is not finished completely, make sure that the SIB13/MCCH have been correclty received by UEs
01 04 01 Check if eMBMS multicast/broadcast data is received, make sure that the SIB13/MCCH/MTCH have been correclty received by UEs 01 04 01 Check if eMBMS multicast/broadcast data is received, make sure that the SIB13/MCCH/MTCH have been correclty received by UEs
01 04 02 Check for eMBMS multicast/broadcast data received in fdd mode, make sure that the SIB13/MCCH/MTCH have been correctly 01 04 02 Check for eMBMS multicast/broadcast data received in fdd mode, make sure that the SIB13/MCCH/MTCH have been correctly
...@@ -88,7 +97,49 @@ Obj.# Case# Test# Description ...@@ -88,7 +97,49 @@ Obj.# Case# Test# Description
01 51 06 mbmssim (TBD) 01 51 06 mbmssim (TBD)
01 55 lte-softmodem tests 01 55 lte-softmodem tests with USRP B210 RF as eNB and ALU EPC w/ Bandrich COTS UE for TX/1RX, 2TX/2RX
01 55 00 Band 7 FDD 5MHz UL Throughput for 60 sec for 1TX/1RX
01 55 01 Band 7 FDD 10MHz UL Throughput for 60 sec for 1TX/1RX
01 55 02 Band 7 FDD 20MHz UL Throughput for 60 sec for 1TX/1RX
01 55 03 Band 7 FDD 5MHz DL Throughput for 60 sec for 1TX/1RX
01 55 04 Band 7 FDD 10MHz DL Throughput for 60 sec for 1TX/1RX
01 55 05 Band 7 FDD 20MHz DL Throughput for 60 sec for 1TX/1RX
01 55 06 Band 7 FDD 5MHz UL Throughput for 60 sec for 2TX/2RX
01 55 07 Band 7 FDD 10MHz UL Throughput for 60 sec for 2TX/2RX
01 55 08 Band 7 FDD 20MHz UL Throughput for 60 sec for 2TX/2RX
01 55 09 Band 7 FDD 5MHz DL Throughput for 60 sec for 2TX/2RX
01 55 10 Band 7 FDD 10MHz DL Throughput for 60 sec for 2TX/2RX
01 55 11 Band 7 FDD 20MHz DL Throughput for 60 sec for 2TX/2RX
01 56 lte-softmodem tests with USRP B210 RF as eNB and OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE
01 57 lte-softmodem tests with USRP B210 RF as eNB and OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE
01 58 lte-softmodem tests with USRP X310 RF as eNB and ALU EPC w/ Bandrich COTS UE for `TX/1RX, 2TX/2RX
01 58 00 Band 7 FDD 5MHz UL Throughput for 60 sec for 1TX/1RX
01 58 01 Band 7 FDD 10MHz UL Throughput for 60 sec for 1TX/1RX
01 58 02 Band 7 FDD 20MHz UL Throughput for 60 sec for 1TX/1RX
01 58 03 Band 7 FDD 5MHz DL Throughput for 60 sec for 1TX/1RX
01 58 04 Band 7 FDD 10MHz DL Throughput for 60 sec for 1TX/1RX
01 58 05 Band 7 FDD 20MHz DL Throughput for 60 sec for 1TX/1RX
01 59 lte-softmodem tests with USRP X310 RF as eNB and OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE
01 61 lte-softmodem tests with USRP X310 RF as eNB and OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE
01 61 lte-softmodem tests with EXMIMO RF as eNB and ALU EPC w/ Bandrich COTS UE for `TX/1RX, 2TX/2RX
01 61 00 Band 7 FDD 5MHz UL Throughput for 60 sec for 1TX/1RX
01 61 01 Band 7 FDD 10MHz UL Throughput for 60 sec for 1TX/1RX
01 61 02 Band 7 FDD 20MHz UL Throughput for 60 sec for 1TX/1RX
01 61 03 Band 7 FDD 5MHz DL Throughput for 60 sec for 1TX/1RX
01 61 04 Band 7 FDD 10MHz DL Throughput for 60 sec for 1TX/1RX
01 61 05 Band 7 FDD 20MHz DL Throughput for 60 sec for 1TX/1RX
01 62 lte-softmodem tests with EXMIMO RF as eNB and OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE
01 63 lte-softmodem tests with EXMIMO RF as eNB and OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE
01 64 lte-softmodem-noS1 tests
02 Functional test case 02 Functional test case
......
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
# 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
find_open_port()
print 'Using Serial port : ' + serial_port
#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 192.172.0.1 ppp0')
os.system ('ping -c 5 192.172.0.1')
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)
for arg in sys.argv[1:]:
if arg == '--start-ue' :
start_ue()
elif arg == '--stop-ue' :
stop_ue()
else :
print " Script called with wrong arguments, arg = " + arg
sys.exit()
n=oarf_get_num_detected_cards;
for i=n-1:0
oarf_stop(i);
end
#!/bin/bash
################################################################################
# OpenAirInterface
# Copyright(c) 1999 - 2015 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 init_nas_nos1
# brief loads the nasmesh module and sets up the radio bearers (used to provide ip interface without S1 interface)
# author Florian Kaltenberger
#
#######################################
load_module()
{
mod_name=${1##*/}
mod_name=${mod_name%.*}
if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
then
echo "module $mod_name already loaded: I remove it first"
sudo rmmod $mod_name
fi
echo loading $mod_name
sudo insmod $1
}
function main()
{
PCI=`lspci -m | grep Xilinx`
if [ -z "$PCI" ]; then
echo "No card found. Stopping!"
return
fi
## This part corrects the wrong configuration of the endpoint done by the bios in some machines
echo "$PCI" | while read config_reg; do
SLOT_NUMBER=`echo $config_reg | awk -F\" '{print $1}'`
sudo setpci -s $SLOT_NUMBER 60.b=10
done
load_module $OPENAIR_DIR/targets/bin/openair_rf.ko
sleep 1
if [ ! -e /dev/openair0 ]; then
sudo mknod /dev/openair0 c 127 0
sudo chmod a+rw /dev/openair0
fi
DEVICE=`echo $PCI | awk -F\" '{print $(NF-1)}' | awk '{print $2}'`
DEVICE_SWID=${DEVICE:2:2}
if [ $DEVICE_SWID == '0a' ]; then
echo "Using firware version 10"
$OPENAIR_DIR/targets/bin/updatefw -s 0x43fffff0 -b -f $OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10
else
echo 'No corresponding firmware found'
return
fi
}
main "$@"
#!/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':
#string = (re.sub(r"mme_ip_address\s*=\s*\([^\$]+)\)\s*;\s*", r"<% tex \1 %>", t, re.M)
replacement_text = keyword + ' = ( { ' + replacement_text + ' } ) ; '
string = re.sub(r"mme_ip_address\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!
...@@ -54,6 +54,8 @@ CFLAGS_PROCESSOR_USER="" ...@@ -54,6 +54,8 @@ CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0 RUN_GROUP=0
TEST_CASE_GROUP="" TEST_CASE_GROUP=""
trap handle_ctrl_c INT
function print_help() { function print_help() {
echo_info ' echo_info '
This program installs OpenAirInterface Software This program installs OpenAirInterface Software
...@@ -80,8 +82,6 @@ Options ...@@ -80,8 +82,6 @@ Options
Makes the LTE softmodem Makes the LTE softmodem
--UE --UE
Makes the UE specific parts (ue_ip, usim, nvram) Makes the UE specific parts (ue_ip, usim, nvram)
--EPC
Makes the EPC (MME-SPGW, HSS)
--RRH --RRH
Makes the RRH Makes the RRH
-r | --3gpp-release -r | --3gpp-release
...@@ -116,8 +116,8 @@ Options ...@@ -116,8 +116,8 @@ Options
Usage (first build): Usage (first build):
oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files 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 Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files
NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB -x --install-system-files -w USRP
Usage (Regular): Usage (Regular):
oaisim : ./build_oai --oaisim -x oaisim : ./build_oai --oaisim -x
Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x
...@@ -159,10 +159,6 @@ function main() { ...@@ -159,10 +159,6 @@ function main() {
UE=1 UE=1
echo_info "Will compile UE" echo_info "Will compile UE"
shift;; shift;;
--EPC)
EPC=1
echo_info "Will compile EPC"
shift;;
--RRH) --RRH)
RRH=1 RRH=1
echo_info "Will compile RRH" echo_info "Will compile RRH"
...@@ -416,7 +412,7 @@ function main() { ...@@ -416,7 +412,7 @@ function main() {
# EXMIMO drivers & firmware loader # EXMIMO drivers & firmware loader
############### ###############
if [ "$HW" = "EXMIMO" -a "$EPC" = "0" ] ; then if [ "$HW" = "EXMIMO" ] ; then
echo_info "Compiling Express MIMO 2 board drivers" echo_info "Compiling Express MIMO 2 board drivers"
compilations \ compilations \
...@@ -554,42 +550,29 @@ function main() { ...@@ -554,42 +550,29 @@ function main() {
rrh_gw $dbin/rrh_gw rrh_gw $dbin/rrh_gw
fi 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 # Auto-tests
##################### #####################
if [ "$OAI_TEST" = "1" ]; then if [ "$OAI_TEST" = "1" ]; then
echo_info "10. Running OAI pre commit tests (pre-ci) ..." 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 rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
if [ "$RUN_GROUP" -eq "1" ]; then 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 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 fi
wait
else else
echo_info "10. Bypassing the Tests ..." echo_info "10. Bypassing the Tests ..."
fi fi
......
...@@ -111,7 +111,12 @@ compilations() { ...@@ -111,7 +111,12 @@ compilations() {
cd $OPENAIR_DIR/cmake_targets/$1/build cd $OPENAIR_DIR/cmake_targets/$1/build
{ {
rm -f $3 rm -f $3
if [ "$VERBOSE_COMPILE" == "1" ]; then
make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE
else
make -j`nproc` $2
fi
} > $dlog/$2.$REL.txt 2>&1 } > $dlog/$2.$REL.txt 2>&1
echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt" echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt"
if [ -s $3 ] ; then if [ -s $3 ] ; then
...@@ -158,22 +163,33 @@ install_gnutls_from_source(){ ...@@ -158,22 +163,33 @@ install_gnutls_from_source(){
check_install_usrp_uhd_driver(){ check_install_usrp_uhd_driver(){
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_usrp_uhd_driver_log.txt
echo_info "\nIn function: check_install_usrp_uhd_driver(). Installing USRP Drivers : The logfile for the installation is located here: $log_file "
(
v=$(lsb_release -cs) 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 "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
$SUDO apt-get update $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 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 -t `lsb_release -cs` uhd --force-yes
) >& $log_file
} }
check_install_bladerf_driver(){ check_install_bladerf_driver(){
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_bladerf_driver_log.txt
echo_info "\nIn function: check_install_bladerf_driver(). Install BLADERF drivers : The logfile for the installation is located here: $log_file "
(
$SUDO add-apt-repository -y ppa:bladerf/bladerf $SUDO add-apt-repository -y ppa:bladerf/bladerf
$SUDO apt-get update $SUDO apt-get update
$SUDO apt-get install -y bladerf libbladerf-dev $SUDO apt-get install -y bladerf libbladerf-dev
$SUDO apt-get install bladerf-firmware-fx3 $SUDO apt-get install -y bladerf-firmware-fx3
$SUDO apt-get install bladerf-fpga-hostedx40 $SUDO apt-get install -y bladerf-fpga-hostedx40
bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img
) >& $log_file
} }
check_install_additional_tools (){ check_install_additional_tools (){
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_additional_tools_log.txt
echo_info "\nIn function: check_install_oai_software(). Installing optional OAI packages : The logfile for the installation is located here: $log_file "
(
$SUDO apt-get update $SUDO apt-get update
$SUDO apt-get install -y \ $SUDO apt-get install -y \
check \ check \
...@@ -194,11 +210,16 @@ check_install_additional_tools (){ ...@@ -194,11 +210,16 @@ check_install_additional_tools (){
unzip \ unzip \
valgrind \ valgrind \
vlan \ vlan \
ctags ctags \
ntpdate
) >& $log_file
} }
check_install_oai_software() { check_install_oai_software() {
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_oai_software_log.txt
echo_info "\nIn function: check_install_oai_software(). Installing mandatory OAI packages : The logfile for the installation is located here: $log_file "
(
$SUDO apt-get update $SUDO apt-get update
$SUDO apt-get install -y \ $SUDO apt-get install -y \
autoconf \ autoconf \
...@@ -208,8 +229,8 @@ check_install_oai_software() { ...@@ -208,8 +229,8 @@ check_install_oai_software() {
cmake \ cmake \
cmake-curses-gui \ cmake-curses-gui \
doxygen \ doxygen \
doxygen-gui\ doxygen-gui \
texlive-latex-base\ texlive-latex-base \
ethtool \ ethtool \
flex \ flex \
gccxml \ gccxml \
...@@ -255,7 +276,11 @@ check_install_oai_software() { ...@@ -255,7 +276,11 @@ check_install_oai_software() {
openssl \ openssl \
python \ python \
subversion \ subversion \
xmlstarlet xmlstarlet \
python-pip \
pydb \
wvdial \
python-numpy
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
if [ `lsb_release -rs` = '12.04' ] ; then if [ `lsb_release -rs` = '12.04' ] ; then
install_nettle_from_source install_nettle_from_source
...@@ -263,20 +288,29 @@ check_install_oai_software() { ...@@ -263,20 +288,29 @@ check_install_oai_software() {
else else
$SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin $SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin
fi fi
$SUDO pip install paramiko
$SUDO pip install pyroute2
) > $log_file 2>&1
install_asn1c_from_source install_asn1c_from_source
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
} }
install_asn1c_from_source(){ 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 mkdir -p /tmp/asn1c-r1516
cd /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
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
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
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
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 >> /tmp/log_compile_asn1c
./configure ./configure
make > /tmp/log_compile_asn1c 2>&1 make -j`nproc`
$SUDO make install $SUDO make install
) > $asn1_install_dir 2>&1
} }
################################################# #################################################
...@@ -319,3 +353,42 @@ set_openair_env(){ ...@@ -319,3 +353,42 @@ set_openair_env(){
export OPENAIR_TARGETS=$openair_path/targets 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
}
File mode changed from 100644 to 100755
...@@ -68,7 +68,7 @@ declare MAX_RATE=1000 ...@@ -68,7 +68,7 @@ declare MAX_RATE=1000
# set paths to the required binaries and check if the required binaries are available # 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 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 BYPASSE_ITTI=0
OTGPLOT="$OPENAIR2_DIR/UTIL/OTG/OTGplot" OTGPLOT="$OPENAIR2_DIR/UTIL/OTG/OTGplot"
PS2PDF="ps2pdf" PS2PDF="ps2pdf"
...@@ -301,8 +301,8 @@ oaisim_otg_stats(){ ...@@ -301,8 +301,8 @@ oaisim_otg_stats(){
sync sync
if [ ! -f $OAISIM_EXEC ]; then if [ ! -f $OAISIM_EXEC ]; then
echo_info "3.1 compiling OAISIM ($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c)" echo_info "3.1 compiling OAISIM ($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1)"
($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c >> results/perf_log.txt 2>&1 ) ($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1 >> results/perf_log.txt 2>&1 )
build_stats=$? build_stats=$?
if [ $build_stats != 0 ] ; then if [ $build_stats != 0 ] ; then
echo_error "$OAISIM_EXEC cannot be built, check results/perf_log.txt file" echo_error "$OAISIM_EXEC cannot be built, check results/perf_log.txt file"
......
...@@ -24,15 +24,18 @@ xUnit_start() { ...@@ -24,15 +24,18 @@ xUnit_start() {
# \param $1 classname # \param $1 classname
# \param $2 testcase name # \param $2 testcase name
# \param $3 testcase result # \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() { xUnit_fail() {
class=$1 class=$1
test_case=$2 test_case=$2
result=$3 result=$3
run_index=$4 run_result=$4
xmlfile_testcase=$5
currtime=$(date +%s.%N) currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l) 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_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_FAILED=$((XUNIT_FAILED+1)) XUNIT_FAILED=$((XUNIT_FAILED+1))
} }
...@@ -43,15 +46,18 @@ xUnit_fail() { ...@@ -43,15 +46,18 @@ xUnit_fail() {
# \param $1 classname # \param $1 classname
# \param $2 testcase name # \param $2 testcase name
# \param $3 testcase result # \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() { xUnit_success() {
class=$1 class=$1
test_case=$2 test_case=$2
result=$3 result=$3
run_index=$4 run_result=$4
xmlfile_testcase=$5
currtime=$(date +%s.%N) currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l) 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_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_SUCCESS=$((XUNIT_SUCCESS+1)) XUNIT_SUCCESS=$((XUNIT_SUCCESS+1))
} }
......
...@@ -5,7 +5,8 @@ export OPENAIR1_DIR=$OPENAIR_HOME/openair1 ...@@ -5,7 +5,8 @@ export OPENAIR1_DIR=$OPENAIR_HOME/openair1
export OPENAIR2_DIR=$OPENAIR_HOME/openair2 export OPENAIR2_DIR=$OPENAIR_HOME/openair2
export OPENAIR3_DIR=$OPENAIR_HOME/openair3 export OPENAIR3_DIR=$OPENAIR_HOME/openair3
export OPENAIR_TARGETS=$OPENAIR_HOME/targets export OPENAIR_TARGETS=$OPENAIR_HOME/targets
export OPENAIRITS_DIR=$OPENAIR_HOME/openairITS
export PATH=$PATH:$OPENAIR_TARGETS/bin
alias oai='cd $OPENAIR_HOME' alias oai='cd $OPENAIR_HOME'
alias oai0='cd $OPENAIR0_DIR' alias oai0='cd $OPENAIR0_DIR'
......
...@@ -1102,8 +1102,12 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1102,8 +1102,12 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch[0]->harq_ids[subframe] = harq_pid; dlsch[0]->harq_ids[subframe] = harq_pid;
if (dlsch0_harq->round == 0) if (dlsch0_harq->round == 0) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch[0], harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
}
break; break;
...@@ -1237,6 +1241,9 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1237,6 +1241,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
if (dlsch0_harq->round == 0) { if (dlsch0_harq->round == 0) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch[0], harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid); // printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
// MCS and TBS don't change across HARQ rounds // MCS and TBS don't change across HARQ rounds
...@@ -1605,10 +1612,16 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1605,10 +1612,16 @@ int generate_eNB_dlsch_params_from_dci(int frame,
// reset HARQ process if this is the first transmission // reset HARQ process if this is the first transmission
if (dlsch0_harq->round == 0) { if (dlsch0_harq->round == 0) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch0, harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
} }
if (dlsch1_harq->round == 0) { if (dlsch1_harq->round == 0) {
/* necessary test? */
if (dlsch1_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch1, harq_pid);
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;
} }
...@@ -1986,10 +1999,16 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1986,10 +1999,16 @@ int generate_eNB_dlsch_params_from_dci(int frame,
// reset HARQ process if this is the first transmission // reset HARQ process if this is the first transmission
if ((dlsch0->active==1) && (dlsch0_harq->round == 0)) { if ((dlsch0->active==1) && (dlsch0_harq->round == 0)) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch0, harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
} }
if ((dlsch1->active==1) && (dlsch1_harq->round == 0)) { if ((dlsch1->active==1) && (dlsch1_harq->round == 0)) {
/* necessary test? */
if (dlsch1_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch1, harq_pid);
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;
} }
...@@ -2131,16 +2150,23 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2131,16 +2150,23 @@ int generate_eNB_dlsch_params_from_dci(int frame,
// check if either TB is disabled (see 36-213 V8.6 p. 26) // check if either TB is disabled (see 36-213 V8.6 p. 26)
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) {
LOG_W(PHY, "what to do with respect to remove_harq_pid_from_freelist?\n");
dlsch0_harq->status = DISABLED; dlsch0_harq->status = DISABLED;
}
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) {
LOG_W(PHY, "what to do with respect to remove_harq_pid_from_freelist?\n");
dlsch1_harq->status = DISABLED; dlsch1_harq->status = DISABLED;
}
dlsch0_harq->Nl = 1; dlsch0_harq->Nl = 1;
if (dlsch0_harq->round == 0) { if (dlsch0_harq->round == 0) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch0, harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid); // printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
} }
...@@ -2305,11 +2331,17 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2305,11 +2331,17 @@ int generate_eNB_dlsch_params_from_dci(int frame,
if ((dlsch0_harq->round == 0) && (dlsch0->active == 1) ) { if ((dlsch0_harq->round == 0) && (dlsch0->active == 1) ) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch0, harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
dlsch0_harq->mcs = mcs1; dlsch0_harq->mcs = mcs1;
} }
if ((dlsch1_harq->round == 0) && (dlsch1->active == 1) ) { if ((dlsch1_harq->round == 0) && (dlsch1->active == 1) ) {
/* necessary test? */
if (dlsch1_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch1, harq_pid);
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;
dlsch1_harq->mcs = mcs2; dlsch1_harq->mcs = mcs2;
} }
...@@ -2473,6 +2505,9 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2473,6 +2505,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
if (dlsch0_harq->round == 0) { if (dlsch0_harq->round == 0) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch0, harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid); // printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
} }
...@@ -2602,6 +2637,9 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2602,6 +2637,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
// dlsch0_harq->Ndi = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi; // dlsch0_harq->Ndi = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi;
if (dlsch0_harq->round == 0) { if (dlsch0_harq->round == 0) {
/* necessary test? */
if (dlsch0_harq->status == SCH_IDLE)
remove_harq_pid_from_freelist(dlsch0, harq_pid);
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid); // printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
} }
......
...@@ -258,6 +258,13 @@ typedef struct { ...@@ -258,6 +258,13 @@ typedef struct {
uint8_t error_threshold; uint8_t error_threshold;
/// Pointers to 8 HARQ processes for the DLSCH /// Pointers to 8 HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_processes[8]; 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 /// Number of soft channel bits
uint32_t G; uint32_t G;
/// Codebook index for this dlsch (0,1,2,3) /// Codebook index for this dlsch (0,1,2,3)
......
...@@ -152,6 +152,9 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne ...@@ -152,6 +152,9 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
for (i=0; i<10; i++) for (i=0; i<10; i++)
dlsch->harq_ids[i] = Mdlharq; dlsch->harq_ids[i] = Mdlharq;
dlsch->head_freelist = 0;
dlsch->tail_freelist = 0;
for (i=0; i<Mdlharq; i++) { for (i=0; i<Mdlharq; i++) {
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t)); 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", LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
...@@ -192,6 +195,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne ...@@ -192,6 +195,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
msg("Can't get harq_p %d\n",i); msg("Can't get harq_p %d\n",i);
exit_flag=3; exit_flag=3;
} }
put_harq_pid_in_freelist(dlsch, i);
} }
if (exit_flag==0) { if (exit_flag==0) {
......
...@@ -336,7 +336,9 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) ...@@ -336,7 +336,9 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
#else #else
#ifndef OAI_USRP #ifndef OAI_USRP
#ifndef OAI_BLADERF
phy_adjust_gain(phy_vars_ue,0); phy_adjust_gain(phy_vars_ue,0);
#endif
#endif #endif
#endif #endif
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#endif #endif
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index); extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
#if defined(OAI_USRP) || defined(EXMIMO) #if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF)
#include "common_lib.h" #include "common_lib.h"
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
#endif #endif
...@@ -96,10 +96,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -96,10 +96,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
#ifdef EXMIMO #ifdef EXMIMO
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]); len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]);
#endif #endif
#ifdef OAI_USRP #if defined(OAI_USRP) || defined(OAI_BLADERF)
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB); len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
#endif #endif
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF)
len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d), estimated carrier frequency %f Hz\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset,openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset); len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d), estimated carrier frequency %f Hz\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset,openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset);
#endif #endif
len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]); len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]);
......
...@@ -115,11 +115,11 @@ int32_t dot_product(int16_t *x, ...@@ -115,11 +115,11 @@ int32_t dot_product(int16_t *x,
// convert back to integer // convert back to integer
result = _mm_cvtsi64_si32(mmtmp7); result = _mm_cvtsi64_si32(mmtmp7);
return(result);
_mm_empty(); _mm_empty();
_m_empty(); _m_empty();
return(result);
#elif defined(__arm__) #elif defined(__arm__)
int16x4_t *x_128=(int16x4_t*)x; int16x4_t *x_128=(int16x4_t*)x;
int16x4_t *y_128=(int16x4_t*)y; int16x4_t *y_128=(int16x4_t*)y;
......
...@@ -94,7 +94,7 @@ static inline void cmacc(__m128i a,__m128i b, __m128i *re32, __m128i *im32) ...@@ -94,7 +94,7 @@ static inline void cmacc(__m128i a,__m128i b, __m128i *re32, __m128i *im32)
cmac_tmp = _mm_sign_epi16(b,*(__m128i*)reflip); cmac_tmp = _mm_sign_epi16(b,*(__m128i*)reflip);
// cmac_tmp = _mm_shufflelo_epi16(b,_MM_SHUFFLE(2,3,0,1)); // cmac_tmp = _mm_shufflelo_epi16(b,_MM_SHUFFLE(2,3,0,1));
// cmac_tmp = _mm_shufflehi_epi16(cmac_tmp,_MM_SHUFFLE(2,3,0,1)); // cmac_tmp = _mm_shufflehi_epi16(cmac_tmp,_MM_SHUFFLE(2,3,0,1));
cmac_tmp = _mm_shuffle_epi8(b,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2)); cmac_tmp = _mm_shuffle_epi8(cmac_tmp,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2));
cmac_tmp_im32 = _mm_madd_epi16(cmac_tmp,a); cmac_tmp_im32 = _mm_madd_epi16(cmac_tmp,a);
*re32 = _mm_add_epi32(*re32,cmac_tmp_re32); *re32 = _mm_add_epi32(*re32,cmac_tmp_re32);
...@@ -401,6 +401,8 @@ uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1); ...@@ -401,6 +401,8 @@ uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
int get_nCCE_offset(unsigned char L, int nCCE, int common_dci, unsigned short rnti, unsigned char subframe); int get_nCCE_offset(unsigned char L, int nCCE, int common_dci, unsigned short rnti, unsigned char subframe);
void put_harq_pid_in_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid);
void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid);
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB); int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
......
...@@ -136,6 +136,30 @@ uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t sched_su ...@@ -136,6 +136,30 @@ uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t sched_su
return(0); return(0);
} }
void put_harq_pid_in_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid)
{
DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->tail_freelist] = harq_pid;
DLSCH_ptr->tail_freelist = (DLSCH_ptr->tail_freelist + 1) % 10;
}
void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid)
{
if (DLSCH_ptr->head_freelist == DLSCH_ptr->tail_freelist) {
LOG_E(PHY, "%s:%d: you cannot read this!\n", __FILE__, __LINE__);
abort();
}
/* basic check, in case several threads deal with the free list at the same time
* in normal situations it should not happen, that's also why we don't use any
* locking mechanism to protect the free list
* to be refined in case things don't work properly
*/
if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) {
LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__);
abort();
}
DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10;
}
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB) int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB)
{ {
uint8_t i; uint8_t i;
...@@ -178,6 +202,7 @@ int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB) ...@@ -178,6 +202,7 @@ int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB)
int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction_flag) int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction_flag)
{ {
uint8_t i; uint8_t i;
int j;
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
if ((phy_vars_eNB->dlsch_eNB[i]==NULL) || (phy_vars_eNB->ulsch_eNB[i]==NULL)) { if ((phy_vars_eNB->dlsch_eNB[i]==NULL) || (phy_vars_eNB->ulsch_eNB[i]==NULL)) {
...@@ -196,6 +221,13 @@ int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction ...@@ -196,6 +221,13 @@ int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction
//phy_vars_eNB->eNB_UE_stats[i].crnti = 0; //phy_vars_eNB->eNB_UE_stats[i].crnti = 0;
memset(&phy_vars_eNB->eNB_UE_stats[i],0,sizeof(LTE_eNB_UE_stats)); memset(&phy_vars_eNB->eNB_UE_stats[i],0,sizeof(LTE_eNB_UE_stats));
// mac_exit_wrapper("Removing UE"); // mac_exit_wrapper("Removing UE");
/* clear the harq pid freelist */
phy_vars_eNB->dlsch_eNB[i][0]->head_freelist = 0;
phy_vars_eNB->dlsch_eNB[i][0]->tail_freelist = 0;
for (j = 0; j < 8; j++)
put_harq_pid_in_freelist(phy_vars_eNB->dlsch_eNB[i][0], j);
return(i); return(i);
} }
} }
...@@ -224,14 +256,12 @@ int8_t find_next_ue_index(PHY_VARS_eNB *phy_vars_eNB) ...@@ -224,14 +256,12 @@ int8_t find_next_ue_index(PHY_VARS_eNB *phy_vars_eNB)
int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t ul_flag) int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t ul_flag)
{ {
LTE_eNB_DLSCH_t *DLSCH_ptr; LTE_eNB_DLSCH_t *DLSCH_ptr;
LTE_eNB_ULSCH_t *ULSCH_ptr; LTE_eNB_ULSCH_t *ULSCH_ptr;
uint8_t ulsch_subframe,ulsch_frame; uint8_t ulsch_subframe,ulsch_frame;
uint8_t i; uint8_t i;
int8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][CC_id]); int8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][CC_id]);
int sf1=(10*frame)+subframe,sf2,sfdiff,sfdiff_max=7; int sf1=(10*frame)+subframe,sf2,sfdiff,sfdiff_max=7;
int first_proc_found=0;
if (UE_id==-1) { if (UE_id==-1) {
LOG_D(PHY,"Cannot find UE with rnti %x (Mod_id %d, CC_id %d)\n",rnti, Mod_id, CC_id); LOG_D(PHY,"Cannot find UE with rnti %x (Mod_id %d, CC_id %d)\n",rnti, Mod_id, CC_id);
...@@ -247,18 +277,7 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16 ...@@ -247,18 +277,7 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
for (i=0; i<DLSCH_ptr->Mdlharq; i++) { for (i=0; i<DLSCH_ptr->Mdlharq; i++) {
if (DLSCH_ptr->harq_processes[i]!=NULL) { if (DLSCH_ptr->harq_processes[i]!=NULL) {
if (DLSCH_ptr->harq_processes[i]->status != ACTIVE) { if (DLSCH_ptr->harq_processes[i]->status == ACTIVE) {
// store first inactive process
if (first_proc_found == 0) {
first_proc_found = 1;
*harq_pid = i;
*round = 0;
LOG_D(PHY,"process %d is first free process\n",i);
}
else {
LOG_D(PHY,"process %d is free\n",i);
}
} else {
sf2 = (DLSCH_ptr->harq_processes[i]->frame*10) + DLSCH_ptr->harq_processes[i]->subframe; sf2 = (DLSCH_ptr->harq_processes[i]->frame*10) + DLSCH_ptr->harq_processes[i]->subframe;
if (sf2<=sf1) if (sf2<=sf1)
sfdiff = sf1-sf2; sfdiff = sf1-sf2;
...@@ -270,7 +289,6 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16 ...@@ -270,7 +289,6 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
sfdiff_max = sfdiff; sfdiff_max = sfdiff;
*harq_pid = i; *harq_pid = i;
*round = DLSCH_ptr->harq_processes[i]->round; *round = DLSCH_ptr->harq_processes[i]->round;
first_proc_found = 1;
} }
} }
} else { // a process is not defined } else { // a process is not defined
...@@ -278,6 +296,14 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16 ...@@ -278,6 +296,14 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
return(-1); return(-1);
} }
} }
/* if no active harq pid, get the oldest in the freelist, if any */
if (*harq_pid == 255 && DLSCH_ptr->head_freelist != DLSCH_ptr->tail_freelist) {
*harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
*round = 0;
LOG_D(PHY,"process %d is first free process\n", *harq_pid);
}
LOG_D(PHY,"get_ue_active_harq_pid DL => Frame %d, Subframe %d : harq_pid %d\n", LOG_D(PHY,"get_ue_active_harq_pid DL => Frame %d, Subframe %d : harq_pid %d\n",
frame,subframe,*harq_pid); frame,subframe,*harq_pid);
} else { // This is a UL request } else { // This is a UL request
...@@ -296,7 +322,6 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16 ...@@ -296,7 +322,6 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
return(0); return(0);
} }
int CCE_table[800]; int CCE_table[800];
void init_nCCE_table(void) void init_nCCE_table(void)
...@@ -2868,6 +2893,7 @@ void process_HARQ_feedback(uint8_t UE_id, ...@@ -2868,6 +2893,7 @@ void process_HARQ_feedback(uint8_t UE_id,
dlsch_harq_proc->round = 0; dlsch_harq_proc->round = 0;
ue_stats->dlsch_l2_errors[dl_harq_pid[m]]++; ue_stats->dlsch_l2_errors[dl_harq_pid[m]]++;
dlsch_harq_proc->status = SCH_IDLE; dlsch_harq_proc->status = SCH_IDLE;
put_harq_pid_in_freelist(dlsch, dl_harq_pid[m]);
dlsch->harq_ids[dl_subframe] = dlsch->Mdlharq; dlsch->harq_ids[dl_subframe] = dlsch->Mdlharq;
} }
} else { } else {
...@@ -2880,6 +2906,7 @@ void process_HARQ_feedback(uint8_t UE_id, ...@@ -2880,6 +2906,7 @@ void process_HARQ_feedback(uint8_t UE_id,
// Received ACK so set round to 0 and set dlsch_harq_pid IDLE // Received ACK so set round to 0 and set dlsch_harq_pid IDLE
dlsch_harq_proc->round = 0; dlsch_harq_proc->round = 0;
dlsch_harq_proc->status = SCH_IDLE; dlsch_harq_proc->status = SCH_IDLE;
put_harq_pid_in_freelist(dlsch, dl_harq_pid[m]);
dlsch->harq_ids[dl_subframe] = dlsch->Mdlharq; dlsch->harq_ids[dl_subframe] = dlsch->Mdlharq;
ue_stats->total_TBS = ue_stats->total_TBS + ue_stats->total_TBS = ue_stats->total_TBS +
...@@ -3949,6 +3976,9 @@ void phy_procedures_eNB_RX(const unsigned char sched_subframe,PHY_VARS_eNB *phy_ ...@@ -3949,6 +3976,9 @@ void phy_procedures_eNB_RX(const unsigned char sched_subframe,PHY_VARS_eNB *phy_
phy_vars_eNB->eNB_UE_stats[i].sr_received++; phy_vars_eNB->eNB_UE_stats[i].sr_received++;
if (phy_vars_eNB->first_sr[i] == 1) { // this is the first request for uplink after Connection Setup, so clear HARQ process 0 use for Msg4 if (phy_vars_eNB->first_sr[i] == 1) { // this is the first request for uplink after Connection Setup, so clear HARQ process 0 use for Msg4
/* is this test necessary? */
if (phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->status != SCH_IDLE)
put_harq_pid_in_freelist(phy_vars_eNB->dlsch_eNB[i][0], 0);
phy_vars_eNB->first_sr[i] = 0; phy_vars_eNB->first_sr[i] = 0;
phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->round=0; phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->round=0;
phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->status=SCH_IDLE; phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->status=SCH_IDLE;
......
...@@ -1553,7 +1553,9 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t ...@@ -1553,7 +1553,9 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
#else #else
#ifndef OAI_USRP #ifndef OAI_USRP
#ifndef OAI_BLADERF
phy_adjust_gain (phy_vars_ue,0); phy_adjust_gain (phy_vars_ue,0);
#endif
#endif #endif
#endif #endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT);
......
...@@ -564,6 +564,10 @@ int main(int argc, char **argv) ...@@ -564,6 +564,10 @@ int main(int argc, char **argv)
sprintf(bler_fname,"ULbler_mcs%d_nrb%d_ChannelModel%d_nsim%d.csv",mcs,nb_rb,chMod,n_frames); sprintf(bler_fname,"ULbler_mcs%d_nrb%d_ChannelModel%d_nsim%d.csv",mcs,nb_rb,chMod,n_frames);
bler_fd = fopen(bler_fname,"w"); bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) {
fprintf(stderr,"Problem creating file %s\n",bler_fname);
exit(-1);
}
fprintf(bler_fd,"#SNR;mcs;nb_rb;TBS;rate;errors[0];trials[0];errors[1];trials[1];errors[2];trials[2];errors[3];trials[3]\n"); fprintf(bler_fd,"#SNR;mcs;nb_rb;TBS;rate;errors[0];trials[0];errors[1];trials[1];errors[2];trials[2];errors[3];trials[3]\n");
...@@ -572,13 +576,16 @@ int main(int argc, char **argv) ...@@ -572,13 +576,16 @@ int main(int argc, char **argv)
hostname[1023] = '\0'; hostname[1023] = '\0';
gethostname(hostname, 1023); gethostname(hostname, 1023);
printf("Hostname: %s\n", hostname); printf("Hostname: %s\n", hostname);
char dirname[FILENAME_MAX]; //char dirname[FILENAME_MAX];
sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname); //sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname);
mkdir(dirname, 0777); //mkdir(dirname, 0777);
sprintf(time_meas_fname,"%s/time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv", sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
dirname,
N_RB_DL,mcs,n_rx,channel_model_input,transmission_mode); N_RB_DL,mcs,n_rx,channel_model_input,transmission_mode);
time_meas_fd = fopen(time_meas_fname,"w"); time_meas_fd = fopen(time_meas_fname,"w");
if (time_meas_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",time_meas_fname);
exit(-1);
}
} }
/* /*
......
...@@ -52,7 +52,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf ...@@ -52,7 +52,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
openair0_dev_init_exmimo(device, openair0_cfg); openair0_dev_init_exmimo(device, openair0_cfg);
printf("openair0_dev_init_exmimo...\n"); printf("openair0_dev_init_exmimo...\n");
#elif OAI_USRP #elif OAI_USRP
device->type=USRP_IF; device->type=USRP_B200_IF;
openair0_dev_init_usrp(device, openair0_cfg); openair0_dev_init_usrp(device, openair0_cfg);
printf("openair0_dev_init_usrp ...\n"); printf("openair0_dev_init_usrp ...\n");
#elif OAI_BLADERF #elif OAI_BLADERF
......
...@@ -60,6 +60,11 @@ typedef enum { ...@@ -60,6 +60,11 @@ typedef enum {
max_gain=0,med_gain,byp_gain max_gain=0,med_gain,byp_gain
} rx_gain_t; } rx_gain_t;
typedef enum {
duplex_mode_TDD=1,duplex_mode_FDD=0
} duplex_mode_t;
/** @addtogroup _PHY_RF_INTERFACE_ /** @addtogroup _PHY_RF_INTERFACE_
* @{ * @{
*/ */
...@@ -76,6 +81,8 @@ typedef struct { ...@@ -76,6 +81,8 @@ typedef struct {
int Mod_id; int Mod_id;
// device log level // device log level
int log_level; int log_level;
//! duplexing mode
duplex_mode_t duplex_mode;
//! number of downlink resource blocks //! number of downlink resource blocks
int num_rb_dl; int num_rb_dl;
//! number of samples per frame //! number of samples per frame
...@@ -84,10 +91,10 @@ typedef struct { ...@@ -84,10 +91,10 @@ typedef struct {
double sample_rate; double sample_rate;
//! number of samples per RX/TX packet (USRP + Ethernet) //! number of samples per RX/TX packet (USRP + Ethernet)
int samples_per_packet; int samples_per_packet;
// delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist //! delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
int tx_delay; int tx_scheduling_advance;
//! adjust the position of the samples after delay when sending //! offset in samples between TX and RX paths
unsigned int tx_forward_nsamps; int tx_sample_advance;
//! number of RX channels (=RX antennas) //! number of RX channels (=RX antennas)
int rx_num_channels; int rx_num_channels;
//! number of TX channels (=TX antennas) //! number of TX channels (=TX antennas)
...@@ -98,6 +105,10 @@ typedef struct { ...@@ -98,6 +105,10 @@ typedef struct {
//! \brief Center frequency in Hz for TX. //! \brief Center frequency in Hz for TX.
//! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels //! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels
double tx_freq[4]; double tx_freq[4];
//! \brief Pointer to Calibration table for RX gains
rx_gain_calib_table_t *rx_gain_calib_table;
//! mode for rxgain (ExpressMIMO2) //! mode for rxgain (ExpressMIMO2)
rx_gain_t rxg_mode[4]; rx_gain_t rxg_mode[4];
//! \brief Gain for RX in dB. //! \brief Gain for RX in dB.
...@@ -147,8 +158,10 @@ typedef enum { ...@@ -147,8 +158,10 @@ typedef enum {
ETH_IF, ETH_IF,
/*!\brief device is ExpressMIMO */ /*!\brief device is ExpressMIMO */
EXMIMO_IF, EXMIMO_IF,
/*!\brief device is USRP*/ /*!\brief device is USRP B200/B210*/
USRP_IF, USRP_B200_IF,
/*!\brief device is USRP X300/X310*/
USRP_X300_IF,
/*!\brief device is BLADE RF*/ /*!\brief device is BLADE RF*/
BLADERF_IF, BLADERF_IF,
/*!\brief device is NONE*/ /*!\brief device is NONE*/
...@@ -180,7 +193,7 @@ struct openair0_device_t { ...@@ -180,7 +193,7 @@ struct openair0_device_t {
func_type_t func_type; func_type_t func_type;
/* RF frontend parameters set by application */ /* RF frontend parameters set by application */
openair0_config_t openair0_cfg; openair0_config_t *openair0_cfg;
/* Can be used by driver to hold internal structure*/ /* Can be used by driver to hold internal structure*/
void *priv; void *priv;
......
...@@ -316,7 +316,9 @@ typedef struct { ...@@ -316,7 +316,9 @@ typedef struct {
// //
// In TDD mode, there are two ways to control the RX/TX switch: // In TDD mode, there are two ways to control the RX/TX switch:
// 1. using the LSB from the TX data (TXRXSWITCH_LSB) // 1. using the LSB from the TX data (TXRXSWITCH_LSB)
// only the LSB from RF chain set in the ACTIVE_RF register controls the switch on all the chains
// 2. using FPGA logic, based on switch_offset[0..3] // 2. using FPGA logic, based on switch_offset[0..3]
// this mode is not tested well and should be used with care
#define DUPLEXMODE_MASK (1<<0) #define DUPLEXMODE_MASK (1<<0)
#define DUPLEXMODE_FDD 0 #define DUPLEXMODE_FDD 0
#define DUPLEXMODE_TDD (1<<0) #define DUPLEXMODE_TDD (1<<0)
...@@ -330,6 +332,11 @@ typedef struct { ...@@ -330,6 +332,11 @@ typedef struct {
#define SWITCHSTATE_1 (1<<3) #define SWITCHSTATE_1 (1<<3)
#define TEST_ADACLOOP_MASK (1<<4) #define TEST_ADACLOOP_MASK (1<<4)
#define TEST_ADACLOOP_EN (1<<4) #define TEST_ADACLOOP_EN (1<<4)
#define RF_ACTIVE_MASK (15<<5)
#define RF_ACTIVE_1 (1<<5)
#define RF_ACTIVE_2 (2<<5)
#define RF_ACTIVE_3 (4<<5)
#define RF_ACTIVE_4 (8<<5)
typedef enum { typedef enum {
BW5, BW5,
......
...@@ -296,6 +296,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -296,6 +296,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
int ant, card; int ant, card;
int resampling_factor=2; int resampling_factor=2;
int rx_filter=RXLPF25, tx_filter=TXLPF25; int rx_filter=RXLPF25, tx_filter=TXLPF25;
int ACTIVE_RF=0;
exmimo_config_t *p_exmimo_config; exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id; exmimo_id_t *p_exmimo_id;
...@@ -315,8 +316,6 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -315,8 +316,6 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
else else
p_exmimo_config->framing.eNB_flag = !UE_flag; p_exmimo_config->framing.eNB_flag = !UE_flag;
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
if (openair0_num_detected_cards==1) if (openair0_num_detected_cards==1)
p_exmimo_config->framing.multicard_syncmode=SYNCMODE_FREE; p_exmimo_config->framing.multicard_syncmode=SYNCMODE_FREE;
else if (card==0) else if (card==0)
...@@ -355,6 +354,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -355,6 +354,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
for (ant=0; ant<4; ant++) { for (ant=0; ant<4; ant++) {
if (openair0_cfg[card].rx_freq[ant] || openair0_cfg[card].tx_freq[ant]) { if (openair0_cfg[card].rx_freq[ant] || openair0_cfg[card].tx_freq[ant]) {
ACTIVE_RF += (1<<ant)<<5;
p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE; p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE;
p_exmimo_config->rf.do_autocal[ant] = 1;//openair0_cfg[card].autocal[ant]; p_exmimo_config->rf.do_autocal[ant] = 1;//openair0_cfg[card].autocal[ant];
printf("card %d, antenna %d, autocal %d\n",card,ant,openair0_cfg[card].autocal[ant]); printf("card %d, antenna %d, autocal %d\n",card,ant,openair0_cfg[card].autocal[ant]);
...@@ -408,6 +408,15 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -408,6 +408,15 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
} }
} }
if (openair0_cfg[card].duplex_mode==duplex_mode_FDD) {
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD;
printf("!!!!!setting FDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
}
else {
p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF;
printf("!!!!!setting TDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
}
ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card); ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card);
if (ret!=0) if (ret!=0)
......
...@@ -171,10 +171,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp ...@@ -171,10 +171,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif #endif
if (device->type == USRP_B200_IF) {
if (cc>1) { if (cc>1) {
// receive multiple channels (e.g. RF A and RF B) // receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs; std::vector<void *> buff_ptrs;
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff_tmp[i]); for (int i=0;i<cc;i++) buff_ptrs.push_back(buff_tmp[i]);
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md); samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
} else { } else {
...@@ -196,6 +197,19 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp ...@@ -196,6 +197,19 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif #endif
} }
} }
} else if (device->type == USRP_X300_IF) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff[i]);
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
} else {
// receive a single channel (e.g. from connector RF A)
samples_received = s->rx_stream->recv(buff[0], nsamps, s->rx_md);
}
}
if (samples_received < nsamps) { if (samples_received < nsamps) {
printf("[recv] received %d samples out of %d\n",samples_received,nsamps); printf("[recv] received %d samples out of %d\n",samples_received,nsamps);
...@@ -279,7 +293,7 @@ int trx_usrp_set_gains(openair0_device* device, ...@@ -279,7 +293,7 @@ int trx_usrp_set_gains(openair0_device* device,
exit(-1); exit(-1);
} }
s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]); s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
printf("Setting USRP RX gain to %f\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]); printf("Setting USRP RX gain to %f (rx_gain %f,gain_range.stop() %f)\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0],openair0_cfg[0].rx_gain[0],gain_range.stop());
return(0); return(0);
} }
...@@ -289,7 +303,7 @@ int trx_usrp_stop(int card) { ...@@ -289,7 +303,7 @@ int trx_usrp_stop(int card) {
} }
rx_gain_calib_table_t calib_table[] = { rx_gain_calib_table_t calib_table_b210[] = {
{3500000000.0,46.0}, {3500000000.0,46.0},
{2660000000.0,53.0}, {2660000000.0,53.0},
{2300000000.0,54.0}, {2300000000.0,54.0},
...@@ -297,19 +311,29 @@ rx_gain_calib_table_t calib_table[] = { ...@@ -297,19 +311,29 @@ rx_gain_calib_table_t calib_table[] = {
{816000000.0,62.0}, {816000000.0,62.0},
{-1,0}}; {-1,0}};
rx_gain_calib_table_t calib_table_x310[] = {
{3500000000.0,77.0},
{2660000000.0,80.0},
{2300000000.0,81.0},
{1880000000.0,82.0},
{816000000.0,85.0},
{-1,0}};
void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
int i=0; int i=0;
// loop through calibration table to find best adjustment factor for RX frequency // loop through calibration table to find best adjustment factor for RX frequency
double min_diff = 6e9,diff; double min_diff = 6e9,diff;
while (calib_table[i].freq>0) { while (openair0_cfg->rx_gain_calib_table[i].freq>0) {
diff = fabs(openair0_cfg->rx_freq[chain_index] - calib_table[i].freq); diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq);
printf("cal %d: freq %f, offset %f, diff %f\n", printf("cal %d: freq %f, offset %f, diff %f\n",
i,calib_table[i].freq,calib_table[i].offset,diff); i,
openair0_cfg->rx_gain_calib_table[i].freq,
openair0_cfg->rx_gain_calib_table[i].offset,diff);
if (min_diff > diff) { if (min_diff > diff) {
min_diff = diff; min_diff = diff;
openair0_cfg->rx_gain_offset[chain_index] = calib_table[i].offset; openair0_cfg->rx_gain_offset[chain_index] = openair0_cfg->rx_gain_calib_table[i].offset;
} }
i++; i++;
} }
...@@ -372,9 +396,43 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_ ...@@ -372,9 +396,43 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
// lock mboard clocks // lock mboard clocks
s->usrp->set_clock_source("internal"); s->usrp->set_clock_source("internal");
//Setting device type to USRP X300/X310
device->type=USRP_X300_IF;
// this is not working yet, master clock has to be set via constructor // this is not working yet, master clock has to be set via constructor
// set master clock rate and sample rate for tx & rx for streaming // set master clock rate and sample rate for tx & rx for streaming
//s->usrp->set_master_clock_rate(usrp_master_clock); //s->usrp->set_master_clock_rate(usrp_master_clock);
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
case 15360000:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 45;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 7680000:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 1920000:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
} else { } else {
printf("Found USRP B200"); printf("Found USRP B200");
s->usrp = uhd::usrp::multi_usrp::make(args); s->usrp = uhd::usrp::multi_usrp::make(args);
...@@ -386,16 +444,46 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_ ...@@ -386,16 +444,46 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
// // lock mboard clocks // // lock mboard clocks
// s->usrp->set_clock_source("internal"); // s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming // set master clock rate and sample rate for tx & rx for streaming
device->type = USRP_B200_IF;
s->usrp->set_master_clock_rate(30.72e6); s->usrp->set_master_clock_rate(30.72e6);
}
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 115;
openair0_cfg[0].tx_scheduling_advance = 11*openair0_cfg[0].samples_per_packet;
break;
case 15360000:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 113;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 7680000:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 70;//103;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 1920000:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 40;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
}
for(i=0;i<s->usrp->get_rx_num_channels();i++) { for(i=0;i<s->usrp->get_rx_num_channels();i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i); s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i); s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
printf("Setting rx freq/gain on channel %lu/%lu\n",i,s->usrp->get_rx_num_channels()); printf("Setting rx freq/gain on channel %lu/%lu : BW %f (readback %f)\n",i,s->usrp->get_rx_num_channels(),openair0_cfg[0].rx_bw/1e6,s->usrp->get_rx_bandwidth(i)/1e6);
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i); s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
set_rx_gain_offset(&openair0_cfg[0],i); set_rx_gain_offset(&openair0_cfg[0],i);
...@@ -416,7 +504,7 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_ ...@@ -416,7 +504,7 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
if (i<openair0_cfg[0].tx_num_channels) { if (i<openair0_cfg[0].tx_num_channels) {
s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i); s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i); s->usrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i);
printf("Setting tx freq/gain on channel %lu/%lu\n",i,s->usrp->get_tx_num_channels()); printf("Setting tx freq/gain on channel %lu/%lu: BW %f (readback %f)\n",i,s->usrp->get_tx_num_channels(),openair0_cfg[0].tx_bw/1e6,s->usrp->get_tx_bandwidth(i)/1e6);
s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i); s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i); s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i);
} }
......
...@@ -17,7 +17,7 @@ eNBs = ...@@ -17,7 +17,7 @@ eNBs =
mobile_country_code = "208"; mobile_country_code = "208";
mobile_network_code = "92"; mobile_network_code = "93";
////////// Physical parameters: ////////// Physical parameters:
...@@ -131,7 +131,7 @@ eNBs = ...@@ -131,7 +131,7 @@ eNBs =
}; };
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.13.11"; mme_ip_address = ( { ipv4 = "192.168.12.70";
ipv6 = "192:168:30::17"; ipv6 = "192:168:30::17";
active = "yes"; active = "yes";
preference = "ipv4"; preference = "ipv4";
...@@ -141,10 +141,10 @@ eNBs = ...@@ -141,10 +141,10 @@ eNBs =
NETWORK_INTERFACES : NETWORK_INTERFACES :
{ {
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24"; ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0"; ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_PORT_FOR_S1U = 2152; # Spec 2152
}; };
......
...@@ -35,7 +35,7 @@ eNBs = ...@@ -35,7 +35,7 @@ eNBs =
nb_antennas_tx = 1; nb_antennas_tx = 1;
nb_antennas_rx = 1; nb_antennas_rx = 1;
tx_gain = 32; tx_gain = 32;
rx_gain = 84; rx_gain = 116;
prach_root = 0; prach_root = 0;
prach_config_index = 0; prach_config_index = 0;
prach_high_speed = "DISABLE"; prach_high_speed = "DISABLE";
......
...@@ -35,7 +35,7 @@ eNBs = ...@@ -35,7 +35,7 @@ eNBs =
nb_antennas_tx = 1; nb_antennas_tx = 1;
nb_antennas_rx = 1; nb_antennas_rx = 1;
tx_gain = 32; tx_gain = 32;
rx_gain = 82; rx_gain = 120;
prach_root = 0; prach_root = 0;
prach_config_index = 0; prach_config_index = 0;
prach_high_speed = "DISABLE"; prach_high_speed = "DISABLE";
......
...@@ -17,7 +17,7 @@ eNBs = ...@@ -17,7 +17,7 @@ eNBs =
mobile_country_code = "208"; mobile_country_code = "208";
mobile_network_code = "92"; mobile_network_code = "93";
////////// Physical parameters: ////////// Physical parameters:
...@@ -36,7 +36,7 @@ eNBs = ...@@ -36,7 +36,7 @@ eNBs =
nb_antennas_tx = 1; nb_antennas_tx = 1;
nb_antennas_rx = 1; nb_antennas_rx = 1;
tx_gain = 60; tx_gain = 60;
rx_gain = 20; rx_gain = 120;
prach_root = 0; prach_root = 0;
prach_config_index = 0; prach_config_index = 0;
prach_high_speed = "DISABLE"; prach_high_speed = "DISABLE";
...@@ -46,7 +46,7 @@ eNBs = ...@@ -46,7 +46,7 @@ eNBs =
pucch_nRB_CQI = 1; pucch_nRB_CQI = 1;
pucch_nCS_AN = 0; pucch_nCS_AN = 0;
pucch_n1_AN = 32; pucch_n1_AN = 32;
pdsch_referenceSignalPower = -26; pdsch_referenceSignalPower = -29;
pdsch_p_b = 0; pdsch_p_b = 0;
pusch_n_SB = 1; pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE"; pusch_enable64QAM = "DISABLE";
...@@ -132,7 +132,7 @@ eNBs = ...@@ -132,7 +132,7 @@ eNBs =
}; };
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.13.11"; mme_ip_address = ( { ipv4 = "192.168.12.11";
ipv6 = "192:168:30::17"; ipv6 = "192:168:30::17";
active = "yes"; active = "yes";
preference = "ipv4"; preference = "ipv4";
...@@ -142,10 +142,10 @@ eNBs = ...@@ -142,10 +142,10 @@ eNBs =
NETWORK_INTERFACES : NETWORK_INTERFACES :
{ {
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24"; ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0"; ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_PORT_FOR_S1U = 2152; # Spec 2152
}; };
......
...@@ -36,7 +36,7 @@ eNBs = ...@@ -36,7 +36,7 @@ eNBs =
nb_antennas_tx = 1; nb_antennas_tx = 1;
nb_antennas_rx = 1; nb_antennas_rx = 1;
tx_gain = 90; tx_gain = 90;
rx_gain = 120; rx_gain = 132;
prach_root = 0; prach_root = 0;
prach_config_index = 0; prach_config_index = 0;
prach_high_speed = "DISABLE"; prach_high_speed = "DISABLE";
......
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