Commit 64e3d4f6 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'enhancement-10-harmony' of...

Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony

Conflicts:
	openair1/SCHED/phy_procedures_lte_eNb.c
parents f7b6d16c 456572c9
......@@ -32,3 +32,8 @@ job1:
- 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
- exce_log=`egrep -i 'warning|error|critical|exception' $NFS_TEST_RESULTS_DIR/log/python_autotest.log `
- if [ -n "$exce_log" ]; then echo -e "\e[31mThere are errors in $NFS_TEST_RESULTS_DIR/log/python_autotest.log. Please check the logs\e[0m" ; fi
- exce_log=`egrep -i 'warning|error|critical|exception' $NFS_TEST_RESULTS_DIR/log/python_autotest_cleanup.log `
- if [ -n "$exce_log" ]; then echo -e "\e[31mThere are errors in $NFS_TEST_RESULTS_DIR/log/python_autotest_cleanup.log. Please check the logs\e[0m" ; fi
OpenAirInterface is under GNU GPLv3 license. The full GNU General Public License is included in this distribution in the file called "COPYING".
The OpenAirInterface (OAI) software is composed of six different parts:
openair1: 3GPP LTE Rel-8 PHY layer + PHY RF simulation
openair2: 3GPP LTE Rel-9 RLC/MAC/PDCP/RRC implementations, eNB application, X2AP. Note that for RLC, the following versions are userL UM_v9.3.0, TM_v9.3.0, and AM_v9.3.0. For PDCP, PDCP_v10.1.0 is used. For RRC, only LITE is used.
openair3: 3GPP LTE Rel9 and 10 MME/NAS, S+P-GW, HSS, S1AP (ENB and MME).
common: some common OAI utilities, other tools can be found at openair2/UTILS
targets: scripts to compile and lauch different system targets (simulation, emulation and real-time platforms, user-space tools for these platforms (tbd))
see README files in these subdirectories for more information
see also https://twiki.eurecom.fr/twiki/bin/view/OpenAirInterface/WebHome
OpenAirInterface is under OpenAirInterface Software Alliance license.
├── http://www.openairinterface.org/?page_id=101
├── http://www.openairinterface.org/?page_id=698
The OpenAirInterface (OAI) software is composed of the following parts:
openairinterface5g
├── cmake_targets: build utilities to compile (simulation, emulation and real-time platforms), and generated build files
├── common : some common OAI utilities, other tools can be found at openair2/UTILS
├── COPYING
├── maketags : script to generate emacs tags
├── openair1 : 3GPP LTE Rel-10 PHY layer + PHY RF simulation and a subset of Rel 12 Features.
├── openair2 :3GPP LTE Rel-10 RLC/MAC/PDCP/RRC/X2AP implementation.
├── LAYER2/RLC/ with the following subdirectories: UM_v9.3.0, TM_v9.3.0, and AM_v9.3.0.
├── LAYER2/PDCP/PDCP_v10.1.0.
├── RRC/LITE
├── PHY_INTERFACE
├── X2AP
├── ENB_APP
├── openair3: 3GPP LTE Rel10 for S1AP, NAS GTPV1-U for both ENB and UE.
├── GTPV1-U
├── NAS
├── S1AP
├── SCTP
├── SECU
├── UDP
└── targets: top level wrapper for unitary simulation for PHY channels, system-level emulation (eNB-UE with and without S1), and realtime eNB and UE and RRH GW.
This diff is collapsed.
......@@ -29,10 +29,7 @@
# *******************************************************************************/
# \file test01.py
# \brief test 01 for OAI
# \author Navid Nikaein
# \date 2013 - 2015
# \author Rohit Gupta
# \version 0.1
# @ingroup _test
......@@ -316,12 +313,12 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logd
# \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box
# \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml)
def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop):
cmd = 'killall -q -r ' + programList
cmd = 'killall -9 -q -r ' + programList
result = oai.send(cmd, True)
print "Killing old programs..." + result
programArray = programList.split()
programListJoin = '|'.join(programArray)
cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail )>& $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync"
cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail ; echo \"Current disk space.. \" ; df -h )>& $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync"
result=oai.send_recv(cmd)
cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\''
#result = oai.send_recv(cmd)
......@@ -330,7 +327,7 @@ def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop):
print "Looking for old programs..." + result
res=oai.send_recv(CleanUpAluLteBox, True)
cmd = "( " + ExmimoRfStop + " ) >> $HOME/.oai_test_setup_cleanup.log.`hostname` ; sync "
res=oai.send_recv(cmd, False)
res=oai.send_recv(cmd, False, timeout=600)
#res = oai.send_recv(ExmimoRfStop, False)
cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync"
res=oai.send_recv(cmd)
......@@ -1529,9 +1526,8 @@ for testcase in testcaseList:
print "Now copying files to NFS Share"
oai_localhost = openair('localdomain','localhost')
oai_localhost.connect(user,pw)
cmd = ' rm -fr ' + NFSTestsResultsDir + ' ; mkdir -p ' + NFSTestsResultsDir
cmd = ' mkdir -p ' + NFSTestsResultsDir
res = oai_localhost.send_recv(cmd)
print "Deleting NFSTestResults Dir..." + res
print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir
SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all")
......@@ -1568,12 +1564,15 @@ res=os.system(cmd)
print "Now copying files to NFS Share"
oai_localhost = openair('localdomain','localhost')
oai_localhost.connect(user,pw)
cmd = ' rm -fr ' + NFSTestsResultsDir + ' ; mkdir -p ' + NFSTestsResultsDir
cmd = 'mkdir -p ' + NFSTestsResultsDir
res = oai_localhost.send_recv(cmd)
print "Deleting NFSTestResults Dir..." + res
print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir
SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all")
cmd = "cat " + NFSTestsResultsDir + "/log/*/*.xml > " + NFSTestsResultsDir + "/log/results_autotests.xml"
res = oai_localhost.send_recv(cmd)
oai_localhost.disconnect()
sys.exit()
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -33,6 +33,7 @@
import time
import serial
import os
from socket import AF_INET
from pyroute2 import IPRoute
import sys
import re
......@@ -62,7 +63,7 @@ def find_open_port():
while True:
if os.path.exists(serial_port) == True:
return serial_port
for port in range(2,100):
for port in range(0,100):
serial_port_tmp = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port_tmp) == True:
print 'New Serial Port : ' + serial_port_tmp
......@@ -97,11 +98,12 @@ signal.signal(signal.SIGINT, signal_handler)
#ser.isOpen()
class pppThread (threading.Thread):
def __init__(self, threadID, name, counter):
def __init__(self, threadID, name, counter,port):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = counter
self.port=port
def run(self):
print "Starting " + self.name
#Here we keep running pppd thread in indefinite loop as this script terminates sometimes
......@@ -111,6 +113,10 @@ class pppThread (threading.Thread):
print "Starting wvdial now..."
print 'exit_flag = ' + str(exit_flag)
send_command('AT+CGATT=1','OK', 300)
#Now we do search and replace on wvdial config file
cmd="sed -i \"s%Modem = .*%Modem = " + self.port + "%g\" " + bandrich_ppd_config
os.system(cmd)
os.system('wvdial -C ' + bandrich_ppd_config + '' )
if exit_flag == 1:
print "Exit flag set to true. Exiting pppThread now"
......@@ -141,10 +147,12 @@ def send_command (cmd, response, timeout):
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + traceback.format_exc()
print error
time.sleep(1)
def start_ue () :
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
global serial_port
timeout=60 #timeout in seconds
send_command('AT', 'OK' , timeout)
send_command('AT+CFUN=1' , 'OK' , timeout)
......@@ -152,23 +160,33 @@ def start_ue () :
send_command('AT+CGATT=1','OK', 300)
#os.system('wvdial -C ' + bandrich_ppd_config + ' &' )
thread_ppp = pppThread(1, "ppp_thread", 1)
thread_ppp = pppThread(1, "ppp_thread", 1,port=serial_port)
thread_ppp.start()
iface='ppp0'
#iface='ppp0'
while 1:
time.sleep ( 2)
iface=''
#Now we check if ppp0 interface is up and running
try:
if exit_flag == 1:
break
cmd="ifconfig -a | sed 's/[ \t].*//;/^$/d' | grep ppp"
status, out = commands.getstatusoutput(cmd)
iface=out
ip = IPRoute()
idx = ip.link_lookup(ifname=iface)[0]
os.system ('route add ' + gw + ' ppp0')
print "iface = " + iface
print " Setting route now..."
#os.system("status=1; while [ \"$status\" -ne \"0\" ]; do route add -host " + gw + ' ' + iface + " ; status=$? ;sleep 1; echo \"status = $status\" ; sleep 2; done ")
os.system ('route add -host ' + gw + ' ' + iface + ' 2> /dev/null')
#ip.route('add', dst=gw, oif=iface)
os.system('sleep 5')
os.system ('ping ' + gw)
break
#print "Starting ping now..."
os.system ('ping -c 1 ' + 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)
......@@ -200,24 +218,31 @@ def reset_ue():
ProductId=res[0][3]
usb_dir= find_usb_path(VendorId, ProductId)
print "Bandrich 4G LTE Adapter found in..." + usb_dir
print "Sleeping now for 45 seconds...please wait..."
cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 15" )
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 30" )
find_open_port()
stop_ue()
i=1
gw='192.172.0.1'
while i < len(sys.argv):
arg=sys.argv[i]
if arg == '--start-ue' :
print "Turning on UE..."
find_open_port()
print 'Using Serial port : ' + serial_port
start_ue()
elif arg == '--stop-ue' :
print "Turning off UE..."
find_open_port()
print 'Using Serial port : ' + serial_port
stop_ue()
elif arg == '--reset-ue' :
print "Resetting UE..."
find_open_port()
reset_ue()
elif arg == '-gw' :
gw = sys.argv[i+1]
......
......@@ -143,6 +143,7 @@ def send_command (cmd, response, timeout):
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + traceback.format_exc()
print error
time.sleep(1)
def start_ue () :
......@@ -211,6 +212,7 @@ def reset_ue():
os.system(cmd + " ; sleep 15" )
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 30" )
stop_ue()
i=1
gw='192.172.0.1'
......@@ -225,6 +227,7 @@ while i < len(sys.argv):
print 'Using Serial port : ' + serial_port
stop_ue()
elif arg == '--reset-ue' :
find_open_port()
reset_ue()
elif arg == '-gw' :
gw = sys.argv[i+1]
......
......@@ -43,7 +43,8 @@ def kill_processes(name):
cmd = 'sudo adb -s ' + device_id +' shell "ps |grep ' + name + '"'
status, out = commands.getstatusoutput(cmd)
if status != 0:
print "Error execting command to kill process " + name
print "Error executing command to kill process " + name
print "Error =" + out
sys.exit(1)
print "Out = " + out
if out=='':
......@@ -51,7 +52,7 @@ def kill_processes(name):
out_arr = out.split()
pid_to_kill = out_arr[1]
print "Now killing process ID " + pid_to_kill + " on Phone"
cmd = 'sudo adb -s ' + device_id +' shell "kill ' + pid_to_kill + '"'
cmd = 'sudo adb -s ' + device_id +' shell "kill -9 ' + pid_to_kill + '"'
status, out = commands.getstatusoutput(cmd)
if status != 0:
print "Error execting command to kill process " + name
......@@ -62,6 +63,7 @@ def start_ue () :
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
print 'Killing old iperf/ping sessions'
kill_processes('iperf')
kill_processes('iperf3')
kill_processes('ping')
print "Turning off airplane mode"
os.system('sudo -E adb devices')
......@@ -93,6 +95,7 @@ def stop_ue():
os.system('sudo adb -s ' + device_id + ' shell \"settings put global airplane_mode_on 1; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true\" ')
print "Killing iperf/ping sessions"
kill_processes('iperf')
kill_processes('iperf3')
kill_processes('ping')
i=1
......
#!/usr/bin/python
#******************************************************************************
# OpenAirInterface
# Copyright(c) 1999 - 2014 Eurecom
# OpenAirInterface is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# OpenAirInterface is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with OpenAirInterface.The full GNU General Public License is
# included in this distribution in the file called "COPYING". If not,
# see <http://www.gnu.org/licenses/>.
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
# *******************************************************************************/
# \author Navid Nikaein, Rohit Gupta
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=''
openair_dir = os.environ.get('OPENAIR_DIR')
if openair_dir == None:
print "Error getting OPENAIR_DIR environment variable"
sys.exit(1)
sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/'))
from lib_autotest import *
#Stop the USB BUS of USRPB210
def stop_usrpb210():
stringIdBandrich='National Instruments Corp.'
status, out = commands.getstatusoutput('lsusb | grep -i \'' + stringIdBandrich + '\'')
if (out == '') :
print "USRP B210 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 "USRP B210 found in..." + usb_dir
cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\""
os.system(cmd)
#Start the USB bus of USRP B210
def start_usrpb210():
stringIdBandrich='National Instruments Corp.'
status, out = commands.getstatusoutput('lsusb | grep -i \'' + stringIdBandrich + '\'')
if (out == '') :
print "USRP B210 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 "USRP B210 found in..." + usb_dir
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd)
i=1
while i < len(sys.argv):
arg=sys.argv[i]
if arg == '--start-usrpb210' :
start_usrpb210()
elif arg == '--stop-usrpb210' :
stop_usrpb210()
elif arg == '-h' :
print "--stop-usrpb210: Stop the USRP B210. It cannot be found in uhd_find_devices"
print "--start-usrpb210: Start the USRP B210. It can now be found in uhd_find_devices"
else :
print " Script called with wrong arguments, arg = " + arg
sys.exit()
i = i +1
#!/bin/bash
#******************************************************************************
# OpenAirInterface
# Copyright(c) 1999 - 2014 Eurecom
# OpenAirInterface is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# OpenAirInterface is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with OpenAirInterface.The full GNU General Public License is
# included in this distribution in the file called "COPYING". If not,
# see <http://www.gnu.org/licenses/>.
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
# *******************************************************************************/
# \author Navid Nikaein, Rohit Gupta
#arg1 timeout to wait before running the script
#arg2 interface
#arg3 iperf arguments
args=($*)
timeout=${args[0]}
iface=${args[1]}
iperf3_args=(${args[@]:2})
#array=${1:-1}
echo "args = ${args[@]}"
echo "timeout = $timeout"
echo "iface = $iface"
echo "iperf3_args = ${iperf3_args[@]}"
sleep $timeout
while true; do var=`ifconfig $iface` ;sleep 1; if [ "$var" != "" ]; then break; fi ; done ; sleep 5
iperf3 ${iperf3_args[@]}
#!/bin/bash
#******************************************************************************
# OpenAirInterface
# Copyright(c) 1999 - 2014 Eurecom
# OpenAirInterface is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# OpenAirInterface is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with OpenAirInterface.The full GNU General Public License is
# included in this distribution in the file called "COPYING". If not,
# see <http://www.gnu.org/licenses/>.
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
# *******************************************************************************/
# \author Navid Nikaein, Rohit Gupta
#arg1 timeout to wait before running the script
#arg2 interface
#arg3 iperf3 arguments
args=($*)
timeout=${args[0]}
device_id=${args[1]}
iperf3_args=(${args[@]:2})
#array=${1:-1}
echo "args = ${args[@]}"
echo "timeout = $timeout"
echo "device_id = $device_id"
echo "iperf3_args = ${iperf3_args[@]}"
sleep $timeout
while true ; do
cmd=`sudo adb -s $device_id shell netcfg |grep 192.`
if [ -z "$cmd" ]; then
echo "Wating for UE to connect and get IP Address..."
sleep 1
else
echo "UE is now connected. IP Address settings are... $cmd"
break
fi
done
echo "Starting iperf3 now..."
sudo adb -s $device_id shell /data/local/tmp/iperf3 ${iperf3_args[@]}
......@@ -54,9 +54,9 @@ 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':
elif keyword == 'IPV4_LIST' or keyword=='GUMMEI_LIST' or keyword == 'TAI_LIST':
replacement_text = keyword + ' = ( ' + replacement_text + ' ) ; '
string = re.sub(r"IPV4_LIST\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
string = re.sub(r"%s\s*=\s*\(([^\$]+?)\)\s*;" % keyword, replacement_text, string, re.M)
elif keyword == 'rrh_gw_config':
replacement_text = keyword + ' = ( { ' + replacement_text + ' } ) ; '
string = re.sub(r"rrh_gw_config\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
......
......@@ -45,8 +45,8 @@ MSC_GEN="False"
XFORMS="True"
PRINT_STATS="False"
VCD_TIMING="False"
LOWLATENCY_FLAG_USER="False"
FORCE_LOWLATENCY_FLAG_USER=""
DEADLINE_SCHEDULER_FLAG_USER="False"
FORCE_DEADLINE_SCHEDULER_FLAG_USER=""
CPU_AFFINITY_FLAG_USER="True" #Only valid when lowlatecy flag is set to False
REL="Rel10"
HW="None"
......@@ -58,6 +58,7 @@ CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0
TEST_CASE_GROUP=""
BUILD_DOXYGEN=0
T_TRACER="False"
trap handle_ctrl_c INT
function print_help() {
......@@ -125,9 +126,11 @@ Options
--disable-deadline
Disables deadline scheduler of Linux kernel (>=3.14.x).
--enable-deadline
Disables deadline scheduler of Linux kernel (>=3.14.x).
Enable deadline scheduler of Linux kernel (>=3.14.x).
--disable-cpu-affinity
Disables CPU Affinity between UHD/TX/RX Threads (Valid only when deadline scheduler is disabled). By defaulT, CPU Affinity is enabled when not using deadline scheduler. It is enabled only with >2 CPUs. For eNB, CPU_0-> Device library (UHD), CPU_1->TX Threads, CPU_2...CPU_MAX->Rx Threads. For UE, CPU_0->Device Library(UHD), CPU_1..CPU_MAX -> All the UE threads
--T-tracer
Enables the T tracer.
Usage (first build):
oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files
......@@ -259,17 +262,21 @@ function main() {
echo_info "Will build doxygen support"
shift;;
--disable-deadline)
FORCE_LOWLATENCY_FLAG_USER="False"
FORCE_DEADLINE_SCHEDULER_FLAG_USER="False"
echo_info "Disabling the usage of deadline scheduler"
shift 1;;
--enable-deadline)
FORCE_LOWLATENCY_FLAG_USER="True"
FORCE_DEADLINE_SCHEDULER_FLAG_USER="True"
echo_info "Enabling the usage of deadline scheduler"
shift 1;;
--disable-cpu-affinity)
CPU_AFFINITY_FLAG_USER="False"
echo_info "Disabling CPU Affinity (only valid when not using deadline scheduler)"
shift 1;;
--T-tracer)
T_TRACER="True"
echo_info "Enabling the T tracer"
shift 1;;
-h | --help)
print_help
exit 1;;
......@@ -314,33 +321,33 @@ function main() {
#By default: USRP: disable,
#By default: BLADERF: enable,
#By default: EXMIMO: enable
if [ "$FORCE_LOWLATENCY_FLAG_USER" = "" ]; then
if [ "$FORCE_DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
if [ "$HW" = "EXMIMO" ] ; then
LOWLATENCY_FLAG_USER="False"
DEADLINE_SCHEDULER_FLAG_USER="False"
elif [ "$HW" = "ETHERNET" ] ; then
LOWLATENCY_FLAG_USER="True"
DEADLINE_SCHEDULER_FLAG_USER="True"
elif [ "$HW" = "OAI_USRP" ] ; then
LOWLATENCY_FLAG_USER="False"
DEADLINE_SCHEDULER_FLAG_USER="False"
elif [ "$HW" = "OAI_BLADERF" ] ; then
LOWLATENCY_FLAG_USER="False"
DEADLINE_SCHEDULER_FLAG_USER="False"
elif [ "$HW" = "OAI_LMSSDR" ] ; then
LOWLATENCY_FLAG_USER="False"
DEADLINE_SCHEDULER_FLAG_USER="False"
elif [ "$HW" = "None" ] ; then
LOWLATENCY_FLAG_USER="False"
DEADLINE_SCHEDULER_FLAG_USER="False"
else
echo_error "Unknown HW type $HW. Exiting now..."
exit
fi
else
LOWLATENCY_FLAG_USER=$FORCE_LOWLATENCY_FLAG_USER
DEADLINE_SCHEDULER_FLAG_USER=$FORCE_DEADLINE_SCHEDULER_FLAG_USER
fi
#Disable CPU Affinity for deadline scheduler
if [ "$LOWLATENCY_FLAG_USER" = "True" ] ; then
if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then
CPU_AFFINITY_FLAG_USER="False"
fi
echo_info "Flags for Deadline scheduler: $LOWLATENCY_FLAG_USER"
echo_info "Flags for Deadline scheduler: $DEADLINE_SCHEDULER_FLAG_USER"
echo_info "Flags for CPU Affinity: $CPU_AFFINITY_FLAG_USER"
############################################
......@@ -432,8 +439,9 @@ 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 "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file
echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$lte_build_dir/build
cmake ..
......@@ -567,6 +575,7 @@ function main() {
echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
[ "$CLEAN" = "1" ] && rm -rf $DIR/$oaisim_build_dir/build
mkdir -p $DIR/$oaisim_build_dir/build
......@@ -632,6 +641,7 @@ function main() {
echo "set(XFORMS $XFORMS )" >> $cmake_file
echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
#[ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_mme_build_oai/build
#mkdir -p $DIR/oaisim_mme_build_oai/build
......@@ -660,8 +670,9 @@ function main() {
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo "set(TRANSP_PRO \"${TP}\")" >> $cmake_file
echo 'set(PACKAGE_NAME "\"rrh_gw\"")' >> $cmake_file
echo "set (LOWLATENCY \"${LOWLATENCY_FLAG_USER}\" )" >>$cmake_file
echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file
echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$rrh_build_dir/build
cmake ..
......@@ -692,7 +703,9 @@ function main() {
#add exmimo compilation
#TODO EXMIMO library support
compilations \
$build_dir oai_exmimodevif \
liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
echo_info "liboai_device.so is linked to EXMIMO device library"
elif [ "$HW" == "OAI_USRP" ] ; then
if [ -d "/usr/include/uhd" ] ; then
......
......@@ -29,7 +29,7 @@ set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( DEADLINE_SCHEDULER False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False)
......
......@@ -28,7 +28,7 @@ set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( DEADLINE_SCHEDULER False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False)
......
......@@ -29,7 +29,7 @@ set ( LINUX_LIST False )
set ( LINUX False )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD False )
set ( LOWLATENCY False )
set ( DEADLINE_SCHEDULER False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MIH_C_MEDIEVAL_EXTENSIONS False )
......
......@@ -28,7 +28,7 @@ set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD 1 )
set ( LOWLATENCY False )
set ( DEADLINE_SCHEDULER False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False )
......
......@@ -29,7 +29,7 @@ set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( DEADLINE_SCHEDULER False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False)
......
......@@ -226,7 +226,25 @@ check_install_additional_tools (){
valgrind \
vlan \
ctags \
ntpdate
ntpdate \
iperf3 \
android-tools-adb
$SUDO pip install paramiko
$SUDO pip install pyroute2
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
log_netiface=$OPENAIR_DIR/cmake_targets/log/netiface_install_log.txt
echo_info "Installing Netinterfaces package. The logfile for installation is in $log_netiface"
(
$SUDO rm -fr /tmp/netifaces-0.10.4.tar.gz /tmp/netifaces
wget -P /tmp https://pypi.python.org/packages/18/fa/dd13d4910aea339c0bb87d2b3838d8fd923c11869b1f6e741dbd0ff3bc00/netifaces-0.10.4.tar.gz
tar -xzvf /tmp/netifaces-0.10.4.tar.gz -C /tmp
cd /tmp/netifaces-0.10.4
$SUDO python setup.py install
cd -
) >& $log_netiface
}
check_install_oai_software() {
......@@ -302,11 +320,7 @@ check_install_oai_software() {
install_nettle_from_source
install_gnutls_from_source
$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(){
......@@ -314,14 +328,12 @@ install_asn1c_from_source(){
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
(
$SUDO rm -rf /tmp/asn1c-r1516
mkdir -p /tmp/asn1c-r1516
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516
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
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0 >> /tmp/log_compile_asn1c
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
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0
./configure
make -j`nproc`
$SUDO make install
......
......@@ -8,8 +8,12 @@ if [ "$OPENAIR_DIR" == "" ]; then
fi
sudo -E bash -c 'echo 3 > /proc/sys/vm/drop_caches'
#load the module
sudo -E $OPENAIR_DIR/cmake_targets/tools/init_exmimo2
exmimo_mod=`lsmod |grep openair_rf`
#load the module only if absent to avoid kernel crashes
if [ -z "$exmimo_mod" ]
then
sudo -E $OPENAIR_DIR/cmake_targets/tools/init_exmimo2
fi
#now we stop the card from transmitting anything
cd $OPENAIR_DIR/targets/bin
......
CC=gcc
CFLAGS=-Wall -g
GENIDS=genids
GENIDS_OBJS=genids.o
all : $(GENIDS) T_messages.txt.h T_IDs.h
$(GENIDS): $(GENIDS_OBJS)
$(CC) $(CFLAGS) -o $(GENIDS) $(GENIDS_OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
T_messages.txt.h: T_messages.txt
xxd -i T_messages.txt > T_messages.txt.h
T_IDs.h: $(GENIDS) T_messages.txt
./$(GENIDS) T_messages.txt T_IDs.h
clean:
rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h
cd tracer && make clean
#include "T.h"
#include "T_messages.txt.h"
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/socket.h>
#define QUIT(x) do { \
printf("T tracer: QUIT: %s\n", x); \
exit(1); \
} while (0)
/* array used to activate/disactivate a log */
static int T_IDs[T_NUMBER_OF_IDS];
int *T_active = T_IDs;
static int T_socket;
/* T_cache
* - the T macro picks up the head of freelist and marks it busy
* - the T sender thread periodically wakes up and sends what's to be sent
*/
volatile int _T_freelist_head;
volatile int *T_freelist_head = &_T_freelist_head;
T_cache_t *T_cache;
static void get_message(int s)
{
char t;
int l;
int id;
int is_on;
if (read(s, &t, 1) != 1) QUIT("get_message fails");
printf("got mess %d\n", t);
switch (t) {
case 0:
/* toggle all those IDs */
/* optimze? (too much syscalls) */
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
while (l) {
if (read(s, &id, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
T_IDs[id] = 1 - T_IDs[id];
l--;
}
break;
case 1:
/* set IDs as given */
/* optimize? */
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
id = 0;
while (l) {
if (read(s, &is_on, sizeof(int)) != sizeof(int))
QUIT("get_message fails");
T_IDs[id] = is_on;
id++;
l--;
}
break;
case 2: break; /* do nothing, this message is to wait for local tracer */
}
}
static void *T_receive_thread(void *_)
{
while (1) get_message(T_socket);
return NULL;
}
static void new_thread(void *(*f)(void *), void *data)
{
pthread_t t;
pthread_attr_t att;
if (pthread_attr_init(&att))
{ fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
{ fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
if (pthread_create(&t, &att, f, data))
{ fprintf(stderr, "pthread_create err\n"); exit(1); }
if (pthread_attr_destroy(&att))
{ fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
}
/* defined in local_tracer.c */
void T_local_tracer_main(int remote_port, int wait_for_tracer,
int local_socket);
/* We monitor the tracee and the local tracer processes.
* When one dies we forcefully kill the other.
*/
#include <sys/types.h>
#include <sys/wait.h>
static void monitor_and_kill(int child1, int child2)
{
int child;
int status;
child = wait(&status);
if (child == -1) perror("wait");
kill(child1, SIGKILL);
kill(child2, SIGKILL);
exit(0);
}
void T_init(int remote_port, int wait_for_tracer)
{
int socket_pair[2];
int s;
int T_shm_fd;
unsigned char *buf;
int len;
int child1, child2;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair))
{ perror("socketpair"); abort(); }
/* child1 runs the local tracer and child2 runs the tracee */
child1 = fork(); if (child1 == -1) abort();
if (child1 == 0) {
close(socket_pair[1]);
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0]);
exit(0);
}
close(socket_pair[0]);
child2 = fork(); if (child2 == -1) abort();
if (child2 != 0) {
close(socket_pair[1]);
monitor_and_kill(child1, child2);
}
s = socket_pair[1];
/* wait for first message - initial list of active T events */
get_message(s);
T_socket = s;
/* setup shared memory */
T_shm_fd = shm_open(T_SHM_FILENAME, O_RDWR /*| O_SYNC*/, 0666);
shm_unlink(T_SHM_FILENAME);
if (T_shm_fd == -1) { perror(T_SHM_FILENAME); abort(); }
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, T_shm_fd, 0);
if (T_cache == NULL)
{ perror(T_SHM_FILENAME); abort(); }
close(T_shm_fd);
new_thread(T_receive_thread, NULL);
/* trace T_message.txt
* Send several messages -1 with content followed by message -2.
* We can't use the T macro directly, events -1 and -2 are special.
*/
buf = T_messages_txt;
len = T_messages_txt_len;
while (len) {
int send_size = len;
if (send_size > T_PAYLOAD_MAXSIZE - sizeof(int))
send_size = T_PAYLOAD_MAXSIZE - sizeof(int);
do {
T_LOCAL_DATA
T_HEADER(T_ID(-1));
T_PUT_buffer(1, ((T_buffer){addr:(buf), length:(len)}));
T_COMMIT();
} while (0);
buf += send_size;
len -= send_size;
}
do {
T_LOCAL_DATA
T_HEADER(T_ID(-2));
T_COMMIT();
} while (0);
}
This diff is collapsed.
#ifndef _T_defs_H_
#define _T_defs_H_
/* comment (and recompile everything) to not send time in events */
#define T_SEND_TIME
/* maximum number of arguments for the T macro */
#define T_MAX_ARGS 16
/* maximum size of a message - increase if needed */
#define T_BUFFER_MAX (1024*64)
/* size of the local cache for messages (must be pow(2,something)) */
#define T_CACHE_SIZE (8192 * 2)
/* maximum number of bytes a message can contain */
#ifdef T_SEND_TIME
# define T_PAYLOAD_MAXSIZE (T_BUFFER_MAX-sizeof(int)-sizeof(struct timespec))
#else
# define T_PAYLOAD_MAXSIZE (T_BUFFER_MAX-sizeof(int))
#endif
typedef struct {
volatile int busy;
char buffer[T_BUFFER_MAX];
int length;
} T_cache_t;
#define T_SHM_FILENAME "/T_shm_segment"
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_FUNCTIONS 146
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_VARIABLES 99
/* first VCD function (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
/* first VCD variable (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_VARIABLE ((uintptr_t)T_VCD_VARIABLE_FRAME_NUMBER_TX_ENB)
#endif /* _T_defs_H_ */
This diff is collapsed.
#ifndef _TRACER_DEFS_H_
#define _TRACER_DEFS_H_
/* types of plots */
#define PLOT_VS_TIME 0
#define PLOT_IQ_POINTS 1
#define PLOT_MINMAX 2
void new_thread(void *(*f)(void *), void *data);
/* ... is { int count; int type; char *color; } for 'nplots' plots */
void *make_plot(int width, int height, char *title, int nplots, ...);
void plot_set(void *plot, float *data, int len, int pos, int pp);
void iq_plot_set(void *plot, short *data, int len, int pos, int pp);
void iq_plot_set_sized(void *_plot, short *data, int len, int pp);
void iq_plot_add_iq_point_loop(void *_plot, short i, short q, int pp);
void iq_plot_add_energy_point_loop(void *_plot, int e, int pp);
/* returns an opaque pointer - truly a 'database *', see t_data.c */
void *parse_database(char *filename);
void dump_database(void *database);
void list_ids(void *database);
void list_groups(void *database);
void on_off(void *d, char *item, int *a, int onoff);
void *forwarder(char *ip, int port);
void forward(void *forwarder, char *buf, int size);
void forward_start_client(void *forwarder, int socket);
#endif /* _TRACER_DEFS_H_ */
#include <stdio.h>
void print(int n)
{
int i;
printf("#define T%d(t", n);
for(i=0; i<(n-1)/2; i++) printf(",t%d,x%d", i, i);
printf(") \\\n");
printf(" do { \\\n");
printf(" if (T_ACTIVE(t)) { \\\n");
printf(" T_LOCAL_DATA \\\n");
printf(" T_HEADER(t); \\\n");
for(i=0; i<(n-1)/2; i++) printf(" T_PUT_##t%d(%d, x%d); \\\n", i, i+2, i);
printf(" T_COMMIT(); \\\n");
printf(" } \\\n");
printf(" } while (0)\n");
printf("\n");
}
int main(void)
{
int i;
for (i = 11; i <= 33; i+=2) print(i);
return 0;
}
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char **unique_ids;
int unique_ids_size;
int unique_ids_maxsize;
int cmp(const void *p1, const void *p2)
{
return strcmp(*(char * const *)p1, *(char * const *)p2);
}
/* return 1 if s was not already known, 0 if it was */
int new_unique_id(char *s)
{
if (unique_ids_size)
if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
printf("FATAL: ID %s is not unique\n", s);
return 0;
}
if (unique_ids_size == unique_ids_maxsize) {
unique_ids_maxsize += 256;
unique_ids = realloc(unique_ids, unique_ids_maxsize * sizeof(char *));
if (unique_ids == NULL) { printf("out of memory\n"); abort(); }
}
unique_ids[unique_ids_size] = strdup(s);
if (unique_ids[unique_ids_size] == NULL)
{ printf("out of memory\n"); abort(); }
unique_ids_size++;
qsort(unique_ids, unique_ids_size, sizeof(char *), cmp);
return 1;
}
char *bufname;
int bufname_size;
int bufname_maxsize;
void putname(int c)
{
if (bufname_size == bufname_maxsize) {
bufname_maxsize += 256;
bufname = realloc(bufname, bufname_maxsize);
if (bufname == NULL) { printf("memory allocation error\n"); exit(1); }
}
bufname[bufname_size] = c;
bufname_size++;
}
char *bufvalue;
int bufvalue_size;
int bufvalue_maxsize;
void putvalue(int c)
{
if (bufvalue_size == bufvalue_maxsize) {
bufvalue_maxsize += 256;
bufvalue = realloc(bufvalue, bufvalue_maxsize);
if (bufvalue == NULL) { printf("memory allocation error\n"); exit(1); }
}
bufvalue[bufvalue_size] = c;
bufvalue_size++;
}
void smash_spaces(FILE *f)
{
int c;
while (1) {
c = fgetc(f);
if (isspace(c)) continue;
if (c == ' ') continue;
if (c == '\t') continue;
if (c == '\n') continue;
if (c == 10 || c == 13) continue;
if (c == '#') {
while (1) {
c = fgetc(f);
if (c == '\n' || c == EOF) break;
}
continue;
}
break;
}
if (c != EOF) ungetc(c, f);
}
void get_line(FILE *f, char **name, char **value)
{
int c;
bufname_size = 0;
bufvalue_size = 0;
*name = NULL;
*value = NULL;
smash_spaces(f);
c = fgetc(f);
while (!(c == '=' || isspace(c) || c == EOF)) { putname(c); c = fgetc(f); }
if (c == EOF) return;
putname(0);
while (!(c == EOF || c == '=')) c = fgetc(f);
if (c == EOF) return;
smash_spaces(f);
c = fgetc(f);
while (!(c == 10 || c == 13 || c == EOF)) { putvalue(c); c = fgetc(f); }
putvalue(0);
if (bufname_size <= 1) return;
if (bufvalue_size <= 1) return;
*name = bufname;
*value = bufvalue;
}
int main(int n, char **v)
{
FILE *in;
FILE *out;
char *name;
char *value;
char *in_name;
char *out_name;
if (n != 3) { printf("gimme <source> <dest>\n"); exit(1); }
n = 0;
in_name = v[1];
out_name = v[2];
in = fopen(in_name, "r"); if (in == NULL) { perror(in_name); exit(1); }
out = fopen(out_name, "w"); if (out == NULL) { perror(out_name); exit(1); }
fprintf(out, "/* generated file, do not edit by hand */\n\n");
while (1) {
get_line(in, &name, &value);
if (name == NULL) break;
printf("name '%s' value '%s'\n", name, value);
if (isspace(value[strlen(value)-1])) {
printf("bad value '%s' (no space at the end please!)\n", value);
unlink(out_name);
exit(1);
}
if (!strcmp(name, "ID")) {
if (!new_unique_id(value)) { unlink(out_name); exit(1); }
fprintf(out, "#define T_%s T_ID(%d)\n", value, n);
n++;
}
}
fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n);
fclose(in);
fclose(out);
return 0;
}
This diff is collapsed.
This diff is collapsed.
CC=gcc
CFLAGS=-Wall -g -pthread -DT_TRACER -I.
PROG=tracee
OBJS=tracee.o ../T.o
$(PROG): $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS) -lrt
tracee.o: tracee.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o $(PROG) core
this is a very basic tracee, used to debug the tracer
#include "../T.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int frame = 0;
T_connect_to_tracer("127.0.0.1", 2020);
while (1) {
getchar();
T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(0), T_INT(0), T_INT(frame), T_INT(0), T_INT(0), T_INT(0));
frame++;
}
return 0;
}
CC=gcc
CFLAGS=-Wall -g -pthread -DT_TRACER -I.
#CFLAGS += -O3 -ffast-math -fomit-frame-pointer
LIBS=-lX11 -lm -lpng -lXft
all: textlog enb vcd
textlog: utils.o textlog.o database.o event.o handler.o config.o \
event_selector.o view/view.a gui/gui.a logger/logger.a \
filter/filter.a
$(CC) $(CFLAGS) -o textlog $^ $(LIBS)
enb: utils.o enb.o database.o event.o handler.o config.o \
event_selector.o view/view.a gui/gui.a logger/logger.a \
filter/filter.a
$(CC) $(CFLAGS) -o enb $^ $(LIBS)
vcd: utils.o vcd.o database.o event.o handler.o config.o \
event_selector.o view/view.a gui/gui.a logger/logger.a \
filter/filter.a
$(CC) $(CFLAGS) -o vcd $^ $(LIBS)
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
gui/gui.a:
cd gui && make
view/view.a:
cd view && make
logger/logger.a:
cd logger && make
filter/filter.a:
cd filter && make
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o core tracer_remote textlog enb vcd
cd gui && make clean
cd view && make clean
cd logger && make clean
cd filter && make clean
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.
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