Commit 2224225a authored by Rohit Gupta's avatar Rohit Gupta

Merge branch 'develop' into enhancement-57-UHD-interfacing

parents bd7ec70c fffcb784
job1:
script:
- echo $PWD
- echo $USER
- echo $OAI_USER
- echo $OAI_EXTRA_ARGS
- echo $NFS_SHARE_DIR
- echo $EXTERNAL_SHARE_DIR
- echo $SHELL
- git rev-parse --abbrev-ref HEAD
- git_head=`git rev-parse HEAD`
- echo $git_head
- tmp=`git show-ref --head | grep $git_head`
- tmp=(${tmp///// })
- git_branch=${tmp[@]:(-1)}
- echo $git_branch
- source oaienv
- echo $OPENAIR_DIR
- NFS_TEST_RESULTS_DIR=$NFS_SHARE_DIR/$git_branch/$git_head
- EXTERNAL_SHARE_RESULTS_DIR=$EXTERNAL_SHARE_DIR/$git_branch/$git_head
- echo $NFS_TEST_RESULTS_DIR
- echo $EXTERNAL_SHARE_RESULTS_DIR
- mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
- python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -r -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS `echo $OAI_EXTRA_ARGS` -g $OAI_TEST_CASE_GROUP >& $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log
- mv $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest.log
- 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
......@@ -421,7 +421,7 @@ elseif (${RF_BOARD} STREQUAL "OAI_USRP")
${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp)
LINK_DIRECTORIES("/opt/lib")
set(option_HW_lib "uhd")
set(LOWLATENCY False)
#set(LOWLATENCY False)
elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
include_directories("${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/")
......@@ -432,14 +432,14 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
)
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
set(option_HW_lib "bladeRF")
#set(LOWLATENCY False)
#set(LOWLATENCY False)
elseif (${RF_BOARD} STREQUAL "ETHERNET")
include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB")
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
)
set(LOWLATENCY True)
#set(LOWLATENCY True)
elseif (${RF_BOARD} STREQUAL "CPRIGW")
set(HW_SOURCE ${HW_SOURCE}
......@@ -451,6 +451,7 @@ endif (${RF_BOARD} STREQUAL "EXMIMO")
include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
Message("LOWLATENCY flag is ${LOWLATENCY}")
##############################################################
# ???!!! TO BE DOCUMENTED OPTIONS !!!???
......
......@@ -118,8 +118,7 @@ class core:
rsp1 = self.prompt1
rsp2 = self.prompt2
if sudo == True:
command = 'echo \'' + self.password + '\' | sudo -S -E ' + command
command = 'echo \'' + '' + '\' | sudo -S -E bash -c \' ' + command + '\' '
self.wait_quiet()
if self.send_cr:
log.stats['cmd'] += 1
......@@ -140,7 +139,7 @@ class core:
rsp2 = self.prompt2
self.wait_quiet()
if sudo == True:
command = 'echo \'' + self.password + '\' | sudo -S -E ' + command
command = 'echo \'' + '' + '\' | sudo -S -E bash -c \' ' + command + '\' '
if self.send_cr:
log.stats['cmd'] += 1
self.oai.sendline(command)
......@@ -240,8 +239,9 @@ class core:
# print rsp
if (rsp.find(expect) == -1):
return 'OK'
raise log.err(self.failed(command, expect,debug))
else:
print "command = " + cmd + "expect = " + expect + "rsp = " + rsp
raise log.err(self.failed(command, expect,debug))
# **************************send_wait*************************
......
......@@ -83,10 +83,13 @@ class openair(core):
return (stdout, stderr)
def connect(self, username, password, prompt='PEXPECT_OAI'):
while True:
max_retries=100
i=0
while i <= max_retries:
self.prompt1 = prompt
self.prompt2 = prompt
self.password = ''
i=i+1
# WE do not store the password when sending commands for secuirity reasons. The password might be accidentally logged in such cases.
#The password is used only to make ssh connections. In case user wants to run programs with sudo, then he/she needs to add following line in /etc/sudoers
# your_user_name ALL=(ALL:ALL) NOPASSWD: ALL
......@@ -109,11 +112,14 @@ class openair(core):
except Exception, e:
error=''
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + 'address = "'+ self.address +' username = ' + username
error = error + traceback.format_exc()
print error
print "Retrying again in 60 seconds"
time.sleep(60)
#sys.exit(1)
print "Retrying again in 1 seconds"
time.sleep(1)
if i==max_retries:
print "Fatal Error: Terminating the program now..."
sys.exit(1)
def connect2(self, username, password, prompt='$'):
self.prompt1 = prompt
......
This diff is collapsed.
This diff is collapsed.
......@@ -10,6 +10,7 @@ import threading
import signal
import traceback
import os
import commands
# configure the serial connections (the parameters differs on the device you are connecting to)
#First we find an open port to work with
......@@ -34,8 +35,7 @@ def find_open_port():
ser = serial.Serial(port=serial_port)
return
find_open_port()
print 'Using Serial port : ' + serial_port
#serial_port = '/dev/ttyUSB2'
bandrich_ppd_config = os.environ.get('OPENAIR_DIR') + '/cmake_targets/autotests/tools/wdial.bandrich.conf'
......@@ -127,7 +127,7 @@ def start_ue () :
ip = IPRoute()
idx = ip.link_lookup(ifname=iface)[0]
os.system ('route add 192.172.0.1 ppp0')
os.system ('ping -c 5 192.172.0.1')
os.system ('ping 192.172.0.1')
break
except Exception, e:
error = ' Interface ' + iface + 'does not exist...'
......@@ -144,11 +144,63 @@ def stop_ue():
send_command('AT+CGATT=0' , 'OK|ERROR' , timeout)
send_command('AT+CFUN=4' , 'OK' , timeout)
#reset the USB BUS of Bandrich UE
def reset_ue():
stringIdBandrich='BandRich, Inc. 4G LTE adapter'
status, out = commands.getstatusoutput('lsusb | grep -i \'' + stringIdBandrich + '\'')
if (out == '') :
print "Bandrich 4G LTE Adapter not found. Exiting now..."
sys.exit()
p=re.compile('Bus\s*(\w+)\s*Device\s*(\w+):\s*ID\s*(\w+):(\w+)')
res=p.findall(out)
BusId=res[0][0]
DeviceId=res[0][1]
VendorId=res[0][2]
ProductId=res[0][3]
usb_dir= find_usb_path(VendorId, ProductId)
print usb_dir
cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 5" )
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 5" )
def read_file(filename):
try:
file = open(filename, 'r')
return file.read()
except Exception, e:
#error = ' Filename ' + filename
#error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
#error = error + traceback.format_exc()
#print error
return ''
def find_usb_path(idVendor, idProduct):
for root, dirs, files in os.walk("/sys/bus/usb/devices", topdown=False):
for name in dirs:
tmpdir= os.path.join(root, name)
tmpidVendor = read_file(tmpdir+'/idVendor').replace("\n","")
tmpidProduct = read_file(tmpdir+'/idProduct').replace("\n","")
#print "tmpdir = " + tmpdir + " tmpidVendor = " + tmpidVendor + " tmpidProduct = " + tmpidProduct
if tmpidVendor == idVendor and tmpidProduct == idProduct:
return tmpdir
return ''
for arg in sys.argv[1:]:
if arg == '--start-ue' :
find_open_port()
print 'Using Serial port : ' + serial_port
start_ue()
elif arg == '--stop-ue' :
find_open_port()
print 'Using Serial port : ' + serial_port
stop_ue()
elif arg == '--reset-ue' :
reset_ue()
else :
print " Script called with wrong arguments, arg = " + arg
sys.exit()
#!/bin/bash
################################################################################
# OpenAirInterface
# Copyright(c) 1999 - 2015 Eurecom
#
# OpenAirInterface is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# OpenAirInterface is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenAirInterface.The full GNU General Public License is
# included in this distribution in the file called "COPYING". If not,
# see <http://www.gnu.org/licenses/>.
#
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
#
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
#
################################################################################
# file init_nas_nos1
# brief loads the nasmesh module and sets up the radio bearers (used to provide ip interface without S1 interface)
# author Florian Kaltenberger
#
#######################################
load_module()
{
mod_name=${1##*/}
mod_name=${mod_name%.*}
if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
then
echo "module $mod_name already loaded: I remove it first"
sudo rmmod $mod_name
fi
echo loading $mod_name
sudo insmod $1
}
function main()
{
PCI=`lspci -m | grep Xilinx`
if [ -z "$PCI" ]; then
echo "No card found. Stopping!"
return
fi
## This part corrects the wrong configuration of the endpoint done by the bios in some machines
echo "$PCI" | while read config_reg; do
SLOT_NUMBER=`echo $config_reg | awk -F\" '{print $1}'`
sudo setpci -s $SLOT_NUMBER 60.b=10
done
load_module $OPENAIR_DIR/targets/bin/openair_rf.ko
sleep 1
if [ ! -e /dev/openair0 ]; then
sudo mknod /dev/openair0 c 127 0
sudo chmod a+rw /dev/openair0
fi
DEVICE=`echo $PCI | awk -F\" '{print $(NF-1)}' | awk '{print $2}'`
DEVICE_SWID=${DEVICE:2:2}
if [ $DEVICE_SWID == '0a' ]; then
echo "Using firware version 10"
$OPENAIR_DIR/targets/bin/updatefw -s 0x43fffff0 -b -f $OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10
else
echo 'No corresponding firmware found'
return
fi
}
main "$@"
#!/bin/bash
#arg1 idVendor
#arg2 idProduct
argIdVendor=$1
argIdProduct=$2
echo $1
echo $2
for X in /sys/bus/usb/devices/*; do
#echo "$X"
idVendor=`cat "$X/idVendor" 2>/dev/null`
idProduct=`cat "$X/idProduct" 2>/dev/null`
if [ "$argIdVendor" == "$idVendor" ] && [ "$argIdProduct" == "$idProduct" ]
then
echo "$X"
fi
done
#!/bin/bash
#arg1 timeout to wait before running the script
#arg2 interface
#arg3 iperf arguments
args=($*)
timeout=${args[0]}
iface=${args[1]}
iperf_args=(${args[@]:2})
#array=${1:-1}
echo "args = ${args[@]}"
echo "timeout = $timeout"
echo "iface = $iface"
echo "iperf_args = ${iperf_args[@]}"
sleep $timeout
while true; do var=`ifconfig $iface` ;sleep 1; if [ "$var" != "" ]; then break; fi ; done ; sleep 5
iperf ${iperf_args[@]}
......@@ -45,6 +45,8 @@ MSC_GEN="False"
XFORMS="False"
PRINT_STATS="False"
VCD_TIMING="False"
LOWLATENCY_FLAG_USER="False"
FORCE_LOWLATENCY_FLAG_USER=""
REL="Rel10"
HW="EXMIMO"
NOS1=0
......@@ -113,7 +115,10 @@ Options
Shows detailed compilation instructions in makefile
--cflags_processor
Manually Add CFLAGS of processor if they are not detected correctly by script. Only add these flags if you know your processor supports them. Example flags: -msse3 -msse4.1 -msse4.2 -mavx2
--disable-deadline
Disables deadline scheduler of Linux kernel (>=3.14.x).
--enable-deadline
Disables deadline scheduler of Linux kernel (>=3.14.x).
Usage (first build):
oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files
......@@ -225,6 +230,15 @@ function main() {
CFLAGS_PROCESSOR_USER=$2
echo_info "setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER"
shift 2;;
--disable-deadline)
FORCE_LOWLATENCY_FLAG_USER="False"
echo_info "Disabling the usage of deadline scheduler"
shift 1;;
--enable-deadline)
FORCE_LOWLATENCY_FLAG_USER="True"
echo_info "Enabling the usage of deadline scheduler"
shift 1;;
-h | --help)
print_help
exit 1;;
......@@ -235,6 +249,31 @@ function main() {
esac
done
#Now we set flags to enable deadline scheduler settings
#By default: USRP: disable,
#By default: BLADERF: enable,
#By default: EXMIMO: enable
if [ "$FORCE_LOWLATENCY_FLAG_USER" = "" ]; then
if [ "$HW" = "EXMIMO" ] ; then
LOWLATENCY_FLAG_USER="True"
elif [ "$HW" = "ETHERNET" ] ; then
LOWLATENCY_FLAG_USER="True"
elif [ "$HW" = "OAI_USRP" ] ; then
LOWLATENCY_FLAG_USER="False"
elif [ "$HW" = "OAI_BLADERF" ] ; then
LOWLATENCY_FLAG_USER="False"
elif [ "$HW" = "None" ] ; then
LOWLATENCY_FLAG_USER="False"
else
echo_error "Unknown HW type $HW. Exiting now..."
exit
fi
else
LOWLATENCY_FLAG_USER=$FORCE_LOWLATENCY_FLAG_USER
fi
echo_info "Flags for Deadline scheduler: $LOWLATENCY_FLAG_USER"
############################################
# setting and printing OAI envs, we should check here
############################################
......@@ -321,6 +360,7 @@ function main() {
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
echo "set(PACKAGE_NAME \"${lte_exec}\")" >> $cmake_file
echo "set (LOWLATENCY \"${LOWLATENCY_FLAG_USER}\" )" >>$cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$lte_build_dir/build
cmake ..
......@@ -539,6 +579,7 @@ function main() {
echo "set(ENABLE_ITTI False )" >> $cmake_file
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo 'set(PACKAGE_NAME "\"rrh_gw\"")' >> $cmake_file
echo "set(LOWLATENCY \"${LOWLATENCY_FLAG_USER}\")" >>$cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
[ "$CLEAN" = "1" ] && rm -rf $DIR/rrh_gw/build
......
......@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(XFORMS True)
set(DEBUG_PHY False)
set(MU_RECIEVER False)
......
......@@ -163,33 +163,27 @@ install_gnutls_from_source(){
check_install_usrp_uhd_driver(){
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_usrp_uhd_driver_log.txt
echo_info "\nIn function: check_install_usrp_uhd_driver(). Installing USRP Drivers : The logfile for the installation is located here: $log_file "
(
#first we remove old installation
$SUDO apt-get remove uhd libuhd-dev libuhd003 uhd-host -y
v=$(lsb_release -cs)
$SUDO apt-add-repository "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
$SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
#The new USRP repository
$SUDO add-apt-repository ppa:ettusresearch/uhd -y
$SUDO apt-get update
$SUDO apt-get -y install python python-tk libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y install -t `lsb_release -cs` uhd --force-yes
) >& $log_file
$SUDO apt-get -y install libuhd-dev libuhd003 uhd-host
$SUDO uhd_images_downloader
}
check_install_bladerf_driver(){
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_bladerf_driver_log.txt
echo_info "\nIn function: check_install_bladerf_driver(). Install BLADERF drivers : The logfile for the installation is located here: $log_file "
(
$SUDO add-apt-repository -y ppa:bladerf/bladerf
$SUDO apt-get update
$SUDO apt-get install -y bladerf libbladerf-dev
$SUDO apt-get install -y bladerf-firmware-fx3
$SUDO apt-get install -y bladerf-fpga-hostedx40
bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img
) >& $log_file
}
check_install_additional_tools (){
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_additional_tools_log.txt
echo_info "\nIn function: check_install_oai_software(). Installing optional OAI packages : The logfile for the installation is located here: $log_file "
(
$SUDO apt-get update
$SUDO apt-get install -y \
check \
......@@ -199,7 +193,6 @@ check_install_additional_tools (){
libboost-all-dev \
libpthread-stubs0-dev \
openvpn \
phpmyadmin \
pkg-config \
python-dev \
python-pexpect \
......@@ -212,14 +205,9 @@ check_install_additional_tools (){
vlan \
ctags \
ntpdate
) >& $log_file
}
check_install_oai_software() {
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_oai_software_log.txt
echo_info "\nIn function: check_install_oai_software(). Installing mandatory OAI packages : The logfile for the installation is located here: $log_file "
(
$SUDO apt-get update
$SUDO apt-get install -y \
autoconf \
......@@ -280,7 +268,8 @@ check_install_oai_software() {
python-pip \
pydb \
wvdial \
python-numpy
python-numpy \
sshpass
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
if [ `lsb_release -rs` = '12.04' ] ; then
install_nettle_from_source
......@@ -290,7 +279,6 @@ check_install_oai_software() {
fi
$SUDO pip install paramiko
$SUDO pip install pyroute2
) > $log_file 2>&1
install_asn1c_from_source
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
......@@ -309,8 +297,8 @@ install_asn1c_from_source(){
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0
./configure
make -j`nproc`
$SUDO make install
) > $asn1_install_dir 2>&1
$SUDO make install
) > $asn1_install_dir 2>&1
}
#################################################
......
#!/bin/bash
echo "This script stops exmimo2 as it might be transmitting signal by itself if lte-softmodem terminates incorrectly"
if [ "$OPENAIR_DIR" == "" ]; then
echo "Is the OPENAIR_DIR path set correctly? Exiting now"
exit
fi
#load the module
sudo -E $OPENAIR_DIR/cmake_targets/tools/init_exmimo2
#now we stop the card from transmitting anything
cd $OPENAIR_DIR/targets/bin
sudo -E octave $OPENAIR_DIR/cmake_targets/tools/exmimo_stop_octave.m
......@@ -2723,8 +2723,16 @@ PMI_FEEDBACK:
random_channel(eNB2UE[2],0);
random_channel(eNB2UE[3],0);
}
}
if (PHY_vars_UE->perfect_ce==1) {
// fill in perfect channel estimates
freq_channel(eNB2UE[round],PHY_vars_UE->lte_frame_parms.N_RB_DL,12*PHY_vars_UE->lte_frame_parms.N_RB_DL + 1);
/*
write_output("channel.m","ch",eNB2UE[round]->ch[0],eNB2UE[round]->channel_length,1,8);
write_output("channelF.m","chF",eNB2UE[round]->chF[0],12*PHY_vars_UE->lte_frame_parms.N_RB_DL + 1,1,8);
*/
}
}
if(abstx) {
if (trials==0 && round==0) {
......@@ -2870,11 +2878,6 @@ PMI_FEEDBACK:
if (PHY_vars_UE->perfect_ce==1) {
if (awgn_flag==0) {
// fill in perfect channel estimates
freq_channel(eNB2UE[round],PHY_vars_UE->lte_frame_parms.N_RB_DL,12*PHY_vars_UE->lte_frame_parms.N_RB_DL + 1);
//write_output("channel.m","ch",desc1->ch[0],desc1->channel_length,1,8);
//write_output("channelF.m","chF",desc1->chF[0],nb_samples,1,8);
for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......
......@@ -47,8 +47,7 @@
#include "LAYER2/MAC/vars.h"
#ifdef XFORMS
#include <forms.h>
#include "../../USERSPACE_TOOLS/SCOPE/lte_scope.h"
#include "PHY/TOOLS/lte_phy_scope.h"
#endif //XFORMS
......@@ -176,13 +175,13 @@ int main(int argc, char **argv)
#ifdef XFORMS
FD_lte_scope *form_dl;
FD_lte_phy_scope_ue *form_ue;
char title[255];
fl_initialize (&argc, argv, NULL, 0, 0);
form_dl = create_form_lte_scope();
form_ue = create_lte_phy_scope_ue();
sprintf (title, "LTE DL SCOPE UE");
fl_show_form (form_dl->lte_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
#endif
logInit();
......
......@@ -45,7 +45,7 @@ double **cos_lut=NULL,**sin_lut=NULL;
void init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
......@@ -54,15 +54,17 @@ void init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
int16_t f;
uint8_t l;
if ((n_samples&1)==0) {
fprintf(stderr, "freq_channel_init: n_samples has to be odd\n");
return(-1);
}
cos_lut = (double **)malloc(n_samples*sizeof(double*));
sin_lut = (double **)malloc(n_samples*sizeof(double*));
delta_f = nb_rb*180000/(n_samples-1);
for (f=-(n_samples>>1); f<(n_samples>>1); f++) {
for (f=-(n_samples>>1); f<=(n_samples>>1); f++) {
freq=delta_f*(double)f*1e-6;// due to the fact that delays is in mus
cos_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
......@@ -81,9 +83,11 @@ void init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
}
}
return(0);
}
void freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
......@@ -93,22 +97,32 @@ void freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
static int freq_channel_init=0;
static int n_samples_max=0;
// printf("no of samples:%d,",n_samples);
// do some error checking
// n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC
if ((n_samples&1)==0) {
fprintf(stderr, "freq_channel: n_samples has to be odd\n");
return(-1);
}
// printf("no of taps:%d,",(int)desc->nb_taps);
if (freq_channel_init == 0) {
// we are initializing the lut for the largets possible n_samples=12*nb_rb+1
// if called with n_samples<12*nb_rb+1, we decimate the lut
n_samples_max=12*nb_rb+1;
init_freq_channel(desc,nb_rb,n_samples_max);
freq_channel_init=1;
if (init_freq_channel(desc,nb_rb,n_samples_max)==0)
freq_channel_init=1;
else
return(-1);
}
d=n_samples_max/n_samples;
d=(n_samples_max-1)/(n_samples-1);
//printf("no_samples=%d, n_samples_max=%d, d=%d\n",n_samples,n_samples_max,d);
start_meas(&desc->interp_freq);
for (f=-n_samples_max/2,f2=-n_samples/2; f<n_samples_max/2; f+=d,f2++) {
for (f=-n_samples_max/2,f2=-n_samples/2; f<=n_samples_max/2; f+=d,f2++) {
clut = cos_lut[n_samples_max/2+f];
slut = sin_lut[n_samples_max/2+f];
......@@ -129,6 +143,8 @@ void freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
}
stop_meas(&desc->interp_freq);
return(0);
}
double compute_pbch_sinr(channel_desc_t *desc,
......
......@@ -354,8 +354,8 @@ int gauss(unsigned int *gauss_LUT,unsigned char Nbits);
double gaussdouble(double,double);
void randominit(unsigned int seed_init);
double uniformrandom(void);
void freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples);
void init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples);
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples);
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples);
uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
void multipath_tv_channel(channel_desc_t *desc,
double **tx_sig_re,
......
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