Commit 152ecfbe authored by Xiwen JIANG's avatar Xiwen JIANG

Merge branch 'develop' into feature-21-TM7

Conflicts:
	targets/RT/USER/lte-enb.c
parents 7f63f23f 3bf8768d
......@@ -34,4 +34,5 @@ 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
when: manual
only:
- triggers
This diff is collapsed.
......@@ -75,7 +75,7 @@ class openair(core):
return (stdout, stderr)
def connect(self, username, password, prompt='PEXPECT_OAI'):
max_retries=100
max_retries=10
i=0
while i <= max_retries:
self.prompt1 = prompt
......@@ -97,9 +97,9 @@ class openair(core):
# need to look for twice the string of the prompt
self.oai.prompt()
self.oai.prompt()
self.oai.sendline('uptime')
self.oai.prompt()
print self.oai.before
# self.oai.sendline('uptime')
# self.oai.prompt()
# print self.oai.before
break
except Exception, e:
error=''
......@@ -171,7 +171,7 @@ class openair(core):
sys.exit(1)
def disconnect(self):
print 'disconnecting the ssh connection to ' + self.address + '\n'
# print 'disconnecting the ssh connection to ' + self.address + '\n'
self.oai.send('exit')
# self.cancel()
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>OAI5G UE Autotest Report</title>
<script type="text/javascript">
function showhide(id) {
var e = document.getElementById(id);
e.style.display = (e.style.display == 'block') ? 'none' : 'block';
}
</script>
</head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
</style>
<body>
<center>
<h2>OAI5G UE Autotest Report</h2>
</center>
<p>
<table border>
<caption>Test session configuration</caption>
<tr><td>Start time</td><td>{{test_session_start_time}}</td></tr>
<tr><td>Stop time</td><td>{{test_session_stop_time}}</td></tr>
<tr><td>Duration</td><td>{{test_session_duration}}</td></tr>
<tr><td>MTC host</td><td>{{mtc_host}}</td></tr>
<tr><td>User</td><td>{{user}}</td></tr>
<tr><td>Password</td><td>{{password}}</td></tr>
</table>
</p>
<h3>Test Setup</h3>
To be complete
<br></br>
<h3>UE phy-test performances tests results</h3>
<h4>Objectives</h4>
<p>Checks that OAI UE can achieve at least 75 percent of the theoretical throughput.</p>
<p>Tests are done for all MCS (0 to 28) for 5MHz and 10MHz bandwidth.</p>
<h4>Results</h4>
<table>
<TR><TH>ID</TH><TH>TAG</TH><TH>VERDICT</TH><TH>NB RUNS</TH><TH>PASS</TH><TH>FAILED</TH><TH>INCON</TH><TH>SKIPPED</TH><TH>SEG FAULT</TH><TH>TC Timeout</TH><TH>Start</TH><TH>Stop</TH><TH>Duration</TH><TH>Details</TH></TR>
{% for result in test_results|sort(attribute='testcase_name') %}
<TR>
<TD >{{result.testcase_name}}</TD>
<TD align="right">{{result.tags}}</TD>
{% if result.testcase_verdict == "PASS" %}
<TD align="center" style="background-color:green">{{result.testcase_verdict}}</TD>
{% elif result.testcase_verdict == "FAIL" %}
<TD align="center" style="background-color:red">{{result.testcase_verdict}}</TD>
{% else %}
<TD align="center" style="background-color:orange">{{result.testcase_verdict}}</TD>
{% endif %}
<TD align='center'>{{result.nruns}}</TD>
<TD align='center'>{{result.nb_run_pass}}</TD>
<TD align='center'>{{result.nb_run_failed}}</TD>
<TD align='center'>{{result.nb_run_inc}}</TD>
<TD align='center'>{{result.nb_run_skip}}</TD>
<TD align='center'>{{result.nb_seg_fault}}</TD>
<TD >{{result.testcase_timeout}}</TD>
<TD >{{result.testcase_time_start.strftime('%Y-%m-%d %H:%M:%S')}}</TD>
<TD >{{result.testcase_time_stop.strftime('%Y-%m-%d %H:%M:%S')}}</TD>
<TD >{{result.testcase_duration}}</TD>
<TD ><a href="{{ result.testcase_name }}/{{ result.testcase_name }}_report.html">{{ result.testcase_name }}_report.html</a></TD>
</TR>
{% endfor %}
</table>
<br></br>
<h3>UE phy-test stability tests results</h3>
<h4>Objectives</h4>
<p>To be complete</p>
<h4>Results</h4>
To be complete
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>OAI5G UE test case report</title>
<script type="text/javascript">
function showhide(id) {
var e = document.getElementById(id);
e.style.display = (e.style.display == 'block') ? 'none' : 'block';
}
</script>
</head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
</style>
<body>
<center>
<h2>OAI5G UE test case report details</h2>
</center>
<h3>Test Case description</h3>
<p>
<table border>
<tr><td>ID</td><td>{{testcase_name}}</td></tr>
<tr><td>TAG</td><td>{{tags}}</td></tr>
<tr><td>class</td><td>{{testcaseclass}}</td></tr>
<tr><td>description</td><td></td></tr>
<tr><td>timeout</td><td>{{testcase_timeout}}</td></tr>
<tr><td>number of runs</td><td>{{nruns}}</td></tr>
<tr><td>eNB machine</td><td>{{testcase_eNBMachine}}</td></tr>
<tr><td>UE machine</td><td>{{testcase_UEMachine}}</td></tr>
</table>
</p>
<h3>Test Case execution</h3>
<p>
<table border>
<tr><td>testcase_time_start</td><td>{{testcase_time_start}}</td></tr>
<tr><td>testcase_time_stop</td><td>{{testcase_time_stop}}</td></tr>
<tr><td>testcase_duration</td><td>{{testcase_duration}}</td></tr>
<tr><td>Nb runs</td><td>{{nruns}}</td></tr>
<tr><td>Nb PASS</td><td>{{nb_run_pass}}</td></tr>
<tr><td>Nb FAILED</td><td>{{nb_run_failed}}</td></tr>
<tr><td>Nb INCONCLUSIVE</td><td>{{nb_run_inc}}</td></tr>
<tr>
<td>testcase_verdict</td>
{% if testcase_verdict == "PASS" %}
<TD align="center" style="background-color:green">{{testcase_verdict}}</TD>
{% elif testcase_verdict == "FAIL" %}
<TD align="center" style="background-color:red">{{testcase_verdict}}</TD>
{% else %}
<TD align="center" style="background-color:orange">{{testcase_verdict}}</TD>
{% endif %}
</tr>
<tr><td>Nb Seg Fault</td><td>{{nb_seg_fault}}</td></tr>
</table>
</p>
<h3>Test Case runs results</h3>
{% for run_results in runs_results|sort(attribute='run_id') %}
<h4>RUN {{run_results.run_id}} </h4>
<table border>
<tr><td>run_start_time </td><td>{{run_results.run_start_time}}</td></tr>
<tr><td>run_stop_time</td><td>{{run_results.run_stop_time}}</td></tr>
<tr><td>run_duration</td><td>{{run_results.run_duration}}</td></tr>
<tr>
<td>run_verdict</td>
{% if run_results.run_verdict == "PASS" %}
<TD align="center" style="background-color:green">{{run_results.run_verdict}}</TD>
{% elif run_results.run_verdict == "FAIL" %}
<TD align="center" style="background-color:red">{{run_results.run_verdict}}</TD>
{% else %}
<TD align="center" style="background-color:orange">{{run_results.run_verdict}}</TD>
{% endif %}
</tr>
<tr><td>Seg Fault Satus</td>
{% if run_results.ue_seg_fault_status == "NO_SEG_FAULT" %}
<TD align="center" style="background-color:green">{{run_results.ue_seg_fault_status}}</TD>
{% elif run_results.ue_seg_fault_status == "SEG_FAULT" %}
<TD align="center" style="background-color:red">{{run_results.ue_seg_fault_status}}</TD>
{% else %}
<TD align="center" style="background-color:orange">unknown</TD>
{% endif %}
</tr>
</table>
{% for run_metrics in run_results.runs_metrics %}
<br></br>
<table border>
<tr><td>metric_id</td><td>{{run_metrics.metric_id}}</td></tr>
<tr><td>Description</td><td>{{run_metrics.metric_desc}}</td></tr>
<tr><td>Unit of measure</td><td>{{run_metrics.metric_uom}}</td></tr>
<tr><td>metric_min</td><td>{{run_metrics.metric_min}}</td></tr>
<tr><td>metric_max</td><td>{{run_metrics.metric_max}}</td></tr>
<tr><td>metric_mean</td><td>{{run_metrics.metric_mean}}</td></tr>
<tr><td>metric_median</td><td>{{run_metrics.metric_median}}</td></tr>
<tr><td colspan="2"></td></tr>
{% if run_metrics.pass_fail_stat is defined %}
<tr><td>Pass/fail stat</td><td>{{run_metrics.pass_fail_stat}}</td></tr>
{% endif %}
{% if run_metrics.pass_fail_min_limit is defined %}
<tr><td>Pass/fail min limit</td><td>{{run_metrics.pass_fail_min_limit}}</td></tr>
{% endif %}
{% if run_metrics.pass_fail_max_limit is defined %}
<tr><td>Pass/fail max limit</td><td>{{run_metrics.pass_fail_max_limit}}</td></tr>
{% endif %}
<tr><td colspan="2"></td></tr>
<tr><td>metric_fig</td><td><IMG src={{run_metrics.metric_fig}}></td></tr>
</table>
{% endfor %}
{% if run_results.run_traffic.traffic_count != 0 %}
<br></br>
<table border>
<TR><TH>Iperf metric</TH><TH>min</TH><TH>max</TH><TH>mean</TH><TH>median</TH><TR>
<TR><td>Bandwidth </td><td>{{run_results.run_traffic.bw_min}}</td><td>{{run_results.run_traffic.bw_max}}</td><td>{{run_results.run_traffic.bw_mean}}</td><td>{{run_results.run_traffic.bw_median}}</td><TR>
<TR><td>Jitter</td><td>{{run_results.run_traffic.jitter_min}}</td><td>{{run_results.run_traffic.jitter_max}}</td><td>{{run_results.run_traffic.jitter_mean}}</td><td>{{run_results.run_traffic.jitter_median}}</td><TR>
<TR><td>Loss rate</td><td>{{run_results.run_traffic.rl_min}}</td><td>{{run_results.run_traffic.rl_max}}</td><td>{{run_results.run_traffic.rl_mean}}</td><td>{{run_results.run_traffic.rl_median}}</td><TR>
<TR><td colspan="5"></td></TR>
<TR><td>Iperf duration</td><td>{{run_results.run_traffic.iperf_duration}}</td><td></td><td>Pass/Fail criteria (min duration)</td><td>{{run_results.run_traffic.dur_pass_fail_crit}}</td><TR>
<TR><td colspan="5"></td></TR>
<tr><td>traffic_fig</td><td colspan="4"><IMG src={{run_results.run_traffic.traffic_fig}}></td></tr>
</table>
{% endif %}
{% endfor %}
</body>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -35,12 +35,15 @@ import getopt
import sys
from subprocess import call
import encoder
sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/'))
#test_cases = ('030001', '030901', '031001', '031601', '031701', '031801', '031901', '032001', '032101', '032201', '032301', '032501', '032601', '032801')
test_cases = ('030030' , '030030' )
test_cases = ('032800' , '032730' )
nb_run = 3
nb_run = 2
def error_opt(msg):
print("Option error: " + msg)
......@@ -58,14 +61,27 @@ def main(args):
# metric = {}
# metric['id'] = 'UE_DLSCH_BITRATE'
# metric['description'] = 'UE downlink physical throughput'
# metric['regex'] = '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)'
# metric['unit_of_meas'] = 'kbps'
# metric['min_limit'] = 14668.8
#AUTOTEST Metric : RRC Measurments RSRP[0]=-97.60 dBm/RE, RSSI=-72.83 dBm, RSRQ[0] 9.03 dB, N0 -125 dBm/RE, NF 7.2 dB (frame = 4490)
metric = {}
metric['id'] = 'UE_DLSCH_BITRATE'
metric['description'] = 'UE downlink physical throughput'
metric['regex'] = '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)'
metric['id'] = 'UE_DL_RRC_MEAS'
metric['description'] = 'UE downlink RRC Measurments'
metric['nb_metric'] = 5
# metric['regex'] = 'AUTOTEST Metric : RRC Measurments (RSRP\[0\])=(-?\d+\.?\d*)\s+(.+),\s+(RSRQ\[0\])=(-?\d+\.?\d*)\s+(.+),,\s+(N0)=(-?\d+\.?\d*)\s+(.+),,\s+(NF)=(-?\d+\.?\d*)\s+(.+)\s+\(frame = (\d+)\) '
metric['regex'] = 'AUTOTEST Metric : RRC Measurments (RSRP\[0\])=(-?\d+\.?\d*)\s+(.+)\,\s+(RSSI)=(-?\d+\.?\d*)\s+(.+)\,\s+(RSRQ\[0\])=(-?\d+\.?\d*)\s+(.+)\,\s+(N0)=(-?\d+\.?\d*)\s+(.+)\,\s+(NF)=(-?\d+\.?\d*)\s+(.+)\s+\(frame = (\d+)\)'
metric['unit_of_meas'] = 'kbps'
metric['min_limit'] = 14668.8
#report_path = log_path+'/report/'
#os.system(' mkdir -p ' + report_path)
......@@ -74,58 +90,44 @@ def main(args):
#return(0)
for test_case in test_cases:
# print test_case
if test_case == '030001':
metric['min_limit'] = 500.0
if test_case == '030901':
metric['min_limit'] = 640.0
if test_case == '031001':
metric['min_limit'] = 3200.0
if test_case == '031601':
metric['min_limit'] = 5920.0
if test_case == '031701':
metric['min_limit'] = 6000.0
if test_case == '031801':
metric['min_limit'] = 6200.0
if test_case == '031901':
metric['min_limit'] = 7000.0
if test_case == '032001':
metric['min_limit'] = 7800.0
if test_case == '032101':
metric['min_limit'] = 8000.0
if test_case == '032201':
metric['min_limit'] = 9000.0
if test_case == '032301':
metric['min_limit'] = 10000.0
if test_case == '032501':
metric['min_limit'] = 11000.0
if test_case == '032601':
metric['min_limit'] = 12000.0
if test_case == '032801':
metric['min_limit'] = 12500.0
if test_case == '035201':
metric['min_limit'] = 14668.8
if test_case == '036001':
metric['min_limit'] = 25363.2
test_results = []
for test_case in test_cases:
for i in range(0, nb_run):
fname = 'log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log'
fname = '..//log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log'
args = {'metric' : metric,
'file' : fname }
cell_synch_status = analyser.check_cell_synchro(fname)
if cell_synch_status == 'CELL_SYNCH':
print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!'
metric_checks_flag = 0
else :
print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!'
# cell_synch_status = analyser.check_cell_synchro(fname)
# if cell_synch_status == 'CELL_SYNCH':
# print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!'
# metric_checks_flag = 0
# else :
# print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!'
# metric_extracted = analyser.do_extract_metrics(args)
# metrics_extracted = analyser.do_extract_metrics_new(args)
# de-xmlfy test report
xml_file = '..//log//'+test_case+'/test.'+test_case+'_ng.xml'
print xml_file
# test_result =
# test_results.append(test_result)
# xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml'
# xml="\n<testcase classname=\'"+ testcaseclass + "\' name=\'" + testcasename + "."+tags + "\' Run_result=\'" + test_result_string + "\' time=\'" + str(duration) + " s \' RESULT=\'" + testcase_verdict + "\'></testcase> \n"
# write_file(xmlFile, xml, mode="w")
# xmlFile_ng = logdir_local_testcase + '/test.' + testcasename + '_ng.xml'
# xml_ng = xmlify(test_result, wrap=testcasename, indent=" ")
# write_file(xmlFile_ng, xml_ng, mode="w")
# print "min = "+ str( metric_extracted['metric_min'] )
# print "min_index = "+ str( metric_extracted['metric_min_index'] )
......@@ -143,16 +145,27 @@ def main(args):
# print fname
# analyser.do_img_metrics(metric, metric_extracted, fname)
# fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log'
# fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log'
# args = {'file' : fname }
# args = {'file' : fname }
# traffic_metrics = analyser.do_extract_traffic_metrics(args)
# traffic_metrics = analyser.do_extract_traffic_metrics(args)
# fname= 'report/iperf_'+test_case+'_'+str(i)+'.png'
# fname= 'report/iperf_'+test_case+'_'+str(i)+'.png'
# print fname
# analyser.do_img_traffic(traffic_metrics, fname)
# print fname
# analyser.do_img_traffic(traffic_metrics, fname)
for test_result in test_results:
cmd = 'mkdir -p ' + report_dir + '/'+ test_result['testcase_name']
result = os.system(cmd)
report_file = report_dir + '/'+ test_result['testcase_name'] + '/'+ test_result['testcase_name']+ '_report.html'
analyser.create_test_report_detailed_html(test_result, report_file )
print test_result
......
......@@ -41,7 +41,7 @@ from jinja2 import Environment, FileSystemLoader
PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_ENVIRONMENT = Environment(
autoescape=False,
loader=FileSystemLoader(os.path.join(PATH, 'templates')),
loader=FileSystemLoader(os.path.join(PATH, '../templates')),
trim_blocks=False)
......@@ -103,6 +103,129 @@ def do_extract_metrics(args):
}
return(ret)
def do_extract_metrics_new(args):
# print ""
# print "do_extract_metrics ... "
fname = args['file']
metric = args['metric']
print(fname)
print 'metric id = ' + metric['id']
print 'metric regex = ' + metric['regex']
count = 0
mmin = 0
mmin_index = 0
mmax = 0
mmax_index = 0
mean = 0
median = 0
toto = [('id', 'S20'), ('metric', np.float), ('frame', np.int)]
print toto
np_format = []
for x in range(0, metric['nb_metric']):
np_format.append( ('id'+str(x), 'S20') )
np_format.append( ('metric'+str(x), np.float) )
np_format.append( ('uom'+str(x), 'S20') )
np_format.append( ('frame', np.int))
print np_format
output = np.fromregex(fname,metric['regex'], np_format)
print output
count = output['frame'].size
print count
if count > 0:
fontP = FontProperties()
fontP.set_size('small')
fig = plt.figure(1)
plt.figure(figsize=(10,10))
plot_xmax = np.amax(output['frame'])+np.amin(output['frame'])
for x in range(0, metric['nb_metric']):
metric_name = output['id'+str(x)][0]
metric_uom = output['uom'+str(x)][0]
mmin = np.amin(output['metric'+str(x)])
mmax = np.amax(output['metric'+str(x)])
mmean = np.mean(output['metric'+str(x)])
mmedian = np.median(output['metric'+str(x)])
plot_loc = 100*metric['nb_metric']+10+x+1
sbplt = plt.subplot(plot_loc)
sbplt.plot(output['frame'], output['metric'+str(x)], color='b' )
sbplt.set_title( metric_name+' ('+metric_uom+')')
if mmin < 0:
sbplot_ymin=mmin+mmin/10
else:
sbplot_ymin=0
sbplt.set_ylim(ymin=sbplot_ymin)
if mmax > 0:
sbplot_ymax=mmax+mmax/10
else:
sbplot_ymax=0
sbplt.set_ylim(ymax=sbplot_ymax)
sbplt.set_xlim(xmax=plot_xmax)
sbplt.set_xlim(xmin=0)
text='min: '+str(mmin)+'\nmax: '+str(mmax)+'\nmean: '+str(mmean)+'\nmedian: '+str(mmedian)
sbplt.text( plot_xmax+10,sbplot_ymin,text)
sbplt.set_xlabel('frame')
sbplt.set_ylabel(metric_name)
plt.tight_layout()
fname = "toto.png"
# lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
mng = plt.get_current_fig_manager()
plt.savefig(fname, bbox_inches='tight')
plt.close()
mmin = np.amin(output['metric']);
mmin_index = np.argmin(output['metric']);
mmax = np.amax(output['metric']);
mmax_index = np.argmax(output['metric']);
mean = np.mean(output['metric']);
median = np.median(output['metric']);
# print ( ( (metric['min_limit'] > output['metric']).sum() / float(output['metric'].size) ) * 100 )
ret = { 'metric_count' : count,
'metric_buf' : output,
'metric_min' : mmin,
'metric_min_index' : mmin_index,
'metric_max' : mmax,
'metric_max_index' : mmax_index,
'metric_mean' : mean,
'metric_median' : median,
}
return(ret)
#
#
#
......@@ -182,24 +305,30 @@ def do_img_metrics(metric_def, metric_data, fname):
# print output['metric'].size
plt.scatter(output['frame'], output['metric'], color='b', alpha=0.33, s = 1 , label=metric_def['id'])
plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2, label='min limit') # Red straight line
if 'min_limit' in metric_def:
plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2, label='min limit') # Red straight line
plt.title('Physical throughput ('+metric_def['unit_of_meas']+')')
plt.title(metric_def['id'] +' ('+metric_def['unit_of_meas']+')')
plt.xlabel('frame')
plt.ylabel(metric_def['id'])
# Set graphic minimum Y axis
# -------------------------
if metric_data['metric_min'] == 0 :
plt.ylim(ymin=-metric_def['min_limit']/10)
if metric_data['metric_min'] < 0:
plt.ylim(ymin=metric_data['metric_min']+metric_data['metric_min']/10)
else :
plt.ylim(ymin=0)
y_axis_max = 0
if metric_data['metric_max'] > metric_def['min_limit']:
y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10
if 'min_limit' in metric_def:
if metric_data['metric_max'] > metric_def['min_limit']:
y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10
else:
y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10
else:
y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10
y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10
plt.ylim(ymax=y_axis_max)
......@@ -219,9 +348,6 @@ def do_img_metrics(metric_def, metric_data, fname):
def do_extract_traffic_metrics(args):
print ""
print "do_extract_traffic_metrics ... "
fname = args['file']
# print(fname)
......@@ -325,7 +451,8 @@ def do_img_traffic(traffic_data, fname):
ax1.set_xlim(xmax=np.amax(output['interval_stop']))
text='min: '+str(traffic_data['bw_min'])+'\nmax: '+str(traffic_data['bw_max'])+'\nmean: '+str(traffic_data['bw_mean'])+'\nmedian: '+str(traffic_data['bw_median'])
ax1.text( np.amax(output['interval_stop'])+10,0,text)
ax1.set_xlabel('time (s)')
ax1.set_ylabel(' ')
ax2=plt.subplot(312)
plt.plot(output['interval_stop'], output['jitter'], color='b' )
......@@ -334,6 +461,8 @@ def do_img_traffic(traffic_data, fname):
ax2.set_ylim(ymin=-1)
text='min: '+str(traffic_data['jitter_min'])+'\nmax: '+str(traffic_data['jitter_max'])+'\nmean: '+str(traffic_data['jitter_mean'])+'\nmedian: '+str(traffic_data['jitter_median'])
ax2.text( np.amax(output['interval_stop'])+10,0,text)
ax2.set_xlabel('time (s)')
ax2.set_ylabel(' ')
ax3=plt.subplot(313)
plt.plot(output['interval_stop'], output['rate_lost'], color='b')
......@@ -342,10 +471,11 @@ def do_img_traffic(traffic_data, fname):
ax3.set_ylim(ymin=-1)
text='min: '+str(traffic_data['rl_min'])+'\nmax: '+str(traffic_data['rl_max'])+'\nmean: '+str(traffic_data['rl_mean'])+'\nmedian: '+str(traffic_data['rl_median'])
ax3.text( np.amax(output['interval_stop'])+10,0,text)
ax3.set_xlabel('time (s)')
ax3.set_ylabel(' ')
# plt.title('Physical throughput ('+metric_def['unit_of_meas']+')')
plt.xlabel('time (s)')
# plt.xlabel('time (s)')
# plt.ylabel(metric_def['id'])
# Set graphic minimum Y axis
......@@ -365,7 +495,7 @@ def do_img_traffic(traffic_data, fname):
plt.tight_layout()
lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
# lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
mng = plt.get_current_fig_manager()
plt.savefig(fname, bbox_inches='tight')
plt.close()
......@@ -395,7 +525,7 @@ def check_cell_synchro(fname):
m = re.search('AUTOTEST Cell Sync \:', line)
if m :
print line
#print line
return 'CELL_SYNCH'
return 'CELL_NOT_SYNCH'
......@@ -407,7 +537,7 @@ def check_exec_seg_fault(fname):
for line in f:
m = re.search('Segmentation fault', line)
if m :
print line
#print line
return 'SEG_FAULT'
return 'NO_SEG_FAULT'
......
......@@ -35,6 +35,7 @@ source $THIS_SCRIPT_PATH/tools/build_helper
MSC_GEN="False"
XFORMS="True"
FLEXRAN_AGENT_SB_IF="True"
PRINT_STATS="False"
VCD_TIMING="False"
DEADLINE_SCHEDULER_FLAG_USER="False"
......@@ -53,6 +54,7 @@ BUILD_DOXYGEN=0
T_TRACER="False"
DISABLE_HARDWARE_DEPENDENCY="False"
CMAKE_BUILD_TYPE=""
UE_AUTOTEST_TRACE="False"
trap handle_ctrl_c INT
function print_help() {
......@@ -83,6 +85,8 @@ Options
Makes the UE specific parts (ue_ip, usim, nvram)
--RRH
Makes the RRH
-a | --agent
Enables agent for software-defined control of the eNB
-r | --3gpp-release
default is Rel10,
Rel8 limits the implementation to 3GPP Release 8 version
......@@ -127,6 +131,8 @@ Options
Enables the T tracer.
--disable-hardware-dependency
Disable HW dependency during installation
--ue-autotest-trace
Enable specific traces for UE autotest framework
Usage (first build):
oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files
Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files
......@@ -169,6 +175,10 @@ function main() {
eNB=1
echo_info "Will compile eNB"
shift;;
-a | --agent)
FLEXRAN_AGENT=1
echo_info "Will compile eNB with agent support"
shift;;
--UE)
UE=1
echo_info "Will compile UE"
......@@ -278,6 +288,10 @@ function main() {
echo_info "Disabling hardware dependency for compiling software"
DISABLE_HARDWARE_DEPENDENCY="True"
shift 1;;
--ue-autotest-trace)
UE_AUTOTEST_TRACE="True"
echo_info "Enabling autotest specific trace for UE"
shift 1;;
-h | --help)
print_help
exit 1;;
......@@ -439,6 +453,9 @@ function main() {
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file
if [ "$FLEXRAN_AGENT" = "1" ] ; then
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
......@@ -447,6 +464,7 @@ function main() {
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 "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$lte_build_dir/build
cmake ..
......@@ -581,6 +599,9 @@ function main() {
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file
if [ "$FLEXRAN_AGENT" = "1" ] ; then
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi
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
......@@ -649,6 +670,9 @@ function main() {
cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file
if [ "$FLEXRAN_AGENT" = "1" ] ; then
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi
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
......
......@@ -47,7 +47,7 @@ set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU True )
set ( OAISIM True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK True )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
......
......@@ -163,6 +163,42 @@ compilations() {
# External packages installers
############################################
install_protobuf_from_source(){
protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt
echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log "
(
cd /tmp
echo "Downloading protobuf"
rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar -xzvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1/
./configure
echo "Compiling protobuf"
make -j`nproc`
$SUDO make install
$SUDO ldconfig
) >& $protobuf_install_log
}
install_protobuf_c_from_source(){
protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt
echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log "
(
cd /tmp
echo "Downloading protobuf-c"
rm -rf /tmp/protobuf-c
git clone https://github.com/protobuf-c/protobuf-c.git
cd protobuf-c
./autogen.sh
./configure
echo "Compiling protobuf-c"
make -j`nproc`
$SUDO make install
$SUDO ldconfig
) >& $protobuf_c_install_log
}
check_install_usrp_uhd_driver(){
#first we remove old installation
$SUDO apt-get remove -y uhd || true
......@@ -324,6 +360,7 @@ check_install_oai_software() {
xmlstarlet \
python-pip \
pydb \
libyaml-dev \
wget
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
......@@ -337,6 +374,10 @@ check_install_oai_software() {
$SUDO apt-get install -y libgnutls-dev
install_asn1c_from_source
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
install_protobuf_from_source
install_protobuf_c_from_source
}
### Remove Nettle installation which was done from sources
......@@ -361,6 +402,7 @@ remove_nettle_from_source() {
cd nettle-2.5/
./configure --disable-openssl --enable-shared --prefix=/usr
$SUDO make uninstall || true
$SUDO ldconfig
) >& $nettle_uninstall_log
}
......@@ -384,6 +426,7 @@ remove_gnutls_from_source(){
cd gnutls-3.1.23/
./configure --prefix=/usr
$SUDO make uninstall || true
$SUDO ldconfig
)>& $gnutls_uninstall_log
}
......@@ -398,6 +441,7 @@ install_asn1c_from_source(){
make -j`nproc`
$SUDO make install
cd -
$SUDO ldconfig
) > $asn1_install_log 2>&1
}
......
#!/bin/bash
function main()
{
mkdir -p $1
#echo generate protobuf messages inside $1 $2
c_out=$1
shift
proto_path=$1
shift
protoc-c --c_out=$c_out --proto_path=$proto_path $*
#protoc --cpp_out=$c_out --proto_path=$proto_path $*
}
main "$@"
#!/usr/bin/env bash
CACHE_DIR=/mnt/oai_agent_cache
if [ ! -d $CACHE_DIR ]; then
echo "Creating cache dir in $CACHE_DIR"
sudo mkdir $CACHE_DIR
fi
if grep -qs "$CACHE_DIR" /proc/mounts; then
echo "Agent cache is already mounted"
else
echo "Agent cache was not mounted"
echo "Mounting..."
sudo mount -o size=100m -t tmpfs none "$CACHE_DIR"
if [ $? -eq 0 ]; then
echo "Mount success"
else
echo "Something went wrong with the mount"
fi
fi
......@@ -16,7 +16,7 @@ ID = ENB_PHY_DL_TICK
ID = ENB_PHY_DLSCH_UE_DCI
DESC = eNodeB downlink UE specific DCI as sent by the PHY layer
GROUP = ALL:PHY:GRAPHIC:ENB
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS
ID = ENB_PHY_DLSCH_UE_ACK
DESC = eNodeB downlink UE ACK as seen by the PHY layer in process_HARQ_feedback
GROUP = ALL:PHY:GRAPHIC:ENB
......@@ -423,6 +423,27 @@ ID = LEGACY_ENB_APP_TRACE
GROUP = ALL:LEGACY_ENB_APP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_FLEXRAN_AGENT_INFO
DESC = FLEXRAN_AGENT legacy logs - info level
GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_FLEXRAN_AGENT_ERROR
DESC = FLEXRAN_AGENT legacy logs - error level
GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_FLEXRAN_AGENT_WARNING
DESC = FLEXRAN_AGENT legacy logs - warning level
GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_FLEXRAN_AGENT_DEBUG
DESC = FLEXRAN_AGENT legacy logs - debug level
GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_FLEXRAN_AGENT_TRACE
DESC = FLEXRAN_AGENT legacy logs - trace level
GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_SCTP_INFO
DESC = SCTP legacy logs - info level
GROUP = ALL:LEGACY_SCTP:LEGACY_GROUP_INFO:LEGACY
......@@ -1246,6 +1267,14 @@ ID = VCD_VARIABLE_UE0_SFN7
DESC = VCD variable UE0_SFN7
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
ID = VCD_VARIABLE_UE0_TRX_READ_NS
DESC = VCD variable UE0_TRX_READ_NS
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
ID = VCD_VARIABLE_UE0_TRX_WRITE_NS
DESC = VCD variable UE0_TRX_WRITE_NS
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
#functions
......@@ -1289,6 +1318,50 @@ ID = VCD_FUNCTION_UE_THREAD_RXTX1
DESC = VCD function UE_THREAD_RXTX1
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_TRX_READ_SF9
DESC = VCD function TRX_READ_SF9
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_TRX_WRITE_SF9
DESC = VCD function TRX_WRITE_SF9
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_SIGNAL_COND_RXTX
DESC = VCD function UE_SIGNAL_COND_RXTX
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_WAIT_COND_RXTX0
DESC = VCD function UE_WAIT_COND_RXTX0
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_WAIT_COND_RXTX1
DESC = VCD function UE_WAIT_COND_RXTX1
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0
DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1
DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0
DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1
DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0
DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1
DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_eNB_TX
DESC = VCD function eNB_TX
GROUP = ALL:VCD:ENB:VCD_FUNCTION
......@@ -1381,8 +1454,8 @@ ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC1
DESC = VCD function PHY_PROCEDURES_ENB_RX_UESPEC1
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_SLOT_FEP
DESC = VCD function PHY_PROCEDURES_ENB_SLOT_FEP
ID = VCD_FUNCTION_ENB_SLOT_FEP
DESC = VCD function ENB_SLOT_FEP
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX
......@@ -1393,6 +1466,26 @@ ID = VCD_FUNCTION_PHY_PROCEDURES_UE_RX
DESC = VCD function PHY_PROCEDURES_UE_RX
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC
DESC = VCD function PHY_PROCEDURES_UE_TX_ULSCH_UESPEC
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PUCCH
DESC = VCD function PHY_PROCEDURES_UE_TX_PUCCH
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_COMMON
DESC = VCD function PHY_PROCEDURES_UE_TX_ULSCH_COMMON
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PRACH
DESC = VCD function PHY_PROCEDURES_UE_TX_PRACH
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_RAR
DESC = VCD function PHY_PROCEDURES_UE_TX_ULSCH_RAR
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_LTE
DESC = VCD function PHY_PROCEDURES_ENB_LTE
GROUP = ALL:VCD:ENB:VCD_FUNCTION
......@@ -1481,6 +1574,22 @@ ID = VCD_FUNCTION_RX_PHICH
DESC = VCD function RX_PHICH
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PDSCH_PROC
DESC = VCD function PDSCH_PROC
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PDSCH_PROC_SI
DESC = VCD function PDSCH_PROC_SI
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PDSCH_PROC_P
DESC = VCD function PDSCH_PROC_P
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PDSCH_PROC_RA
DESC = VCD function PDSCH_PROC_RA
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_PHY_UE_CONFIG_SIB2
DESC = VCD function PHY_UE_CONFIG_SIB2
GROUP = ALL:VCD:UE:VCD_FUNCTION
......@@ -1585,6 +1694,14 @@ ID = VCD_FUNCTION_ENB_DLSCH_SCRAMBLING
DESC = VCD function ENB_DLSCH_SCRAMBLING
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_ENB_BEAM_PRECODING
DESC = VCD function ENB_BEAM_PRECODING
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_ENB_OFDM_MODULATION
DESC = VCD function ENB_OFDM_MODULATION
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_MACPHY_INIT
DESC = VCD function MACPHY_INIT
GROUP = ALL:VCD:ENB:VCD_FUNCTION
......@@ -1697,6 +1814,10 @@ ID = VCD_FUNCTION_RLC_DATA_REQ
DESC = VCD function RLC_DATA_REQ
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_RLC_DATA_IND
DESC = VCD function RLC_DATA_IND
GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value
ID = VCD_FUNCTION_MAC_RLC_STATUS_IND
DESC = VCD function MAC_RLC_STATUS_IND
GROUP = ALL:VCD:ENB:VCD_FUNCTION
......
......@@ -2,8 +2,8 @@ CC=gcc
CFLAGS=-Wall -g -pthread -I/usr/include/X11/Xft -I/usr/include/freetype2
OBJS=init.o loop.o toplevel_window.o x.o container.o widget.o \
gui.o label.o event.o xy_plot.o textlist.o notify.o positioner.o \
timeline.o space.o image.o
gui.o label.o textarea.o event.o xy_plot.o textlist.o notify.o \
positioner.o timeline.o space.o image.o
gui.a: $(OBJS)
ar cr gui.a $(OBJS)
......
......@@ -14,6 +14,10 @@ typedef void widget;
#define DEFAULT_FONT 0
/* tic type for XY plot */
#define XY_PLOT_DEFAULT_TICK 0
#define XY_PLOT_SCROLL_TICK 1
/* key modifiers */
#define KEY_SHIFT (1<<0)
#define KEY_CONTROL (1<<1)
......@@ -30,6 +34,7 @@ widget *new_toplevel_window(gui *gui, int width, int height, char *title);
widget *new_container(gui *gui, int vertical);
widget *new_positioner(gui *gui);
widget *new_label(gui *gui, const char *text);
widget *new_textarea(gui *gui, int width, int height, int maxsize);
widget *new_xy_plot(gui *gui, int width, int height, char *label,
int vruler_width);
widget *new_textlist(gui *gui, int width, int nlines, int background_color);
......@@ -41,6 +46,8 @@ widget *new_image(gui *gui, unsigned char *data, int length);
void label_set_clickable(gui *gui, widget *label, int clickable);
void label_set_text(gui *gui, widget *label, char *text);
void textarea_set_text(gui *gui, widget *textarea, char *text);
void container_set_child_growable(gui *_gui, widget *_this,
widget *child, int growable);
......@@ -51,6 +58,7 @@ void xy_plot_set_points(gui *gui, widget *this,
int plot, int npoints, float *x, float *y);
void xy_plot_get_dimensions(gui *gui, widget *this, int *width, int *height);
void xy_plot_set_title(gui *gui, widget *this, char *label);
void xy_plot_set_tick_type(gui *gui, widget *this, int type);
void textlist_add(gui *gui, widget *this, const char *text, int position,
int color);
......
......@@ -31,7 +31,7 @@ extern int volatile gui_logd;
enum widget_type {
TOPLEVEL_WINDOW, CONTAINER, POSITIONER, TEXT_LIST, XY_PLOT, BUTTON, LABEL,
TIMELINE, SPACE, IMAGE
TEXTAREA, TIMELINE, SPACE, IMAGE
};
struct widget_list;
......@@ -117,6 +117,7 @@ struct xy_plot_widget {
int wanted_height;
struct xy_plot_plot *plots;
int nplots;
int tick_type;
};
struct timeline_subline {
......@@ -148,6 +149,17 @@ struct label_widget {
int baseline; /* as given by the graphic's backend */
};
struct textarea_widget {
struct widget common;
char *t;
int tmaxsize;
int color;
int wanted_width;
int wanted_height;
int baseline; /* as given by the graphic's backend */
int text_width; /* as given by the graphic's backend */
};
struct space_widget {
struct widget common;
int wanted_width;
......
#include "gui.h"
#include "gui_defs.h"
#include "x.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void paint(gui *_gui, widget *_w)
{
struct gui *g = _gui;
struct textarea_widget *t = _w;
LOGD("PAINT textarea '%s'\n", t->t);
x_fill_rectangle(g->x, g->xwin, BACKGROUND_COLOR,
t->common.x, t->common.y,
t->common.width, t->common.height);
x_draw_clipped_string(g->x, g->xwin, DEFAULT_FONT, t->color,
t->common.x + t->common.width - t->text_width,
t->common.y + t->baseline, t->t,
t->common.x, t->common.y,
t->common.width, t->common.height);
}
static void hints(gui *_gui, widget *_w, int *width, int *height)
{
struct textarea_widget *t = _w;
LOGD("HINTS textarea '%s'\n", t->t);
*width = t->wanted_width;
*height = t->wanted_height;
}
widget *new_textarea(gui *_gui, int width, int height, int maxsize)
{
struct gui *g = _gui;
struct textarea_widget *w;
int _;
glock(g);
w = new_widget(g, TEXTAREA, sizeof(struct textarea_widget));
w->t = calloc(maxsize, 1);
if (w->t == NULL) OOM;
w->tmaxsize = maxsize;
w->wanted_width = width;
w->wanted_height = height;
w->color = FOREGROUND_COLOR;
w->text_width = 0;
x_text_get_dimensions(g->x, DEFAULT_FONT, "jlM",
&_, &_, &w->baseline);
w->common.paint = paint;
w->common.hints = hints;
gunlock(g);
return w;
}
/*************************************************************************/
/* public functions */
/*************************************************************************/
void textarea_set_text(gui *_g, widget *_this, char *text)
{
struct gui *g = _g;
struct textarea_widget *this = _this;
int _;
int len = strlen(text);
if (len >= this->tmaxsize) {
fprintf(stderr, "ERROR: string '%s' too big for textarea\n", text);
return;
}
glock(g);
strcpy(this->t, text);
x_text_get_dimensions(g->x, DEFAULT_FONT, text,
&this->text_width, &_, &this->baseline);
send_event(g, DIRTY, this->common.id);
gunlock(g);
}
......@@ -265,7 +265,7 @@ void widget_dirty(gui *_gui, widget *_this)
static const char *names[] = {
"TOPLEVEL_WINDOW", "CONTAINER", "POSITIONER", "TEXT_LIST",
"XY_PLOT", "BUTTON", "LABEL", "TIMELINE", "SPACE", "IMAGE"
"XY_PLOT", "BUTTON", "LABEL", "TEXTAREA", "TIMELINE", "SPACE", "IMAGE"
};
const char *widget_name(enum widget_type type)
{
......@@ -277,6 +277,7 @@ const char *widget_name(enum widget_type type)
case XY_PLOT:
case BUTTON:
case LABEL:
case TEXTAREA:
case TIMELINE:
case SPACE:
case IMAGE:
......
#include "gui.h"
#include "gui_defs.h"
#include "x.h"
#include "../utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#if 0
/* this version behaves differently when you resize the XY plot. Say
* you increase the size. The old (smaller) view is put at the center
* of the new view. Everything inside keeps the same size/aspect ratio.
* The other version below resizes the old view so that it fully occupies
* the new view. It may introduce aspect ratio changes, but usage seems
* to suggest it's a better behaviour.
*/
static void paint(gui *_gui, widget *_this)
{
struct gui *g = _gui;
......@@ -155,6 +164,184 @@ static void paint(gui *_gui, widget *_this)
x_plot_points(g->x, g->xwin, this->plots[n].color);
}
}
#endif
static void paint(gui *_gui, widget *_this)
{
struct gui *g = _gui;
struct xy_plot_widget *this = _this;
int allocated_plot_width;
int allocated_plot_height;
float pxsize;
float ticdist;
float tic;
float ticstep;
int k, kmin, kmax;
float allocated_xmin, allocated_xmax;
float allocated_ymin, allocated_ymax;
int i;
int n;
char v[64];
int vwidth, dummy;
# define FLIP(v) (-(v) + allocated_plot_height-1)
LOGD("PAINT xy plot xywh %d %d %d %d\n", this->common.x, this->common.y, this->common.width, this->common.height);
//x_draw_rectangle(g->x, g->xwin, 1, this->common.x, this->common.y, this->common.width, this->common.height);
allocated_plot_width = this->common.width - this->vrule_width;
allocated_plot_height = this->common.height - this->label_height * 2;
if (allocated_plot_width <= 1 || allocated_plot_height <= 1) {
WARN("PAINT xy plot: width (%d) or height (%d) is wrong, not painting\n",
this->common.width, this->common.height);
return;
}
/* plot zone */
/* TODO: refine height - height of hrule text may be != from label */
x_draw_rectangle(g->x, g->xwin, 1,
this->common.x + this->vrule_width,
this->common.y,
this->common.width - this->vrule_width -1, /* -1 to see right border */
this->common.height - this->label_height * 2);
/* horizontal tics */
pxsize = (this->xmax - this->xmin) / allocated_plot_width;
ticdist = 100;
tic = floor(log10(ticdist * pxsize));
ticstep = powf(10, tic);
allocated_xmin = this->xmin;
allocated_xmax = this->xmax;
/* adjust tic if too tight */
LOGD("pre x ticstep %g\n", ticstep);
while (1) {
if (ticstep / (allocated_xmax - allocated_xmin)
* (allocated_plot_width - 1) > 40) break;
ticstep *= 2;
}
LOGD("post x ticstep %g\n", ticstep);
LOGD("xmin/max %g %g width allocated %d alloc xmin/max %g %g ticstep %g\n", this->xmin, this->xmax, allocated_plot_width, allocated_xmin, allocated_xmax, ticstep);
kmin = ceil(allocated_xmin / ticstep);
kmax = floor(allocated_xmax / ticstep);
for (k = kmin; k <= kmax; k++) {
/*
(k * ticstep - allocated_xmin) / (allocated_max - allocated_xmin) =
(x - 0) / (allocated_plot_width-1 - 0)
*/
int x = (k * ticstep - allocated_xmin) /
(allocated_xmax - allocated_xmin) *
(allocated_plot_width - 1);
int px;
x_draw_line(g->x, g->xwin, FOREGROUND_COLOR,
this->common.x + this->vrule_width + x,
this->common.y + this->common.height - this->label_height * 2,
this->common.x + this->vrule_width + x,
this->common.y + this->common.height - this->label_height * 2 - 5);
sprintf(v, "%g", k * ticstep);
x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy);
/* do not draw after the widget ('width-1' for if we use 'width'
* it is still off by 1 pixel for whatever reason) */
px = this->vrule_width + x - vwidth/2;
if (px + vwidth > this->common.width-1)
px = this->common.width-1 - vwidth;
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
this->common.x + px,
this->common.y + this->common.height - this->label_height * 2 +
this->label_baseline,
v);
LOGD("tic k %d val %g x %d\n", k, k * ticstep, x);
}
/* vertical tics */
allocated_ymin = this->ymin;
allocated_ymax = this->ymax;
switch (this->tick_type) {
case XY_PLOT_DEFAULT_TICK:
pxsize = (this->ymax - this->ymin) / allocated_plot_height;
ticdist = 30;
tic = floor(log10(ticdist * pxsize));
ticstep = powf(10, tic);
/* adjust tic if too tight */
LOGD("pre y ticstep %g\n", ticstep);
while (1) {
if (ticstep / (allocated_ymax - allocated_ymin)
* (allocated_plot_height - 1) > 20) break;
ticstep *= 2;
}
LOGD("post y ticstep %g\n", ticstep);
LOGD("ymin/max %g %g height allocated %d alloc "
"ymin/max %g %g ticstep %g\n", this->ymin, this->ymax,
allocated_plot_height, allocated_ymin, allocated_ymax, ticstep);
kmin = ceil(allocated_ymin / ticstep);
kmax = floor(allocated_ymax / ticstep);
for (k = kmin; k <= kmax; k++) {
int y = (k * ticstep - allocated_ymin) /
(allocated_ymax - allocated_ymin) *
(allocated_plot_height - 1);
sprintf(v, "%g", k * ticstep);
x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy);
x_draw_line(g->x, g->xwin, FOREGROUND_COLOR,
this->common.x + this->vrule_width,
this->common.y + FLIP(y),
this->common.x + this->vrule_width + 5,
this->common.y + FLIP(y));
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
this->common.x + this->vrule_width - vwidth - 2,
this->common.y + FLIP(y)-this->label_height/2+this->label_baseline,
v);
}
break;
case XY_PLOT_SCROLL_TICK:
/* print only max value, formatted using 'bps' for readability */
bps(v, this->ymax, "");
x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy);
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
this->common.x + this->vrule_width - vwidth - 2,
this->common.y + +this->label_baseline,
v);
/* vertically divide into 5 */
for (k = 1; k < 5; k++) {
int y = round((k * (allocated_plot_height - 1)) / 5.);
x_draw_line(g->x, g->xwin, FOREGROUND_COLOR,
this->common.x + this->vrule_width,
this->common.y + y,
this->common.x + this->vrule_width + 5,
this->common.y + y);
}
break;
} /* swich (this->tick_type) */
/* label at bottom, in the middle */
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
this->common.x + (this->common.width - this->label_width) / 2,
this->common.y + this->common.height - this->label_height
+ this->label_baseline,
this->label);
for (n = 0; n < this->nplots; n++) {
/* points */
float ax, bx, ay, by;
ax = (allocated_plot_width-1) / (allocated_xmax - allocated_xmin);
bx = -ax * allocated_xmin;
ay = (allocated_plot_height-1) / (allocated_ymax - allocated_ymin);
by = -ay * allocated_ymin;
for (i = 0; i < this->plots[n].npoints; i++) {
int x, y;
x = ax * this->plots[n].x[i] + bx;
y = ay * this->plots[n].y[i] + by;
if (x >= 0 && x < allocated_plot_width &&
y >= 0 && y < allocated_plot_height)
x_add_point(g->x,
this->common.x + this->vrule_width + x,
this->common.y + FLIP(y));
}
x_plot_points(g->x, g->xwin, this->plots[n].color);
}
}
static void hints(gui *_gui, widget *_w, int *width, int *height)
{
......@@ -191,6 +378,7 @@ widget *new_xy_plot(gui *_gui, int width, int height, char *label,
w->ymax = 1;
w->plots = NULL;
w->nplots = 0;
w->tick_type = XY_PLOT_DEFAULT_TICK;
w->common.paint = paint;
w->common.hints = hints;
......@@ -309,3 +497,17 @@ void xy_plot_set_title(gui *_gui, widget *_this, char *label)
gunlock(g);
}
void xy_plot_set_tick_type(gui *_gui, widget *_this, int type)
{
struct gui *g = _gui;
struct xy_plot_widget *this = _this;
glock(g);
this->tick_type = type;
send_event(g, DIRTY, this->common.id);
gunlock(g);
}
......@@ -2,7 +2,7 @@ CC=gcc
CFLAGS=-Wall -g -pthread -I..
OBJS=logger.o textlog.o framelog.o ttilog.o timelog.o ticklog.o iqlog.o \
iqdotlog.o ticked_ttilog.o
iqdotlog.o ticked_ttilog.o throughputlog.o
logger.a: $(OBJS)
ar cr logger.a $(OBJS)
......
......@@ -14,6 +14,9 @@ logger *new_ticked_ttilog(void *event_handler, void *database,
char *tick_event_name, char *frame_varname, char *subframe_varname,
char *event_name, char *data_varname,
int convert_to_dB, float empty_value);
logger *new_throughputlog(void *event_handler, void *database,
char *tick_event_name, char *frame_varname, char *subframe_varname,
char *event_name, char *data_varname);
logger *new_timelog(void *event_handler, void *database, char *event_name);
logger *new_ticklog(void *event_handler, void *database,
char *event_name, char *frame_name, char *subframe_name);
......
#include "logger.h"
#include "logger_defs.h"
#include "event.h"
#include "database.h"
#include "handler.h"
#include "filter/filter.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
struct throughputlog {
struct logger common;
void *database;
int tick_frame_arg;
int tick_subframe_arg;
int data_frame_arg;
int data_subframe_arg;
int data_arg;
int last_tick_frame;
int last_tick_subframe;
unsigned long bits[1000];
unsigned long total;
int insert_point;
char *tick_event_name;
unsigned long tick_handler_id;
/* tick filter - NULL is no filter set */
void *tick_filter;
};
static void _event(void *p, event e)
{
struct throughputlog *l = p;
int frame;
int subframe;
unsigned long value;
if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0)
return;
frame = e.e[l->data_frame_arg].i;
subframe = e.e[l->data_subframe_arg].i;
if (frame != l->last_tick_frame || subframe != l->last_tick_subframe) {
printf("WARNING: %s:%d: data comes without previous tick!\n",
__FILE__, __LINE__);
return;
}
switch (e.e[l->data_arg].type) {
case EVENT_INT: value = e.e[l->data_arg].i; break;
case EVENT_ULONG: value = e.e[l->data_arg].ul; break;
default: printf("%s:%d: unsupported type\n", __FILE__, __LINE__); abort();
}
l->total += value;
l->bits[l->insert_point] += value;
}
static void _tick_event(void *p, event e)
{
struct throughputlog *l = p;
int i;
int frame;
int subframe;
if (l->tick_filter != NULL && filter_eval(l->tick_filter, e) == 0)
return;
frame = e.e[l->tick_frame_arg].i;
subframe = e.e[l->tick_subframe_arg].i;
for (i = 0; i < l->common.vsize; i++)
l->common.v[i]->append(l->common.v[i], frame, subframe, (double)l->total);
l->insert_point = (l->insert_point + 1) % 1000;
l->total -= l->bits[l->insert_point];
l->bits[l->insert_point] = 0;
l->last_tick_frame = frame;
l->last_tick_subframe = subframe;
}
logger *new_throughputlog(event_handler *h, void *database,
char *tick_event_name, char *frame_varname, char *subframe_varname,
char *event_name, char *data_varname)
{
struct throughputlog *ret;
int event_id;
database_event_format f;
int i;
ret = calloc(1, sizeof(struct throughputlog)); if (ret == NULL) abort();
ret->common.event_name = strdup(event_name);
if (ret->common.event_name == NULL) abort();
ret->database = database;
ret->tick_event_name = strdup(tick_event_name);
if (ret->tick_event_name == NULL) abort();
/* tick event */
event_id = event_id_from_name(database, tick_event_name);
ret->tick_handler_id=register_handler_function(h,event_id,_tick_event,ret);
f = get_format(database, event_id);
/* look for frame and subframe */
ret->tick_frame_arg = -1;
ret->tick_subframe_arg = -1;
for (i = 0; i < f.count; i++) {
if (!strcmp(f.name[i], frame_varname)) ret->tick_frame_arg = i;
if (!strcmp(f.name[i], subframe_varname)) ret->tick_subframe_arg = i;
}
if (ret->tick_frame_arg == -1) {
printf("%s:%d: frame argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, frame_varname, event_name);
abort();
}
if (ret->tick_subframe_arg == -1) {
printf("%s:%d: subframe argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, subframe_varname, event_name);
abort();
}
if (strcmp(f.type[ret->tick_frame_arg], "int") != 0) {
printf("%s:%d: argument '%s' has wrong type (should be 'int')\n",
__FILE__, __LINE__, frame_varname);
abort();
}
if (strcmp(f.type[ret->tick_subframe_arg], "int") != 0) {
printf("%s:%d: argument '%s' has wrong type (should be 'int')\n",
__FILE__, __LINE__, subframe_varname);
abort();
}
/* data event */
event_id = event_id_from_name(database, event_name);
ret->common.handler_id = register_handler_function(h,event_id,_event,ret);
f = get_format(database, event_id);
/* look for frame, subframe and data args */
ret->data_frame_arg = -1;
ret->data_subframe_arg = -1;
ret->data_arg = -1;
for (i = 0; i < f.count; i++) {
if (!strcmp(f.name[i], frame_varname)) ret->data_frame_arg = i;
if (!strcmp(f.name[i], subframe_varname)) ret->data_subframe_arg = i;
if (!strcmp(f.name[i], data_varname)) ret->data_arg = i;
}
if (ret->data_frame_arg == -1) {
printf("%s:%d: frame argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, frame_varname, event_name);
abort();
}
if (ret->data_subframe_arg == -1) {
printf("%s:%d: subframe argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, subframe_varname, event_name);
abort();
}
if (ret->data_arg == -1) {
printf("%s:%d: data argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, data_varname, event_name);
abort();
}
if (strcmp(f.type[ret->data_frame_arg], "int") != 0) {
printf("%s:%d: argument '%s' has wrong type (should be 'int')\n",
__FILE__, __LINE__, frame_varname);
abort();
}
if (strcmp(f.type[ret->data_subframe_arg], "int") != 0) {
printf("%s:%d: argument '%s' has wrong type (should be 'int')\n",
__FILE__, __LINE__, subframe_varname);
abort();
}
if (strcmp(f.type[ret->data_arg], "int") != 0 &&
strcmp(f.type[ret->data_arg], "float") != 0) {
printf("%s:%d: argument '%s' has wrong type"
" (should be 'int' or 'float')\n",
__FILE__, __LINE__, data_varname);
abort();
}
return ret;
}
void throughputlog_set_tick_filter(logger *_l, void *filter)
{
struct throughputlog *l = (struct throughputlog *)_l;
free(l->tick_filter);
l->tick_filter = filter;
}
......@@ -7,6 +7,7 @@
#include <ctype.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <math.h>
void new_thread(void *(*f)(void *), void *data)
{
......@@ -36,6 +37,16 @@ void sleepms(int ms)
if (nanosleep(&t, NULL)) abort();
}
void bps(char *out, float v, char *suffix)
{
static char *bps_unit[4] = { "", "k", "M", "G" };
int flog;
if (v < 1000) flog = 0; else flog = floor(floor(log10(v)) / 3);
if (flog > 3) flog = 3;
v /= pow(10, flog*3);
sprintf(out, "%g%s%s", round(v*100)/100, bps_unit[flog], suffix);
}
/****************************************************************************/
/* list */
/****************************************************************************/
......
......@@ -3,6 +3,7 @@
void new_thread(void *(*f)(void *), void *data);
void sleepms(int ms);
void bps(char *out, float v, char *suffix);
/****************************************************************************/
/* list */
......
CC=gcc
CFLAGS=-Wall -g -pthread -I.. -I../logger
OBJS=stdout.o textlist.o xy.o tti.o time.o ticktime.o
OBJS=stdout.o textlist.o xy.o tti.o time.o ticktime.o scrolltti.o
view.a: $(OBJS)
ar cr view.a $(OBJS)
......
#include "view.h"
#include "../utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
struct scrolltti {
view common;
gui *g;
widget *w;
widget *throughput_textarea;
int plot;
float refresh_rate;
pthread_mutex_t lock;
unsigned long data[1000];
unsigned long total; /* sum data[0..999] to have smoother value printed */
float xout[1000];
float yout[1000];
int insert_point;
};
/* this array is used to get Y range 1000, 2000, 5000, 10000, ... */
static int tolog[11] = { -1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10 };
static void *scrolltti_thread(void *_this)
{
struct scrolltti *this = _this;
int i;
int p;
float max, mlog;
char o[64];
while (1) {
if (pthread_mutex_lock(&this->lock)) abort();
/* TODO: optimize */
p = this->insert_point;
max = 0;
for (i = 0; i < 1000; i++) {
this->xout[i] = i;
this->yout[i] = this->data[p];
if (this->data[p] > max) max = this->data[p];
p = (p + 1) % 1000;
}
bps(o, this->total/1000., "b/s");
textarea_set_text(this->g, this->throughput_textarea, o);
/* for Y range we want 1000, 2000, 5000, 10000, 20000, 50000, etc. */
if (max < 1000) max = 1000;
mlog = pow(10, floor(log10(max)));
max = tolog[(int)ceil(max/mlog)] * mlog;
xy_plot_set_range(this->g, this->w, 0, 1000, 0, max);
xy_plot_set_points(this->g, this->w, this->plot,
1000, this->xout, this->yout);
if (pthread_mutex_unlock(&this->lock)) abort();
sleepms(1000/this->refresh_rate);
}
return 0;
}
static void clear(view *this)
{
/* TODO */
}
static void append(view *_this, int frame, int subframe, double value)
{
struct scrolltti *this = (struct scrolltti *)_this;
if (pthread_mutex_lock(&this->lock)) abort();
this->total -= this->data[this->insert_point];
this->data[this->insert_point] = value;
this->total += this->data[this->insert_point];
this->insert_point = (this->insert_point + 1) % 1000;
if (pthread_mutex_unlock(&this->lock)) abort();
}
view *new_view_scrolltti(float refresh_rate, gui *g, widget *w, int color,
widget *throughput_textarea)
{
struct scrolltti *ret = calloc(1, sizeof(struct scrolltti));
if (ret == NULL) abort();
ret->common.clear = clear;
ret->common.append = (void (*)(view *, ...))append;
ret->refresh_rate = refresh_rate;
ret->g = g;
ret->w = w;
ret->throughput_textarea = throughput_textarea;
ret->plot = xy_plot_new_plot(g, w, color);
if (pthread_mutex_init(&ret->lock, NULL)) abort();
new_thread(scrolltti_thread, ret);
return (view *)ret;
}
......@@ -19,6 +19,8 @@ view *new_view_xy(int length, float refresh_rate, gui *g, widget *w,
int color, enum xy_mode mode);
view *new_view_tti(float refresh_rate, gui *g, widget *w,
int color);
view *new_view_scrolltti(float refresh_rate, gui *g, widget *w,
int color, widget *throughput_label);
view *new_view_time(int number_of_seconds, float refresh_rate,
gui *g, widget *w);
view *new_subview_time(view *time, int line, int color, int size);
......
This diff is collapsed.
......@@ -86,8 +86,8 @@ int timer_handle_signal(siginfo_t *info)
timer_p = (struct timer_elm_s *)info->si_ptr;
// LG: To many traces for msc timer:
// TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer);
TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer);
task_id = timer_p->task_id;
instance = timer_p->instance;
message_p = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED);
......@@ -120,6 +120,10 @@ int timer_handle_signal(siginfo_t *info)
return -1;
}
#if defined(ENB_AGENT_SB_IF)
#endif
return 0;
}
......
#!/bin/sh
echo "building ctags for openair1 and openair2 ..."
ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets cmake_targets common
......@@ -60,7 +60,7 @@ int lte_segmentation(unsigned char *input_buffer,
}
if ((*C)>MAX_NUM_DLSCH_SEGMENTS) {
msg("lte_segmentation.c: too many segments %d\n",*C);
LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
return(-1);
}
......
......@@ -206,7 +206,19 @@ void phy_config_dedicated_ue(module_id_t Mod_id,
uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated);
/*!
\fn void phy_config_harq_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
uint16_t max_harq_tx)
\brief Configure UE UL max harq Tx.
\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param CH_index Index of eNB for this configuration
@param max_harq_tx max harq tx information
*/
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t CH_index,
uint16_t max_harq_tx);
/**
\brief Configure UE MBSFN common parameters.
\details Invoked upon reception of SIB13 from eNB.
......
......@@ -483,6 +483,26 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
}
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
eNB->soundingrs_ul_config_dedicated[UE_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
eNB->soundingrs_ul_config_dedicated[UE_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;
eNB->soundingrs_ul_config_dedicated[UE_id].freqDomainPosition = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
eNB->soundingrs_ul_config_dedicated[UE_id].srs_Bandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
eNB->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
eNB->soundingrs_ul_config_dedicated[UE_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;
eNB->soundingrs_ul_config_dedicated[UE_id].transmissionComb = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",eNB->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex);
}
LOG_D(PHY,"------------------------------------------------------------\n");
}
eNB->physicalConfigDedicated[UE_id] = NULL;
}
}
......@@ -728,6 +748,14 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
}
#endif
void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
uint16_t max_harq_tx )
{
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
phy_vars_ue->ulsch[eNB_id]->Mlimit = max_harq_tx;
}
void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
struct PhysicalConfigDedicated *physicalConfigDedicated )
{
......@@ -744,7 +772,8 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
phy_vars_ue->dlsch_received_last[eNB_id]=0;
phy_vars_ue->dlsch_fer[eNB_id]=0;
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
if (physicalConfigDedicated) {
LOG_D(PHY,"[UE %d] Received physicalConfigDedicated from eNB %d\n",Mod_id, eNB_id);
......@@ -854,6 +883,53 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
}
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0;
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1;
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].freqDomainPosition = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_Bandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].transmissionComb = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex);
}
LOG_D(PHY,"------------------------------------------------------------\n");
}
if (physicalConfigDedicated->cqi_ReportConfig) {
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) {
// configure PUSCH CQI reporting
phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
if ((phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm12) &&
(phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm30) &&
(phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm31))
LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic);
}
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) {
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) {
// configure PUCCH CQI reporting
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex;
}
else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) {
// handle release
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
}
}
}
#ifdef CBA
if (physicalConfigDedicated->pusch_CBAConfigDedicated_vlola) {
......@@ -870,6 +946,9 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
return;
}
// fill cqi parameters for periodic CQI reporting
get_cqipmiri_params(phy_vars_ue,eNB_id);
}
void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups)
......
......@@ -102,7 +102,7 @@ int lte_est_freq_offset(int **dl_ch_estimates,
{
int ch_offset, omega, dl_ch_shift;
struct complex16 *omega_cpx;
struct complex16 omega_cpx;
double phase_offset;
int freq_offset_est;
unsigned char aa;
......@@ -142,9 +142,8 @@ int lte_est_freq_offset(int **dl_ch_estimates,
// printf("Computing freq_offset\n");
omega = dot_product(dl_ch,dl_ch_prev,(frame_parms->N_RB_DL/2 - 1)*12,dl_ch_shift);
//omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15);
omega_cpx = (struct complex16*) &omega;
// printf("omega (%d,%d)\n",omega_cpx->r,omega_cpx->i);
omega_cpx.r = ((struct complex16*) &omega)->r;
omega_cpx.i = ((struct complex16*) &omega)->i;
dl_ch = (int16_t *)&dl_ch_estimates[aa][(((frame_parms->N_RB_DL/2) + 1)*12) + ch_offset];
......@@ -155,10 +154,12 @@ int lte_est_freq_offset(int **dl_ch_estimates,
// calculate omega = angle(conj(dl_ch)*dl_ch_prev))
omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift);
omega_cpx->r += ((struct complex16*) &omega)->r;
omega_cpx->i += ((struct complex16*) &omega)->i;
omega_cpx.r += ((struct complex16*) &omega)->r;
omega_cpx.i += ((struct complex16*) &omega)->i;
// phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r);
phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r);
phase_offset += atan2((double)omega_cpx.i,(double)omega_cpx.r);
// LOG_I(PHY,"omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset);
}
......
......@@ -1126,6 +1126,9 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
int nushiftmod3 = frame_parms->nushift%3;
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
#ifdef DEBUG_DCI_DECODING
LOG_I(PHY, "extract_rbs_dual: symbol_mod %d\n",symbol_mod);
#endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......@@ -2679,11 +2682,15 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
nCCE = get_nCCE(pdcch_vars[eNB_id]->num_pdcch_symbols,frame_parms,mi);
if (nCCE > get_nCCE(3,frame_parms,1))
if (nCCE > get_nCCE(3,frame_parms,1)) {
LOG_D(PHY,"skip DCI decoding: nCCE=%d > get_nCCE(3,frame_parms,1)=%d\n", nCCE, get_nCCE(3,frame_parms,1));
return;
}
if (nCCE<L2)
if (nCCE<L2) {
LOG_D(PHY,"skip DCI decoding: nCCE=%d < L2=%d\n", nCCE, L2);
return;
}
if (do_common == 1) {
nb_candidates = (L2==4) ? 4 : 2;
......@@ -2857,7 +2864,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
}
}
LOG_D(PHY,"DCI decoding CRNTI [format_c: %d, nCCE[subframe: %d]: %d ]\n",format_c, subframe, pdcch_vars[eNB_id]->nCCE[subframe]);
LOG_D(PHY,"DCI decoding CRNTI [format: %d, nCCE[subframe: %d]: %d ], AggregationLevel %d \n",format_c, subframe, pdcch_vars[eNB_id]->nCCE[subframe],L2);
// memcpy(&dci_alloc[*dci_cnt].dci_pdu[0],dci_decoded_output,sizeof_bytes);
......@@ -3248,7 +3255,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
SI_RNTI,
ra_rnti,
P_RNTI,
3,
0,
format1A,
format1A,
format1A,
......@@ -3277,7 +3284,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
SI_RNTI,
ra_rnti,
P_RNTI,
2,
1,
format1A,
format1A,
format1A,
......@@ -3310,7 +3317,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
SI_RNTI,
ra_rnti,
P_RNTI,
1,
2,
format1A,
format1A,
format1A,
......@@ -3339,7 +3346,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
SI_RNTI,
ra_rnti,
P_RNTI,
0,
3,
format1A,
format1A,
format1A,
......
This diff is collapsed.
......@@ -227,6 +227,11 @@ typedef struct {
uint8_t control_only;
/// Flag to indicate that this is a calibration ULSCH (i.e. no MAC SDU and filled with TDD calibration information)
// int calibration_flag;
/// Number of soft channel bits
uint32_t G;
// decode phich
uint8_t decode_phich;
} LTE_UL_UE_HARQ_t;
typedef struct {
......@@ -337,12 +342,16 @@ typedef struct {
int16_t Po_PUSCH;
/// PHR - current power headroom (based on last PUSCH transmission)
int16_t PHR;
/// Po_SRS - target output power for SRS
int16_t Po_SRS;
/// num active cba group
uint8_t num_active_cba_groups;
/// num dci found for cba
uint8_t num_cba_dci[10];
/// allocated CBA RNTI
uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
/// UL max-harq-retransmission
uint8_t Mlimit;
} LTE_UE_ULSCH_t;
typedef struct {
......
......@@ -249,7 +249,12 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
tc = phy_threegpplte_turbo_decoder16;
}
else
tc = phy_threegpplte_turbo_decoder8;
{
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
tc = phy_threegpplte_turbo_decoder8;
}
// nb_rb = dlsch->nb_rb;
......@@ -448,6 +453,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
#if 1
if (err_flag == 0) {
if (llr8_flag) {
AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n",
Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
}
start_meas(dlsch_turbo_decoding_stats);
ret = tc
(&harq_process->d[r][96],
......@@ -609,7 +619,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
harq_process->errors[harq_process->round]++;
harq_process->round++;
// LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
if(is_crnti)
{
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
}
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
if (harq_process->round >= dlsch->Mdlharq) {
harq_process->status = SCH_IDLE;
......@@ -622,7 +636,10 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
dlsch->harq_ack[subframe].ack = 1;
dlsch->harq_ack[subframe].harq_id = harq_pid;
dlsch->harq_ack[subframe].send_harq_status = 1;
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
if(is_crnti)
{
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
}
}
......
......@@ -42,6 +42,8 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms)
// This is from Section 5.5.1.3
uint32_t fss_pusch = frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
uint32_t fss_pucch = frame_parms->Nid_cell;
x2 = frame_parms->Nid_cell/30;
#ifdef DEBUG_GROUPHOP
printf("[PHY] GroupHop:");
......@@ -49,7 +51,10 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms)
for (ns=0; ns<20; ns++) {
if (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == 0)
{
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[ns] = fss_pusch%30;
frame_parms->pucch_config_common.grouphop[ns] = fss_pucch%30;
}
else {
if ((ns&3) == 0) {
s = lte_gold_generic(&x1,&x2,reset);
......@@ -57,6 +62,7 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms)
}
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[ns] = (((uint8_t*)&s)[ns&3]+fss_pusch)%30;
frame_parms->pucch_config_common.grouphop[ns] = (((uint8_t*)&s)[ns&3]+fss_pucch)%30;
}
#ifdef DEBUG_GROUPHOP
......
......@@ -462,6 +462,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
}
}
/* Consider this is a false detection if the offset is > 1000 Hz */
if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) )
{
ret=-1;
LOG_E(HW,"Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset);
}
if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters
//#ifdef DEBUG_INITIAL_SYNCH
......@@ -469,6 +476,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
//#endif
if (ue->UE_scan_carrier == 0) {
#if UE_AUTOTEST_TRACE
LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
ue->rx_offset,
ue->common_vars.freq_offset );
#endif
if (ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
//mac_resynch();
......
......@@ -34,6 +34,10 @@
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "defs.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/defs.h"
#ifndef USER_MODE
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#endif
......@@ -1046,7 +1050,6 @@ void generate_phich(LTE_DL_FRAME_PARMS *frame_parms,
// This routine demodulates the PHICH and updates PUSCH/ULSCH parameters
void rx_phich(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
uint8_t subframe,
......@@ -1081,8 +1084,10 @@ void rx_phich(PHY_VARS_UE *ue,
if (!ulsch)
return;
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX Status: %d \n",ue->Mod_id,harq_pid,proc->frame_rx,subframe, ulsch->harq_processes[harq_pid]->status);
if (ulsch->harq_processes[harq_pid]->status == ACTIVE) {
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX ACTIVE\n",ue->Mod_id,harq_pid,proc->frame_rx,subframe);
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX ACTIVE\n",ue->Mod_id,harq_pid,proc->frame_rx,subframe);
Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48;
if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0)
......@@ -1375,15 +1380,39 @@ void rx_phich(PHY_VARS_UE *ue,
subframe,
HI16,
nseq_PHICH,
ngroup_PHICH);
ngroup_PHICH,
ulsch->Mlimit);
//#endif
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
// ulsch->harq_processes[harq_pid]->Ndi = 0;
ulsch->harq_processes[harq_pid]->round++;
ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3];
ulsch->O_RI = 0;
ulsch->O = 0;
ulsch->uci_format = HLC_subband_cqi_nopmi;
if ( ulsch->harq_processes[harq_pid]->round >= (ulsch->Mlimit - 1) )
{
// this is last push re transmission
ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3];
ulsch->O_RI = 0;
ulsch->O = 0;
ulsch->uci_format = HLC_subband_cqi_nopmi;
// disable phich decoding since it is the last retransmission
ulsch->harq_processes[harq_pid]->status = IDLE;
//ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
//ulsch->harq_processes[harq_pid]->round = 0;
//LOG_I(PHY,"PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid);
//LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->Mlimit, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round);
}
else
{
// ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3];
ulsch->O_RI = 0;
ulsch->O = 0;
ulsch->uci_format = HLC_subband_cqi_nopmi;
//LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round);
}
}
......@@ -1405,11 +1434,22 @@ void rx_phich(PHY_VARS_UE *ue,
//#endif
}
// LOG_I(PHY,"[HARQ-UL harqId: %d] subframe_scheduling_flag = %d \n",harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag);
// Incase of adaptive retransmission, PHICH is always decoded as ACK (at least with OAI-eNB)
// Workaround:
// rely only on DCI0 decoding and check if NDI has toggled
// save current harq_processes content in temporary struct
// harqId-8 corresponds to the temporary struct. In total we have 8 harq process(0 ..7) + 1 temporary harq process()
//ulsch->harq_processes[8] = ulsch->harq_processes[harq_pid];
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag =0;
ulsch->harq_processes[harq_pid]->status = IDLE;
ulsch->harq_processes[harq_pid]->round = 0;
// inform MAC?
ue->ulsch_Msg3_active[eNB_id] = 0;
//LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH ACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round);
}
}
......
......@@ -629,6 +629,13 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#if defined(EXMIMO) || defined(OAI_USRP)
prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset);
#ifdef PRACH_DEBUG
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start,
ue->rx_offset,
ue->hw_timing_advance,
ue->N_TA_offset);
#endif
if (prach_start<0)
prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
......
......@@ -1539,6 +1539,9 @@ int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id);
double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id);
uint8_t sinr2cqi(double sinr,uint8_t trans_mode);
int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
eNB_rxtx_proc_t *proc,
void *dci_pdu,
......@@ -1806,6 +1809,20 @@ void generate_pucch1x(int32_t **txdataF,
int16_t amp,
uint8_t subframe);
void generate_pucch2x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *fp,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n2_pucch,
uint16_t *payload,
int A,
int B2,
int16_t amp,
uint8_t subframe,
uint16_t rnti);
void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc,
PUCCH_FMT_t format,
......
......@@ -442,7 +442,7 @@ inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti
int i;
uint8_t c;
x2 = (rnti<<14) + ((1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1
x2 = (rnti) + ((uint32_t)(1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1
s = lte_gold_generic(&x1, &x2, 1);
for (i=0;i<19;i++) {
c = (uint8_t)((s>>i)&1);
......@@ -456,22 +456,24 @@ inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) {
int i;
for (i=0;i<20;i++)
d[i] = btilde[i] == 1 ? amp : -amp;
d[i] = btilde[i] == 1 ? -amp : amp;
}
uint32_t pucch_code[13] = {0xFFFFF,0x5A933,0x10E5A,0x6339C,0x73CE0,
0xFFC00,0xD8E64,0x4F6B0,0x218EC,0x1B746,
0x0FFFF,0x33FFF,0x3FFFC};
void generate_pucch2x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *fp,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n2_pucch,
uint8_t shortened_format,
uint32_t *payload,
uint16_t *payload,
int A,
int B2,
int16_t amp,
......@@ -486,13 +488,14 @@ void generate_pucch2x(int32_t **txdataF,
uint8_t NRB2 = fp->pucch_config_common.nRB_CQI;
uint8_t Ncs1 = fp->pucch_config_common.nCS_AN;
uint32_t u0 = (fp->Nid_cell + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
uint32_t u1 = (fp->Nid_cell + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
uint32_t v0=fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1=fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
uint32_t u0 = fp->pucch_config_common.grouphop[subframe<<1];
uint32_t u1 = fp->pucch_config_common.grouphop[1+(subframe<<1)];
uint32_t v0 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
uint32_t z[12*14],*zptr;
uint32_t u,v,n;
uint8_t ns,N_UL_symb,nsymb;
uint8_t ns,N_UL_symb,nsymb_slot0,nsymb_pertti;
uint32_t nprime,l,n_cs;
int alpha_ind,data_ind;
int16_t ref_re,ref_im;
......@@ -509,7 +512,6 @@ void generate_pucch2x(int32_t **txdataF,
return;
}
// pucch2x_encoding
for (i=0;i<A;i++)
if ((*payload & (1<<i)) > 0)
......@@ -545,66 +547,72 @@ void generate_pucch2x(int32_t **txdataF,
}
}
zptr = z;
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH2x: n2_pucch %d\n",n2_pucch);
#endif
N_UL_symb = (fp->Ncp==0) ? 7 : 6;
data_ind = 0;
zptr = z;
for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) {
if ((ns&1) == 0)
nprime = (n2_pucch < 12*NRB2) ?
n2_pucch % 12 :
(n2_pucch+Ncs1 + 1)%12;
else
nprime = (n2_pucch < 12*NRB2) ?
((12*(nprime+1)) % 13)-1 :
(10-n2_pucch)%12;
nprime = (n2_pucch < 12*NRB2) ?
n2_pucch % 12 :
(n2_pucch+Ncs1 + 1)%12;
else {
nprime = (n2_pucch < 12*NRB2) ?
((12*(nprime+1)) % 13)-1 :
(10-n2_pucch)%12;
}
//loop over symbols in slot
for (l=0; l<N_UL_symb; l++) {
// Compute n_cs (36.211 p. 18)
n_cs = (ncs_cell[ns][l]+nprime)%12;
alpha_ind = n_cs;
data_ind = 0;
alpha_ind = 0;
for (n=0; n<12; n++) {
// this is r_uv^alpha(n)
ref_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15);
ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15);
if ((l<2)||(l>=(N_UL_symb-2))) { //these are PUCCH data symbols
((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15;
}
else {
((int16_t *)&zptr[n])[0] = ref_re;
((int16_t *)&zptr[n])[1] = ref_im;
}
// this is r_uv^alpha(n)
ref_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15);
ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15);
if ((l!=1)&&(l!=5)) { //these are PUCCH data symbols
((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15;
//LOG_I(PHY,"slot %d ofdm# %d ==> d[%d,%d] \n",ns,l,data_ind,n);
}
else {
((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re>>15);
((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im>>15);
//LOG_I(PHY,"slot %d ofdm# %d ==> dmrs[%d] \n",ns,l,n);
}
alpha_ind = (alpha_ind + n_cs)%12;
} // n
if ((l<2)||(l>=(N_UL_symb-2))) //these are PUCCH data symbols so increment data index
data_ind+=2;
zptr+=12;
if ((l!=1)&&(l!=5)) //these are PUCCH data symbols so increment data index
data_ind+=2;
} // l
} //ns
m = n2_pucch/12;
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH: m %d\n",m);
LOG_D(PHY,"[PHY] PUCCH: n2_pucch %d m %d\n",n2_pucch,m);
#endif
nsymb = N_UL_symb<<1;
nsymb_slot0 = ((fp->Ncp==0) ? 7 : 6);
nsymb_pertti = nsymb_slot0 << 1;
//nsymb = nsymb_slot0<<1;
//for (j=0,l=0;l<(nsymb-1);l++) {
for (j=0,l=0; l<(nsymb); l++) {
if ((l<(nsymb>>1)) && ((m&1) == 0))
for (j=0,l=0; l<(nsymb_pertti); l++) {
if ((l<nsymb_slot0) && ((m&1) == 0))
re_offset = (m*6) + fp->first_carrier_offset;
else if ((l<(nsymb>>1)) && ((m&1) == 1))
else if ((l<nsymb_slot0) && ((m&1) == 1))
re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12;
else if ((m&1) == 0)
re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12;
......@@ -614,23 +622,33 @@ void generate_pucch2x(int32_t **txdataF,
if (re_offset > fp->ofdm_symbol_size)
re_offset -= (fp->ofdm_symbol_size);
symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb));
symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb_pertti));
txptr = &txdataF[0][symbol_offset];
//LOG_I(PHY,"ofdmSymb %d/%d, firstCarrierOffset %d, symbolOffset[sfn %d] %d, reOffset %d, &txptr: %x \n", l, nsymb, fp->first_carrier_offset, subframe, symbol_offset, re_offset, &txptr[0]);
for (i=0; i<12; i++,j++) {
txptr[re_offset++] = z[j];
txptr[re_offset] = z[j];
re_offset++;
if (re_offset==fp->ofdm_symbol_size)
re_offset = 0;
re_offset -= (fp->ofdm_symbol_size);
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
LOG_D(PHY,"[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
#endif
}
}
}
//#define Amax 13
//void init_pucch2x_rx() {};
uint32_t rx_pucch(PHY_VARS_eNB *eNB,
PUCCH_FMT_t fmt,
uint8_t UE_id,
......
......@@ -34,6 +34,7 @@
#include "SCHED/extern.h"
#include "LAYER2/MAC/defs.h"
#include "SCHED/defs.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "assertions.h"
......@@ -171,6 +172,8 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *ue,
unsigned char eNB_id )
{
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_IN);
// RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)rar_pdu;
uint8_t transmission_mode = ue->transmission_mode[eNB_id];
unsigned char *rar_pdu = ue->dlsch_ra[eNB_id]->harq_processes[0]->b;
......@@ -315,6 +318,9 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *ue,
msg("ulsch ra (UE): TPC %d\n",ulsch->harq_processes[harq_pid]->TPC);
msg("ulsch ra (UE): O %d\n",ulsch->O);
msg("ulsch ra (UE): ORI %d\n",ulsch->O_RI);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_OUT);
//#endif
return(0);
}
......
......@@ -129,18 +129,27 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue,
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id];
int32_t *txdataF = ue->common_vars.txdataF[0];
int32_t **txdataF = ue->common_vars.txdataF;
uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos,symbol_offset;
uint16_t *Msc_idx_ptr;
int32_t k0;
uint32_t T_SFC;
uint32_t subframe_offset;
//uint32_t subframe_offset;
uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth;
uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig;
uint8_t Ssrs = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig;
uint8_t n_RRC = soundingrs_ul_config_dedicated->freqDomainPosition;
uint8_t kTC = soundingrs_ul_config_dedicated->transmissionComb;
// u is the PUCCH sequence-group number defined in Section 5.5.1.3
// ν is the base sequence number defined in Section 5.5.1.4
uint32_t u=frame_parms->pucch_config_common.grouphop[1+(subframe<<1)];;
uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
LOG_D(PHY,"SRS root sequence: u %d, v %d\n",u,v);
LOG_D(PHY,"CommonSrsConfig: Csrs %d, Ssrs %d, AnSrsSimultan %d \n",Csrs,Ssrs,frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission);
LOG_D(PHY,"DedicatedSrsConfig: Bsrs %d, bhop %d, nRRC %d, Isrs %d, kTC %d, n_SRS %d\n",Bsrs,soundingrs_ul_config_dedicated->srs_HoppingBandwidth,n_RRC
,soundingrs_ul_config_dedicated->srs_ConfigIndex,kTC
,soundingrs_ul_config_dedicated->cyclicShift);
if (frame_parms->N_RB_UL < 41) {
msrs0 = msrsb_6_40[Csrs][0];
......@@ -161,7 +170,7 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue,
}
Msc_RS = msrsb * 6;
k0 = (((frame_parms->N_RB_UL>>1)-(msrs0>>1))*12) + kTC;
k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC;
nb = (4*n_RRC/msrsb)%Nb;
for (b=0; b<=Bsrs; b++) {
......@@ -200,53 +209,32 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue,
msg("generate_srs_tx: Msc_RS = %d, Msc_RS_idx = %d\n",Msc_RS, Msc_RS_idx);
#endif
T_SFC = (Ssrs<=7 ? 5 : 10);
if ((1<<(subframe%T_SFC))&transmission_offset_tdd[Ssrs]) {
carrier_pos = (frame_parms->first_carrier_offset + k0);
if (carrier_pos>frame_parms->ofdm_symbol_size) {
carrier_pos -= frame_parms->ofdm_symbol_size;
}
uint16_t nsymb = (frame_parms->Ncp==0) ? 14:12;
symbol_offset = (int)frame_parms->ofdm_symbol_size*((subframe*nsymb)+(nsymb-1));
#ifndef IFFT_FPGA_UE
carrier_pos = (frame_parms->first_carrier_offset + k0) % frame_parms->ofdm_symbol_size;
//msg("carrier_pos = %d\n",carrier_pos);
//subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size;
//symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->ofdm_symbol_size;
subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size;
symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->ofdm_symbol_size;
int32_t *txptr;
txptr = &txdataF[0][symbol_offset];
for (k=0; k<Msc_RS; k++) {
((short*) txdataF)[2*(symbol_offset + carrier_pos)] = (short) (((int32_t) amp * (int32_t) ul_ref_sigs[0][0][Msc_RS_idx][k<<1])>>15);
((short*) txdataF)[2*(symbol_offset + carrier_pos)+1] = (short) (((int32_t) amp * (int32_t) ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1])>>15);
carrier_pos+=2;
int32_t real = ((int32_t) amp * (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][k<<1]) >> 15;
int32_t imag = ((int32_t) amp * (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][(k<<1)+1]) >> 15;
txptr[carrier_pos] = (real&0xFFFF) + ((imag<<16)&0xFFFF0000);
if (carrier_pos >= frame_parms->ofdm_symbol_size)
carrier_pos=1;
}
#else
carrier_pos = (frame_parms->N_RB_UL*12/2 + k0) % (frame_parms->N_RB_UL*12);
//msg("carrier_pos = %d\n",carrier_pos);
carrier_pos = carrier_pos+2;
subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->N_RB_UL*12;
symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->N_RB_UL*12;
for (k=0; k<Msc_RS; k++) {
if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] >= 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] >= 0))
txdataF[symbol_offset+carrier_pos] = (int32_t) 4;
else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] >= 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] < 0))
txdataF[symbol_offset+carrier_pos] = (int32_t) 2;
else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] < 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] >= 0))
txdataF[symbol_offset+carrier_pos] = (int32_t) 3;
else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] < 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] < 0))
txdataF[symbol_offset+carrier_pos] = (int32_t) 1;
carrier_pos+=2;
if (carrier_pos >= frame_parms->N_RB_UL*12)
carrier_pos=0;
if (carrier_pos >= frame_parms->ofdm_symbol_size)
carrier_pos=carrier_pos-frame_parms->ofdm_symbol_size;
}
#endif
// write_output("srs_txF.m","srstxF",&txdataF[symbol_offset],512,1,1);
}
return(0);
}
......
......@@ -836,3 +836,5 @@ void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
}
......@@ -140,6 +140,8 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
if (ulsch) {
memset(ulsch,0,sizeof(LTE_UE_ULSCH_t));
ulsch->Mlimit = 4;
for (i=0; i<8; i++) {
ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t));
......@@ -498,6 +500,21 @@ uint32_t ulsch_encoding(uint8_t *a,
G = G - Q_RI - Q_CQI;
ulsch->harq_processes[harq_pid]->G = G;
/*
LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK);
LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n",
frame_parms->Nid_cell,ulsch->rnti,
harq_pid,
ulsch->harq_processes[harq_pid]->round,
ulsch->harq_processes[harq_pid]->rvidx,
ulsch->harq_processes[harq_pid]->mcs,
ulsch->O_RI,
ulsch->harq_processes[harq_pid]->O_ACK,
G);
*/
if ((int)G < 0) {
LOG_E(PHY,"FATAL: ulsch_coding.c G < 0 (%d) : Q_RI %d, Q_CQI %d, O %d, betaCQI_times8 %d)\n",G,Q_RI,Q_CQI,ulsch->O,ulsch->beta_offset_cqi_times8);
......
......@@ -872,7 +872,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
int16_t ys,c;
uint32_t wACK_idx;
uint8_t dummy_w_cc[3*(MAX_CQI_BITS+8+32)];
int16_t y[6*14*1200];
int16_t y[6*14*1200] __attribute__((aligned(32)));
uint8_t ytag[14*1200];
// uint8_t ytag2[6*14*1200],*ytag2_ptr;
int16_t cseq[6*14*1200];
......@@ -1442,7 +1442,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
}
#if defined(__x86_64__)||defined(__i386__)
#ifndef __AVX2
#ifndef __AVX2__
for (iprime=0; iprime<G;iprime+=8,j2+=8)
*((__m128i *)&ulsch_harq->e[iprime]) = *((__m128i *)&y[j2]);
#else
......
......@@ -426,13 +426,14 @@ void ulsch_modulation(int32_t **txdataF,
G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch);
// Mapping
nsymb = (frame_parms->Ncp==0) ? 14:12;
Msc_PUSCH = ulsch->harq_processes[harq_pid]->nb_rb*12;
#ifdef DEBUG_ULSCH_MODULATION
printf("ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n",
ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe);
LOG_D(PHY,"ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n",
ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe);
#endif
// scrambling (Note the placeholding bits are handled in ulsch_coding.c directly!)
......
......@@ -659,7 +659,7 @@ typedef struct {
/// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime)
uint32_t rx_gain_byp[4];
/// \brief Current transmit power
int8_t tx_power_dBm[10];
int16_t tx_power_dBm[10];
/// \brief Total number of REs in current transmission
int tx_total_RE[10];
/// \brief Maximum transmit power
......
......@@ -117,5 +117,17 @@ extern char eNB_timing[2][20];
extern int16_t unscrambling_lut[65536*16];
extern uint8_t scrambling_lut[65536*16];
extern unsigned short msrsb_6_40[8][4];
extern unsigned short msrsb_41_60[8][4];
extern unsigned short msrsb_61_80[8][4];
extern unsigned short msrsb_81_110[8][4];
extern unsigned short Nb_6_40[8][4];
extern unsigned short Nb_41_60[8][4];
extern unsigned short Nb_61_80[8][4];
extern unsigned short Nb_81_110[8][4];
extern uint16_t hundred_times_log10_NPRB[100];
extern uint8_t alpha_lut[8];
#endif /*__PHY_EXTERN_H__ */
......@@ -142,6 +142,11 @@ typedef struct {
uint8_t nCS_AN;
/// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]}
uint16_t n1PUCCH_AN;
/// group hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification.
uint8_t grouphop[20];
/// sequence hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification.
uint8_t seqhop[20];
} PUCCH_CONFIG_COMMON;
/// UL-ReferenceSignalsPUSCH from 36.331 RRC spec
......@@ -315,6 +320,12 @@ typedef struct {
uint16_t srs_ConfigIndex;
/// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value.
uint8_t cyclicShift;
// Parameter: ue srs subframe for internal implementation
uint8_t srsConfigDedicatedSetup;
// Parameter: cell srs subframe for internal implementation
uint8_t srsCellSubframe;
// Parameter: ue srs subframe for internal implementation
uint8_t srsUeSubframe;
} SOUNDINGRS_UL_CONFIG_DEDICATED;
/// UplinkPowerControlDedicated Information Element from 36.331 RRC spec
......@@ -418,16 +429,20 @@ typedef struct {
/// CQI-ReportPeriodic
typedef struct {
/// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}
uint16_t cqi_PUCCH_ResourceIndex;
/// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}, -1 indicates inactivity
int16_t cqi_PUCCH_ResourceIndex;
/// Parameter: CQI/PMI Periodicity and Offset Configuration Index \f$I_\text{CQI/PMI}\f$, see TS 36.213 (tables 7.2.2-1A and 7.2.2-1C). \vr{[0..1023]}
uint16_t cqi_PMI_ConfigIndex;
int16_t cqi_PMI_ConfigIndex;
/// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]}
uint8_t K;
/// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}
uint16_t ri_ConfigIndex;
/// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}, -1 indicates inactivity
int16_t ri_ConfigIndex;
/// Parameter: Simultaneous-AN-and-CQI, see TS 36.213 (10.1). \vr{[0..1]} 1 indicates that simultaneous transmission of ACK/NACK and CQI is allowed.
uint8_t simultaneousAckNackAndCQI;
/// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
uint16_t Npd;
/// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
uint16_t N_OFFSET_CQI;
} CQI_REPORTPERIODIC;
/// Enumeration for parameter reporting mode \ref CQI_REPORT_CONFIG::cqi_ReportModeAperiodic.
......
......@@ -3,3 +3,4 @@ SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_ue.o
SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_eNb.o
SCHED_OBJS += $(TOP_DIR)/SCHED/pusch_pc.o
SCHED_OBJS += $(TOP_DIR)/SCHED/pucch_pc.o
SCHED_OBJS += $(TOP_DIR)/SCHED/srs_pc.o
......@@ -69,6 +69,11 @@ enum openair_SYNCH_STATUS {
openair_SCHED_EXIT
};
enum openair_HARQ_TYPE {
openair_harq_DL = 0,
openair_harq_UL,
openair_harq_RA
};
#define DAQ_AGC_ON 1
#define DAQ_AGC_OFF 0
......@@ -437,6 +442,17 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui
*/
void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag);
/*! \brief This function implements the power control mechanism for SRS from 36.213.
@param phy_vars_ue PHY variables
@param proc Pointer to proc descriptor
@param eNB_id Index of eNB
@param j index of type of PUSCH (SPS, Normal, Msg3)
@returns Transmit power
*/
void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag);
void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id);
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index);
#ifdef LOCALIZATION
......@@ -452,6 +468,8 @@ double aggregate_eNB_UE_localization_stats(PHY_VARS_eNB *phy_vars_eNB, int8_t UE
#endif
LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti);
LTE_DL_FRAME_PARMS *get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id);
MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -88,7 +88,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui
}
if (pucch_fmt!=pucch_format1) {
LOG_I(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n",
LOG_D(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n",
ue->Mod_id,
ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe,
Po_PUCCH,
......@@ -96,7 +96,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui
get_PL(ue->Mod_id,ue->CC_id,eNB_id),
ue->dlsch[eNB_id][0]->g_pucch);
} else {
LOG_I(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n",
LOG_D(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n",
ue->Mod_id,
ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe,
Po_PUCCH,
......
This diff is collapsed.
......@@ -211,6 +211,14 @@ typedef struct broadcast_info_ind_s {
#define AS_HSDUPA (1 << NET_ACCESS_HSDUPA)
#define AS_EUTRAN (1 << NET_ACCESS_EUTRAN)
/*
* NAS->AS -K_eNB refresh request
* NAS request AS to refresh its KeNB key
*/
typedef struct kenb_refresh_req_s {
Byte_t kenb[32];
} kenb_refresh_req_t;
/*
* NAS->AS - Cell Information request
* NAS request AS to search for a suitable cell belonging to the selected
......
......@@ -56,6 +56,7 @@ MESSAGE_DEF(RRC_STATE_IND, MESSAGE_PRIORITY_MED, RrcStateInd,
MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigurationReq, rrc_configuration_req)
// UE: NAS -> RRC messages
MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req)
MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, NasCellSelectionReq, nas_cell_selection_req)
MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, NasConnEstabliReq, nas_conn_establi_req)
MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq, nas_ul_data_req)
......
......@@ -62,6 +62,7 @@ typedef UL_DCCH_Message_t RrcUlDcchMessage;
#define RRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_configuration_req
#define NAS_KENB_REFRESH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_kenb_refresh_req
#define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req
#define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req
#define NAS_UPLINK_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_req
......@@ -175,6 +176,7 @@ typedef struct RrcConfigurationReq_s {
} RrcConfigurationReq;
// UE: NAS -> RRC messages
typedef kenb_refresh_req_t NasKenbRefreshReq;
typedef cell_info_req_t NasCellSelectionReq;
typedef nas_establish_req_t NasConnEstabliReq;
typedef ul_info_transfer_req_t NasUlDataReq;
......
......@@ -55,6 +55,8 @@ TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200)
TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200)
/// eNB APP task
TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200)
/// eNB Agent task
TASK_DEF(TASK_FLEXRAN_AGENT, TASK_PRIORITY_MED, 200)
// UE tasks and sub-tasks:
//// Layer 2 and Layer 1 sub-tasks
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//'syntax = "proto2";'
package protocol;
enum flex_control_delegation_type {
FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation
}
\ No newline at end of file
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.
......@@ -228,6 +228,10 @@ typedef struct Enb_properties_s {
char *enb_interface_name_for_S1_MME;
in_addr_t enb_ipv4_address_for_S1_MME;
char *flexran_agent_interface_name;
in_addr_t flexran_agent_ipv4_address;
tcp_udp_port_t flexran_agent_port;
char *flexran_agent_cache;
/* Nb of RRH to connect to */
uint8_t nb_rrh_gw;
......
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.
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